org.hypergraphdb.query
Class AtomTypeCondition

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

public class AtomTypeCondition
extends java.lang.Object
implements HGQueryCondition, HGAtomPredicate

An AtomTypeCondition examines the type of a given atom and evaluates to true or false depending on whether the type of the atom matches exactly (i.e. has the same type handle) as that of the condition. Note that this condition looks at the concrete type of the atom and ignores and sub-typing relationships.

The type can be specified either as a HyperGraph handle or as a Java class. In the latter, the corresponding HyperGraph will be retrieved at appropriate times.

Author:
Borislav Iordanov

Constructor Summary
AtomTypeCondition()
           
AtomTypeCondition(java.lang.Class<?> javaClass)
           
AtomTypeCondition(HGHandle typeHandle)
           
 
Method Summary
 boolean equals(java.lang.Object x)
           
 java.lang.Class<?> getJavaClass()
           
 HGHandle getTypeHandle()
           
 int hashCode()
           
 boolean satisfies(HyperGraph hg, HGHandle value)
          Check whether a given Object satisfies this query condition.
 void setJavaClass(java.lang.Class<?> c)
           
 void setTypeHandle(HGHandle handle)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomTypeCondition

public AtomTypeCondition()

AtomTypeCondition

public AtomTypeCondition(java.lang.Class<?> javaClass)

AtomTypeCondition

public AtomTypeCondition(HGHandle typeHandle)
Method Detail

setJavaClass

public void setJavaClass(java.lang.Class<?> c)

getJavaClass

public java.lang.Class<?> getJavaClass()

setTypeHandle

public void setTypeHandle(HGHandle handle)

getTypeHandle

public HGHandle getTypeHandle()

satisfies

public boolean satisfies(HyperGraph hg,
                         HGHandle value)
Description copied from interface: HGAtomPredicate

Check whether a given Object satisfies this query condition.

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object x)
Overrides:
equals in class java.lang.Object

toString

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