|
|||||||||
| Home >> All >> com >> phoenixst >> [ plexus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.phoenixst.plexus
Class DefaultGraph.AdjacencyList

java.lang.Objectcom.phoenixst.plexus.DefaultGraph.AdjacencyList
- All Implemented Interfaces:
- java.io.Serializable
- Enclosing class:
- DefaultGraph
- private class DefaultGraph.AdjacencyList
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
An adjacency list implementation. When using this method of
representation, each node in the graph has an associated
adjacency list. A node's adjacency list contains information
about which other nodes are adjacent to it, and through which
edges. Node comparisons use ==
only. When used by a multi-graph, a self-loop should
only be included once.
| Nested Class Summary | |
private class |
DefaultGraph.AdjacencyList.Cursor
|
private class |
DefaultGraph.AdjacencyList.DirectedEdgePredicate
Returns true if the head of the specified
DefaultObjectEdge is the same that specified
by the constructor. |
private class |
DefaultGraph.AdjacencyList.InEdgePredicate
Returns true if the head of the specified
DefaultObjectEdge is the same as the base
node for this adjacency list. |
private class |
DefaultGraph.AdjacencyList.OutEdgePredicate
Returns true if the tail of the specified
DefaultObjectEdge is the same as the base
node for this adjacency list. |
private class |
DefaultGraph.AdjacencyList.SelfEdgePredicate
Returns true if the tail and head the
specified DefaultObjectEdge are the same. |
private class |
DefaultGraph.AdjacencyList.UndirectedEdgePredicate
Returns true if the head or tail of the
specified DefaultObjectEdge is the same that specified
by the constructor. |
| Field Summary | |
private java.util.ArrayList |
edges
The list of Edge objects in this adjacency list. |
private boolean |
isValid
Whether or not this adjacency list is still valid (has not been cleared). |
private java.lang.Object |
node
The node for which this is an adjacency list. |
| Constructor Summary | |
private |
DefaultGraph.AdjacencyList(java.lang.Object node)
Constructs a new AdjacencyList for the
specified node. |
| Method Summary | |
private DefaultObjectEdge |
addTo(java.lang.Object object,
DefaultGraph.AdjacencyList headAdj)
Adds the specified edge to this AdjacencyList. |
private void |
clear()
Clears this AdjacencyList and renders it
invalid for further use. |
private boolean |
contains(DefaultObjectEdge edge)
Returns whether or not this AdjacencyList
contains the specified edge. |
private DefaultGraph.AdjacencyList.Cursor |
cursor()
Returns a Cursor over all the edges in this
AdjacencyList. |
private DefaultGraph.AdjacencyList.Cursor |
cursorTo(java.lang.Object head)
Returns a Cursor over all the edges in this
AdjacencyList to the specified node. |
private int |
degree()
Returns the number of edges in this AdjacencyList, with self-loops counted twice. |
private DefaultObjectEdge |
getTo(java.lang.Object head)
Returns the specified edge if this AdjacencyList contains it, or
null if it doesn't. |
private DefaultGraph.AdjacencyList.Cursor |
inCursor()
Returns a Cursor over all the in edges in
this AdjacencyList. |
private int |
inDegree()
Returns the number of in edges in this AdjacencyList. |
private DefaultGraph.AdjacencyList.Cursor |
outCursor()
Returns a Cursor over all the out edges in
this AdjacencyList. |
private int |
outDegree()
Returns the number of out edges in this AdjacencyList. |
private boolean |
remove(DefaultObjectEdge edge)
Removes the specified edge from this AdjacencyList. |
private void |
remove(int index)
Removes the edge at the specified index from this AdjacencyList. |
private boolean |
removeHelper(DefaultObjectEdge edge)
If the specified edge is in this AdjacencyList, removes it, signals the
Graph about the change, and returns
true. |
private int |
size()
Returns the number of edges in this AdjacencyList. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
node
private java.lang.Object node
- The node for which this is an adjacency list.
edges
private java.util.ArrayList edges
- The list of Edge objects in this adjacency list.
isValid
private boolean isValid
- Whether or not this adjacency list is still valid (has not
been cleared). This is used by cursors.
| Constructor Detail |
DefaultGraph.AdjacencyList
private DefaultGraph.AdjacencyList(java.lang.Object node)
- Constructs a new
AdjacencyListfor the specified node.
| Method Detail |
addTo
private DefaultObjectEdge addTo(java.lang.Object object, DefaultGraph.AdjacencyList headAdj)
- Adds the specified edge to this
AdjacencyList. Returns the addedEdgeobject.
removeHelper
private boolean removeHelper(DefaultObjectEdge edge)
- If the specified edge is in this
AdjacencyList, removes it, signals theGraphabout the change, and returnstrue. Otherwise, returnsfalse.
remove
private boolean remove(DefaultObjectEdge edge)
- Removes the specified edge from this
AdjacencyList.
remove
private void remove(int index)
- Removes the edge at the specified index from this
AdjacencyList.
contains
private boolean contains(DefaultObjectEdge edge)
- Returns whether or not this
AdjacencyListcontains the specified edge.
clear
private void clear()
- Clears this
AdjacencyListand renders it invalid for further use.
getTo
private DefaultObjectEdge getTo(java.lang.Object head)
- Returns the specified edge if this
AdjacencyListcontains it, ornullif it doesn't.
size
private int size()
- Returns the number of edges in this
AdjacencyList. If thisAdjacencyListcontains more thanInteger.MAX_VALUEedges, returnsInteger.MAX_VALUE.
degree
private int degree()
- Returns the number of edges in this
AdjacencyList, with self-loops counted twice. If thisAdjacencyListcontains more thanInteger.MAX_VALUEedges, returnsInteger.MAX_VALUE.
outDegree
private int outDegree()
- Returns the number of out edges in this
AdjacencyList. If thisAdjacencyListcontains more thanInteger.MAX_VALUEout edges, returnsInteger.MAX_VALUE.
inDegree
private int inDegree()
- Returns the number of in edges in this
AdjacencyList. If thisAdjacencyListcontains more thanInteger.MAX_VALUEin edges, returnsInteger.MAX_VALUE.
cursor
private DefaultGraph.AdjacencyList.Cursor cursor()
- Returns a
Cursorover all the edges in thisAdjacencyList.
cursorTo
private DefaultGraph.AdjacencyList.Cursor cursorTo(java.lang.Object head)
- Returns a
Cursorover all the edges in thisAdjacencyListto the specified node.
outCursor
private DefaultGraph.AdjacencyList.Cursor outCursor()
- Returns a
Cursorover all the out edges in thisAdjacencyList.
inCursor
private DefaultGraph.AdjacencyList.Cursor inCursor()
- Returns a
Cursorover all the in edges in thisAdjacencyList.
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> com >> phoenixst >> [ plexus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.phoenixst.plexus.DefaultGraph.AdjacencyList