org.neo4j.kernel.impl.traversal
Class TraversalDescriptionImpl
java.lang.Object
org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl
- All Implemented Interfaces:
- TraversalDescription
public final class TraversalDescriptionImpl
- extends Object
- implements TraversalDescription
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TraversalDescriptionImpl
public TraversalDescriptionImpl()
traverse
public Traverser traverse(Node startNode)
- Description copied from interface:
TraversalDescription
- Traverse from
startNode based on all the rules and behavior
in this description. A Traverser is returned which is
used to step through the graph and getting results back. The traversal
is not guaranteed to start before the Traverser is used.
- Specified by:
traverse in interface TraversalDescription
- Parameters:
startNode - the Node to start the traversal from.
- Returns:
- a
Traverser used to step through the graph and to get
results from.
uniqueness
public TraversalDescription uniqueness(UniquenessFactory uniqueness)
- Description copied from interface:
TraversalDescription
- Sets the
UniquenessFactory for creating the
UniquenessFilter to use.
- Specified by:
uniqueness in interface TraversalDescription
- Parameters:
uniqueness - the UniquenessFactory the creator
of the desired UniquenessFilter to use.
- Returns:
- a new traversal description with the new modifications.
uniqueness
public TraversalDescription uniqueness(UniquenessFactory uniqueness,
Object parameter)
- Description copied from interface:
TraversalDescription
- Sets the
UniquenessFactory for creating the
UniquenessFilter to use. It also accepts an extra parameter
which is mandatory for certain uniqueness's, f.ex
Uniqueness.NODE_RECENT.
- Specified by:
uniqueness in interface TraversalDescription
- Parameters:
uniqueness - the UniquenessFactory the creator
of the desired UniquenessFilter to use.
- Returns:
- a new traversal description with the new modifications.
prune
public TraversalDescription prune(PruneEvaluator pruning)
- Description copied from interface:
TraversalDescription
- Adds
pruning to the list of PruneEvaluators which
are used to prune the traversal. The semantics for many prune evaluators
is that if any one of the added prune evaluators returns true
it's considered OK to prune there.
- Specified by:
prune in interface TraversalDescription
- Parameters:
pruning - the PruneEvaluator to add to the list of prune
evaluators to use.
- Returns:
- a new traversal description with the new modifications.
filter
public TraversalDescription filter(Predicate<Path> filter)
- Description copied from interface:
TraversalDescription
- Adds
filter to the list of filters to use, i.e. a filter to
decide which positions are OK to return or not.
Each position is represented by a Path from the start node of the
traversal to the current node. The current node is the
Path.endNode() of the path. Each Path must be accepted
by all added filter for it to be returned from the traverser. For adding
a filter which returns paths accepted by any filters, see
Traversal.returnAcceptedByAny(Predicate...) for convenience.
- Specified by:
filter in interface TraversalDescription
- Parameters:
filter - the Predicate to add to the list of filters.
- Returns:
- a new traversal description with the new modifications.
evaluator
public TraversalDescription evaluator(Evaluator evaluator)
- Description copied from interface:
TraversalDescription
- NOTE: Replaces
TraversalDescription.filter(Predicate) and
TraversalDescription.prune(PruneEvaluator).
Adds evaluator to the list of evaluators which will control the
behaviour of the traversal. Each Evaluator can decide whether or
not to include a position in the traverser result, i.e. return it from
the Traverser iterator and also whether to continue down that
path or to prune, so that the traverser won't continue further down that
path.
Multiple Evaluators can be added. For a path to be included in
the result, all evaluators must agree to include it, i.e. returning
either Evaluation.INCLUDE_AND_CONTINUE or
Evaluation.INCLUDE_AND_PRUNE. For making the traversal continue
down that path all evaluators must agree to continue from that path, i.e.
returning either Evaluation.INCLUDE_AND_CONTINUE or
Evaluation.EXCLUDE_AND_CONTINUE.
- Specified by:
evaluator in interface TraversalDescription
- Returns:
- a new traversal description with the new modifications.
order
public TraversalDescription order(BranchOrderingPolicy selector)
- Description copied from interface:
TraversalDescription
- Sets the
BranchOrderingPolicy to use. A BranchSelector
is the basic decisions in the traversal of "where to go next".
Examples of default implementations are "breadth first" and
"depth first", which can be set with convenience methods
TraversalDescription.breadthFirst() and TraversalDescription.depthFirst().
- Specified by:
order in interface TraversalDescription
- Parameters:
selector - the factory which creates the BranchSelector
to use with the traversal.
- Returns:
- a new traversal description with the new modifications.
depthFirst
public TraversalDescription depthFirst()
- Description copied from interface:
TraversalDescription
- A convenience method for
TraversalDescription.order(BranchOrderingPolicy)
where a "preorder depth first" selector is used. Positions which are
deeper than the current position will be returned before positions on
the same depth. See http://en.wikipedia.org/wiki/Depth-first_search
- Specified by:
depthFirst in interface TraversalDescription
- Returns:
- a new traversal description with the new modifications.
breadthFirst
public TraversalDescription breadthFirst()
- Description copied from interface:
TraversalDescription
- A convenience method for
TraversalDescription.order(BranchOrderingPolicy)
where a "preorder breadth first" selector is used. All positions with
the same depth will be returned before advancing to the next depth.
See http://en.wikipedia.org/wiki/Breadth-first_search
- Specified by:
breadthFirst in interface TraversalDescription
- Returns:
- a new traversal description with the new modifications.
relationships
public TraversalDescription relationships(RelationshipType type)
- Description copied from interface:
TraversalDescription
- Adds
type to the list of relationship types to traverse.
There's no priority or order in which types to traverse.
- Specified by:
relationships in interface TraversalDescription
- Parameters:
type - the RelationshipType to add to the list of types
to traverse.
- Returns:
- a new traversal description with the new modifications.
relationships
public TraversalDescription relationships(RelationshipType type,
Direction direction)
- Description copied from interface:
TraversalDescription
- Adds
type to the list of relationship types to traverse in
the given direction. There's no priority or order in which
types to traverse.
- Specified by:
relationships in interface TraversalDescription
- Parameters:
type - the RelationshipType to add to the list of types
to traverse.direction - the Direction to traverse this type of
relationship in.
- Returns:
- a new traversal description with the new modifications.
expand
public TraversalDescription expand(RelationshipExpander expander)
- Description copied from interface:
TraversalDescription
- Sets the
RelationshipExpander as the expander of relationships,
discarding all previous calls to
TraversalDescription.relationships(RelationshipType) and
TraversalDescription.relationships(RelationshipType, Direction).
- Specified by:
expand in interface TraversalDescription
- Parameters:
expander - the RelationshipExpander to use.
- Returns:
- a new traversal description with the new modifications.
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.