org.hypergraphdb.query
Class ArityCondition

java.lang.Object
  extended by org.hypergraphdb.query.ArityCondition
All Implemented Interfaces:
HGAtomPredicate, HGQueryCondition

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)).

Author:
Borislav Iordanov

Constructor Summary
ArityCondition(int arity)
           
 
Method Summary
 boolean satisfies(HyperGraph hg, HGHandle handle)
          Return true if handle to a HyperGraph link and false if it refers to a HyperGraph node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArityCondition

public ArityCondition(int arity)
Method Detail

satisfies

public boolean satisfies(HyperGraph hg,
                         HGHandle handle)

Return true if handle to a HyperGraph link and false if it refers to a HyperGraph node.

Specified by:
satisfies in interface HGAtomPredicate
Parameters:
hg - The HyperGraph instance.
handle - The atom on which to test the query condition.
Returns:
true if the passed in parameter satisfies the condition and false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object