public class RABasedPredicate extends Object implements HGAtomPredicate, CloseMe
Make a random access result set as a predicate. Random access result sets don't always have a constant time (like "true" random access structures), but are always assumed to have at least sublinear time. In other words, their goTo method should have complexity smaller than O(N). In practice, RA sets are usually B-Tree or "B-Forests" accessed in O(logN).
If an RABasedPredicate
is initialized with a HGQuery
instead of a result set, the query will be executed the first time satisfies
is called.
The close
method will only close the result set if this RABasedPredicate
was created by calling the HGQuery
based constructor.
Constructor and Description |
---|
RABasedPredicate(HGQuery query) |
RABasedPredicate(HGRandomAccessResult ras) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
satisfies(HyperGraph hg,
HGHandle handle)
Return
true if handle is a member of
the HGRandomAccessResult set on which this predicate
is based. |
public RABasedPredicate(HGRandomAccessResult ras)
public RABasedPredicate(HGQuery query)
public boolean satisfies(HyperGraph hg, HGHandle handle)
Return true
if handle
is a member of
the HGRandomAccessResult
set on which this predicate
is based. Return false
otherwise.
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.Copyright © 2015. All rights reserved.