de.grogra.graph
Class ArrayPath
java.lang.Object
de.grogra.graph.ArrayPath
- All Implemented Interfaces:
- Path
public final class ArrayPath
- extends java.lang.Object
- implements Path
Fields inherited from interface de.grogra.graph.Path |
PATH_0 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
stack
public final ObjectList stack
ArrayPath
public ArrayPath(Graph graph)
ArrayPath
public ArrayPath(Path path)
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