1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package io.github.prolobjectlink.prolog.jpl7;
30
31 import io.github.prolobjectlink.prolog.AbstractClause;
32 import io.github.prolobjectlink.prolog.PrologClause;
33 import io.github.prolobjectlink.prolog.PrologIndicator;
34 import io.github.prolobjectlink.prolog.PrologProvider;
35 import io.github.prolobjectlink.prolog.PrologTerm;
36
37
38
39
40
41
42 final class JplClause extends AbstractClause implements PrologClause {
43
44 private final PrologIndicator indicator;
45
46 JplClause(PrologProvider provider, PrologTerm head, boolean dynamic, boolean multifile, boolean discontiguous) {
47 super(provider, head, dynamic, multifile, discontiguous);
48 this.indicator = new JplIndicator(head.getFunctor(), head.getArity());
49 }
50
51 JplClause(PrologProvider provider, PrologTerm head, PrologTerm body, boolean dynamic, boolean multifile,
52 boolean discontiguous) {
53 super(provider, head, body, dynamic, multifile, discontiguous);
54 this.indicator = new JplIndicator(head.getFunctor(), head.getArity());
55 }
56
57 public PrologIndicator getPrologIndicator() {
58 return indicator;
59 }
60
61 @Override
62 public int hashCode() {
63 final int prime = 31;
64 int result = super.hashCode();
65 result = prime * result + ((indicator == null) ? 0 : indicator.hashCode());
66 return result;
67 }
68
69 @Override
70 public boolean equals(Object obj) {
71 if (this == obj)
72 return true;
73 if (!super.equals(obj))
74 return false;
75 if (getClass() != obj.getClass())
76 return false;
77 JplClause other = (JplClause) obj;
78 if (indicator == null) {
79 if (other.indicator != null)
80 return false;
81 } else if (!indicator.equals(other.indicator)) {
82 return false;
83 }
84 return true;
85 }
86 }