public class AtomTypeCondition extends Object implements HGQueryCondition, HGAtomPredicate, TypeCondition
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. However, those two properties overlap each other, in the sense the you
can set one or the other, but not both at the same time. If you set the type
as a Java class, the corresponding HGHandle
will be retrieved every time
it is needed. In particular, if this is used as a filtering condition applied
iteratively over a large result set, performance will be hurt by the extra step.
Constructor and Description |
---|
AtomTypeCondition() |
AtomTypeCondition(Class<?> javaClass) |
AtomTypeCondition(HGHandle typeHandle) |
AtomTypeCondition(Ref<?> typeRef)
Construct a new atom type condition.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object x) |
Class<?> |
getJavaClass() |
HGHandle |
getTypeHandle() |
HGHandle |
getTypeHandle(HyperGraph graph) |
Ref<?> |
getTypeReference() |
int |
hashCode() |
boolean |
satisfies(HyperGraph hg,
HGHandle value)
Check whether a given
Object satisfies this
query condition. |
void |
setJavaClass(Class<?> c) |
void |
setTypeHandle(HGHandle handle) |
void |
setTypeReference(Ref<?> type) |
String |
toString() |
HGHandle |
typeHandleIfAvailable(HyperGraph graph) |
public AtomTypeCondition()
public AtomTypeCondition(Ref<?> typeRef)
Construct a new atom type condition.
public AtomTypeCondition(Class<?> javaClass)
public AtomTypeCondition(HGHandle typeHandle)
public HGHandle typeHandleIfAvailable(HyperGraph graph)
public void setJavaClass(Class<?> c)
public Class<?> getJavaClass()
public void setTypeHandle(HGHandle handle)
public HGHandle getTypeHandle()
public HGHandle getTypeHandle(HyperGraph graph)
public Ref<?> getTypeReference()
getTypeReference
in interface TypeCondition
public void setTypeReference(Ref<?> type)
public boolean satisfies(HyperGraph hg, HGHandle value)
HGAtomPredicate
Check whether a given Object
satisfies this
query condition.
satisfies
in interface HGAtomPredicate
hg
- The HyperGraph
instance.value
- The atom on which to test the query condition.true
if the passed in parameter satisfies
the condition and false
otherwise.Copyright © 2015. All rights reserved.