public class ArityCondition extends java.lang.Object implements HGQueryCondition, HGAtomPredicate
The ArityCondition
is a simply predicate condition that checks the arity
(i.e. the size of a target set) of its argument. A link is an atom whose target set has an arity > 0.
Thus to check whether an atom is a link, one can use the condition new Not(new ArityCondition(0))
.
Constructor and Description |
---|
ArityCondition() |
ArityCondition(int arity) |
ArityCondition(Ref<java.lang.Integer> arity) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object x) |
int |
getArity() |
Ref<java.lang.Integer> |
getArityReference() |
int |
hashCode() |
boolean |
satisfies(HyperGraph hg,
HGHandle handle)
Return true if
handle to a HyperGraph link and
false if it refers to a HyperGraph node. |
void |
setArity(int arity) |
void |
setArityReference(Ref<java.lang.Integer> arity) |
java.lang.String |
toString() |
public ArityCondition()
public ArityCondition(int arity)
public ArityCondition(Ref<java.lang.Integer> arity)
public boolean satisfies(HyperGraph hg, HGHandle handle)
Return true if handle
to a HyperGraph link and
false
if it refers to a HyperGraph node.
satisfies
in interface HGAtomPredicate
hg
- The HyperGraph
instance.handle
- The atom on which to test the query condition.true
if the passed in parameter satisfies
the condition and false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object x)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int getArity()
public void setArity(int arity)
public Ref<java.lang.Integer> getArityReference()
public void setArityReference(Ref<java.lang.Integer> arity)