|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hypergraphdb.algorithms.DefaultALGenerator
public class DefaultALGenerator
A default implementation of the HGALGenerator that should cover most
common cases. In the description below, the term focus atom is used to refer
to the atom whose adjency list is being generated.
The adjency list generation process is conceptually split into two main steps:
Step 1 may be augmented with a filter to select links only satisfying certain criteria.
This filter is configured in the form of a link predicate, a HGQueryCondition.
Step 2 may be configured to treat links as ordered. When links are interpreted as ordered, there are several further options:
All of the above mentioned options are configured at construction time. In the simplest case
of no link or sibling filtering and where links are unordered, use the SimpleALGenerator
instead which will be somewhat faster.
| Constructor Summary | |
|---|---|
DefaultALGenerator()
Default constructor available, but the class is not really default constructible - you must at least specify a HyperGraph instance on which to operate. |
|
DefaultALGenerator(HyperGraph graph)
Construct with default values: no link or sibling predicate, returning all siblings in their normal storage order. |
|
DefaultALGenerator(HyperGraph hg,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate)
Construct a default adjency list generator where links are considered unordered. |
|
DefaultALGenerator(HyperGraph hg,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate,
boolean returnPreceeding,
boolean returnSucceeding,
boolean reverseOrder)
Construct a default adjency list generator where links are considered ordered. |
|
DefaultALGenerator(HyperGraph graph,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate,
boolean returnPreceeding,
boolean returnSucceeding,
boolean reverseOrder,
boolean returnSource)
Construct a default adjency list generator where links are considered ordered. |
|
| Method Summary | |
|---|---|
void |
close()
|
HGSearchResult<HGHandle> |
generate(HGHandle h)
Return an Iterator over all atoms adjacent to the passed in
atom. |
HGHandle |
getCurrentLink()
Return the HGHandle of the currently examined link. |
HyperGraph |
getGraph()
|
HGAtomPredicate |
getLinkPredicate()
|
HGAtomPredicate |
getSiblingPredicate()
|
boolean |
isReturnPreceeding()
|
boolean |
isReturnSource()
|
boolean |
isReturnSucceeding()
|
boolean |
isReverseOrder()
|
void |
setGraph(HyperGraph graph)
|
void |
setLinkPredicate(HGAtomPredicate linkPredicate)
|
void |
setReturnPreceeding(boolean returnPreceeding)
|
void |
setReturnSource(boolean returnSource)
|
void |
setReturnSucceeding(boolean returnSucceeding)
|
void |
setReverseOrder(boolean reverseOrder)
|
void |
setSiblingPredicate(HGAtomPredicate siblingPredicate)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultALGenerator()
Default constructor available, but the class is not really default constructible -
you must at least specify a HyperGraph instance on which to operate.
public DefaultALGenerator(HyperGraph graph)
Construct with default values: no link or sibling predicate, returning all siblings in their normal storage order.
public DefaultALGenerator(HyperGraph hg,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate)
Construct a default adjency list generator where links are considered unordered.
hg - The HyperGraph instance from where incidence sets are fetched.linkPredicate - The predicate by which links are filtered. Only links satisfying
this predicate will be considered. If this parameter is null, all links
from the incidence set will be considered.siblingPredicate - The predicate by which sibling atoms are filtered from the
adjency list. Only atoms satisfying this predicate will be returned. If this parameter
is null, all sibling atoms will be considered.
public DefaultALGenerator(HyperGraph hg,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate,
boolean returnPreceeding,
boolean returnSucceeding,
boolean reverseOrder)
Construct a default adjency list generator where links are considered ordered.
The constructor does NOT allow both returnSucceeding and returnPreceeding
to be set to false. This will always return empty adjency lists and does not make
any sense. Even, in a more complex situation where those parameters are determined at run-time
following some unforeseen logic, the caller must make sure that not both of those parameters are
false.
hg - The HyperGraph instance from where incidence sets are fetched.linkPredicate - The predicate by which links are filtered. Only links satisfying
this predicate will be considered. If this parameter is null, all links
from the incidence set will be considered.siblingPredicate - The predicate by which sibling atoms are filtered from the
adjency list. Only atoms satisfying this predicate will be returned. If this parameter
is null, all sibling atoms will be considered.returnPreceeding - Whether or not to return siblings that appear before the focus
atom in an ordered link.returnSucceding - Whether or not to return siblings that appear after the focus atom
in an ordered link.reverseOrder - Whether or not to reverse the default order implied by a link's target
array. Note that this parameter affects the meaning of preceeding and succeeding
in the above two parameters.
public DefaultALGenerator(HyperGraph graph,
HGAtomPredicate linkPredicate,
HGAtomPredicate siblingPredicate,
boolean returnPreceeding,
boolean returnSucceeding,
boolean reverseOrder,
boolean returnSource)
Construct a default adjency list generator where links are considered ordered.
The constructor does NOT allow both returnSucceeding and returnPreceeding
to be set to false. This will always return empty adjency lists and does not make
any sense. Even, in a more complex situation where those parameters are determined at run-time
following some unforeseen logic, the caller must make sure that not both of those parameters are
false.
hg - The HyperGraph instance from where incidence sets are fetched.linkPredicate - The predicate by which links are filtered. Only links satisfying
this predicate will be considered. If this parameter is null, all links
from the incidence set will be considered.siblingPredicate - The predicate by which sibling atoms are filtered from the
adjency list. Only atoms satisfying this predicate will be returned. If this parameter
is null, all sibling atoms will be considered.returnPreceeding - Whether or not to return siblings that appear before the focus
atom in an ordered link.returnSucceding - Whether or not to return siblings that appear after the focus atom
in an ordered link.reverseOrder - Whether or not to reverse the default order implied by a link's target
array. Note that this parameter affects the meaning of preceeding and succeeding
in the above two parameters.returnSource - Whether to return the source/originating atom along with its siblings. The default
is false.| Method Detail |
|---|
public HGHandle getCurrentLink()
HGALGeneratorReturn the HGHandle of the currently examined link.
getCurrentLink in interface HGALGeneratorpublic HGSearchResult<HGHandle> generate(HGHandle h)
HGALGenerator
Return an Iterator over all atoms adjacent to the passed in
atom.
generate in interface HGALGeneratorh - The handle of the atom of interest.public void close()
close in interface CloseMepublic HyperGraph getGraph()
public void setGraph(HyperGraph graph)
public HGAtomPredicate getLinkPredicate()
public void setLinkPredicate(HGAtomPredicate linkPredicate)
public HGAtomPredicate getSiblingPredicate()
public void setSiblingPredicate(HGAtomPredicate siblingPredicate)
public boolean isReturnPreceeding()
public void setReturnPreceeding(boolean returnPreceeding)
public boolean isReturnSucceeding()
public void setReturnSucceeding(boolean returnSucceeding)
public boolean isReverseOrder()
public void setReverseOrder(boolean reverseOrder)
public boolean isReturnSource()
public void setReturnSource(boolean returnSource)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||