| 
Plexus v0.13.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.phoenixst.plexus.AbstractGraph
com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
public abstract class AbstractIntegerNodeGraph
An unmodifiable graph where the nodes are Integers
  from zero to a specified number (exclusive) and the edges do not
  contain user-defined objects.  This is mainly useful for
  implementing special-case graphs that do not actually need to
  explicitly store their structure.
  
This implementation is simple.  Any extension must also be
  simple to support on-the-fly Graph.Edge creation.  To
  fully implement an extension of this class, the programmer must
  provide implementations for the following methods:
  
In addition, it is recommended that the programmer override
  degree( node ) (when applicable) since its
  default implementation inefficiently depends upon other
  iterator-returning methods.
| Nested Class Summary | |
|---|---|
protected  class | 
AbstractIntegerNodeGraph.AbstractIntegerEdgeCollection
 | 
protected static class | 
AbstractIntegerNodeGraph.EdgeImpl
Protected Graph.Edge implementation. | 
| Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph | 
|---|
Graph.Edge | 
| Constructor Summary | |
|---|---|
protected  | 
AbstractIntegerNodeGraph(int n)
Creates a new AbstractIntegerNodeGraph. | 
| Method Summary | |
|---|---|
protected  int | 
checkNode(Object node)
Returns the specified node as a primitive int
  from 0 to the number of nodes in this graph
  (exclusive) if the specified node is in this graph. | 
 boolean | 
containsEdge(Graph.Edge edge)
Returns true if this Graph contains
  the specified Graph.Edge. | 
 boolean | 
containsNode(Object node)
Returns true if this Graph contains
  the specified node. | 
protected abstract  Graph.Edge | 
createEdge(int tailIndex,
           int headIndex)
If an edge exists between the specified indices, create and return it.  | 
protected abstract  Collection | 
createEdgeCollection()
Creates the (single) collection of edges for this instance.  | 
protected abstract  Traverser | 
createTraverser(int nodeIndex)
Creates a traverser with no filtering; assumes that the node index is valid.  | 
protected  Collection | 
edges()
Returns a Collection view of all the
  Graph.Edges in this Graph. | 
protected  int | 
getNodeIndex(Object node)
Returns the specified node as a primitive int
  from 0 to the number of nodes in this graph
  (exclusive) if the specified node is in this graph. | 
protected  int | 
getNodeSize()
Returns the number of nodes in this AbstractIntegerNodeGraph. | 
protected  Collection | 
nodes()
Returns a Collection view of all the nodes
  in this Graph. | 
 boolean | 
removeEdge(Graph.Edge edge)
Throws an UnsupportedOperationException. | 
 boolean | 
removeNode(Object node)
Throws an UnsupportedOperationException. | 
protected  Traverser | 
traverser(Object node)
Returns an unfiltered Traverser over those
  Graph.Edges incident to the specified node. | 
| Methods inherited from class com.phoenixst.plexus.AbstractGraph | 
|---|
addEdge, addNode, adjacentNodes, degree, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverser | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
protected AbstractIntegerNodeGraph(int n)
AbstractIntegerNodeGraph.
| Method Detail | 
|---|
protected final Collection nodes()
AbstractGraphCollection view of all the nodes
  in this Graph.  This method is only called
  by nodes( Predicate ).
nodes in class AbstractGraphprotected final Collection edges()
AbstractGraphCollection view of all the
  Graph.Edges in this Graph.
  This method is only called by edges( Predicate ).
edges in class AbstractGraphprotected final Traverser traverser(Object node)
AbstractGraphTraverser over those
  Graph.Edges incident to the specified node.
  This method is only called by traverser( node, Predicate ).
traverser in class AbstractGraphpublic final boolean removeNode(Object node)
UnsupportedOperationException.
removeNode in interface GraphremoveNode in class AbstractGraphnode - the node to be removed from this
  Graph.
true if this Graph contained
  node.public final boolean containsNode(Object node)
true if this Graph contains
  the specified node.
containsNode in interface GraphcontainsNode in class AbstractGraphnode - the node whose presence in this Graph
  is to be tested.
true if this Graph contains
  the specified node.public final boolean removeEdge(Graph.Edge edge)
UnsupportedOperationException.
removeEdge in interface GraphremoveEdge in class AbstractGraphedge - the Graph.Edge to be removed from
  this Graph.
true if this Graph contained
  the specified Graph.Edge.public boolean containsEdge(Graph.Edge edge)
true if this Graph contains
  the specified Graph.Edge.  This implementation
  tests the specified edge for equality with the one returned by
  createEdge( tailIndex, headIndex ) with
  the same tail and head.
containsEdge in interface GraphcontainsEdge in class AbstractGraphedge - the Graph.Edge whose presence in this
  Graph is to be tested.
true if this Graph contains
  the specified Graph.Edge.protected final int getNodeSize()
AbstractIntegerNodeGraph.
protected final int getNodeIndex(Object node)
int
  from 0 to the number of nodes in this graph
  (exclusive) if the specified node is in this graph.
  Otherwise, returns -1.
protected final int checkNode(Object node)
int
  from 0 to the number of nodes in this graph
  (exclusive) if the specified node is in this graph.
  Otherwise, throws an NoSuchNodeException.
protected abstract Graph.Edge createEdge(int tailIndex,
                                         int headIndex)
null.  The indices are
  assumed to represent valid nodes for this Graph.
protected abstract Collection createEdgeCollection()
protected abstract Traverser createTraverser(int nodeIndex)
  | 
Plexus v0.13.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||