org.neo4j.kernel.impl.traversal
Class TraversalPath

java.lang.Object
  extended by org.neo4j.kernel.impl.traversal.TraversalPath
All Implemented Interfaces:
Iterable<PropertyContainer>, Path

public class TraversalPath
extends Object
implements Path


Method Summary
 Node endNode()
          Returns the end node of this path.
 boolean equals(Object obj)
           
 int hashCode()
           
 Iterator<PropertyContainer> iterator()
          Iterates through both the Nodes and Relationships of this path in order.
 Relationship lastRelationship()
          Returns the last Relationship in this path.
 int length()
          Returns the length of this path.
 Iterable<Node> nodes()
          Returns all the nodes in this path.
 Iterable<Relationship> relationships()
          Returns all the relationships in between the nodes which this path consists of.
 Node startNode()
          Returns the start node of this path.
 String toString()
          Returns a natural string representation of this path.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

startNode

public Node startNode()
Description copied from interface: Path
Returns the start node of this path. It's also the first node returned from the Path.nodes() iterable.

Specified by:
startNode in interface Path
Returns:
the start node.

endNode

public Node endNode()
Description copied from interface: Path
Returns the end node of this path. It's also the last node returned from Path.nodes() iterable. If the Path.length() of this path is 0 the end node returned by this method is the same as the start node. If a path is emitted from a traverser the end node is the current node where the traverser is at the moment.

Specified by:
endNode in interface Path
Returns:
the end node.

lastRelationship

public Relationship lastRelationship()
Description copied from interface: Path
Returns the last Relationship in this path.

Specified by:
lastRelationship in interface Path
Returns:
the last Relationship in this path, or null if this path contains no Relationships.

nodes

public Iterable<Node> nodes()
Description copied from interface: Path
Returns all the nodes in this path. The first node is the same as Path.startNode() and the last node is the same as Path.endNode(). In between those nodes there can be an arbitrary number of nodes. The shortest path possible is just one node, where also the the start node is the same as the end node.

Specified by:
nodes in interface Path
Returns:
the nodes in this path.

relationships

public Iterable<Relationship> relationships()
Description copied from interface: Path
Returns all the relationships in between the nodes which this path consists of.

Specified by:
relationships in interface Path
Returns:
the relationships in this path.

iterator

public Iterator<PropertyContainer> iterator()
Description copied from interface: Path
Iterates through both the Nodes and Relationships of this path in order. Interleaving Nodes with Relationships, starting and ending with a Node (the Path.startNode() and Path.endNode() respectively).

Specified by:
iterator in interface Iterable<PropertyContainer>
Specified by:
iterator in interface Path
See Also:
Iterable.iterator()

length

public int length()
Description copied from interface: Path
Returns the length of this path. That is the number of relationships (which is the same as the number of nodes minus one). The shortest path possible is of length 0.

Specified by:
length in interface Path
Returns:
the length (i.e. the number of relationships) in the path.

toString

public String toString()
Description copied from interface: Path
Returns a natural string representation of this path. The string representation shows the nodes with relationships (and their directions) in between them.

Specified by:
toString in interface Path
Overrides:
toString in class Object
Returns:
A string representation of the path.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.