org.hypergraphdb.query
Class TypedValueCondition

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

public class TypedValueCondition
extends AtomValueCondition

This is a HGQueryCondition that constrains the value of an atom as well as its type. In general, the HyperGraph type system allows values to have multiple types. Two atoms X and Y can share the same value V without however having the same type. X may be of type T and Y may be of type S different than T. In such situations, when performing a query by value, a TypedValueCondition should be used instead of AtomValueCondition.

Author:
Borislav Iordanov

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

Constructor Detail

TypedValueCondition

public TypedValueCondition()

TypedValueCondition

public TypedValueCondition(HGHandle typeHandle,
                           java.lang.Object value)

TypedValueCondition

public TypedValueCondition(java.lang.Class<?> javaClass,
                           java.lang.Object value)

TypedValueCondition

public TypedValueCondition(HGHandle typeHandle,
                           java.lang.Object value,
                           ComparisonOperator op)

TypedValueCondition

public TypedValueCondition(java.lang.Class<?> javaClass,
                           java.lang.Object value,
                           ComparisonOperator op)
Method Detail

satisfies

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

Check whether a given Object satisfies this query condition.

Specified by:
satisfies in interface HGAtomPredicate
Overrides:
satisfies in class AtomValueCondition
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.

setTypeHandle

public void setTypeHandle(HGHandle typeHandle)

getTypeHandle

public HGHandle getTypeHandle()

setJavaClass

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

getJavaClass

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

toString

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

hashCode

public int hashCode()
Overrides:
hashCode in class AtomValueCondition

equals

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