de.grogra.graph
Class ArrayPath

java.lang.Object
  extended by de.grogra.graph.ArrayPath
All Implemented Interfaces:
Path

public final class ArrayPath
extends java.lang.Object
implements Path


Field Summary
 ObjectList stack
           
 
Fields inherited from interface de.grogra.graph.Path
PATH_0
 
Constructor Summary
ArrayPath(Graph graph)
           
ArrayPath(Path path)
           
 
Method Summary
 void clear(Graph graph)
           
 boolean endsInNode()
           
 int getEdgeBits(int index)
          Returns the edge bits (see Graph.getEdgeBits(Object)) of the edge at index.
 Graph getGraph()
          Returns the graph which contains this path.
 java.lang.Object getNode(int index)
           
 int getNodeAndEdgeCount()
          Returns the number of nodes and edges of this path.
 java.lang.Object getObject(int index)
          Returns the node or edge at index.
 long getObjectId(int index)
           
 int indexOf(java.lang.Object object, boolean asNode)
           
 boolean isInEdgeDirection(int index)
          Checks whether the path traverses the edge at index in edge direction or in reverse edge direction.
 boolean isInstancingEdge(int index)
           
 java.lang.Object popEdgeSet()
           
 java.lang.Object popNode()
           
 void pushEdges(int e, boolean dir, long id, boolean instancing)
           
 void pushEdgeSet(java.lang.Object edge, long id, boolean instancing)
           
 void pushNode(java.lang.Object node, long id)
           
 void set(Path path)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stack

public final ObjectList stack
Constructor Detail

ArrayPath

public ArrayPath(Graph graph)

ArrayPath

public ArrayPath(Path path)
Method Detail

clear

public void clear(Graph graph)

endsInNode

public boolean endsInNode()

getEdgeBits

public int getEdgeBits(int index)
Description copied from interface: Path
Returns the edge bits (see Graph.getEdgeBits(Object)) of the edge at index. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.

Specified by:
getEdgeBits in interface Path
Parameters:
index - edge index
Returns:
edge bits of edge

getGraph

public Graph getGraph()
Description copied from interface: Path
Returns the graph which contains this path.

Specified by:
getGraph in interface Path
Returns:
graph of path

getNode

public java.lang.Object getNode(int index)

getNodeAndEdgeCount

public int getNodeAndEdgeCount()
Description copied from interface: Path
Returns the number of nodes and edges of this path. If this is even, the path ends in an edge; if this is odd, the path ends in a node.

Specified by:
getNodeAndEdgeCount in interface Path
Returns:
number of nodes and edges

getObject

public java.lang.Object getObject(int index)
Description copied from interface: Path
Returns the node or edge at index. Because a path always starts with a node, even values of index address nodes, while odd values address edges. Edges may be returned as null, in this case only the information provided by Path.getEdgeBits(int) and Path.isInEdgeDirection(int) is available for the edge. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount().

Specified by:
getObject in interface Path
Parameters:
index - node or edge index
Returns:
node or edge at index

getObjectId

public long getObjectId(int index)
Specified by:
getObjectId in interface Path

indexOf

public int indexOf(java.lang.Object object,
                   boolean asNode)

isInEdgeDirection

public boolean isInEdgeDirection(int index)
Description copied from interface: Path
Checks whether the path traverses the edge at index in edge direction or in reverse edge direction. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.

Specified by:
isInEdgeDirection in interface Path
Parameters:
index - edge index
Returns:
true iff path traverses edge in its direction

isInstancingEdge

public boolean isInstancingEdge(int index)
Specified by:
isInstancingEdge in interface Path

popEdgeSet

public java.lang.Object popEdgeSet()

popNode

public java.lang.Object popNode()

pushEdges

public void pushEdges(int e,
                      boolean dir,
                      long id,
                      boolean instancing)

pushEdgeSet

public void pushEdgeSet(java.lang.Object edge,
                        long id,
                        boolean instancing)

pushNode

public void pushNode(java.lang.Object node,
                     long id)

set

public void set(Path path)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object