|
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.FilteredGraph
public class FilteredGraph
A filtered Graph
implementation. Unlike other
Graph
wrappers and implementations, and in violation
of the contract for Graph.Edge.equals()
,
the Edges
produced by this Graph
are not
wrapped.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph |
---|
Graph.Edge |
Constructor Summary | |
---|---|
protected |
FilteredGraph()
This constructor, together with initialize(Graph,
Predicate, Predicate) , allows a subclass to initialize the
internal state during deserialization. |
|
FilteredGraph(Graph delegate,
org.apache.commons.collections.Predicate nodePredicate,
org.apache.commons.collections.Predicate edgePredicate)
Creates a new FilteredGraph . |
Method Summary | |
---|---|
Graph.Edge |
addEdge(Object object,
Object tail,
Object head,
boolean isDirected)
This implementation throws an UnsupportedOperationException . |
void |
addGraphListener(GraphListener listener)
Adds the specified GraphListener which will be
notified whenever this ObservableGraph's
structure changes. |
boolean |
addNode(Object node)
This implementation throws an UnsupportedOperationException . |
boolean |
containsEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph incident on the tail of the specified edge ,
looking for it and returning true if found. |
boolean |
containsNode(Object node)
This implementation iterates over the nodes in this graph looking for the specified element. |
protected Collection |
edges()
Returns a Collection view of all the
Graph.Edges in this Graph . |
protected Graph |
getDelegate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method. |
protected org.apache.commons.collections.Predicate |
getEdgePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method. |
protected org.apache.commons.collections.Predicate |
getNodePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method. |
protected void |
initialize(Graph delegateGraph,
org.apache.commons.collections.Predicate nodePred,
org.apache.commons.collections.Predicate edgePred)
This method should only be called by subclasses during deserialization. |
protected Collection |
nodes()
Returns a Collection view of all the nodes
in this Graph . |
boolean |
removeEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph incident on the tail of the specified edge . |
void |
removeGraphListener(GraphListener listener)
Removes a previously added GraphListener . |
boolean |
removeNode(Object node)
This implementation iterates over the nodes in this graph looking for the specified element. |
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 |
---|
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 |
Methods inherited from interface com.phoenixst.plexus.Graph |
---|
adjacentNodes, degree, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverser |
Constructor Detail |
---|
public FilteredGraph(Graph delegate, org.apache.commons.collections.Predicate nodePredicate, org.apache.commons.collections.Predicate edgePredicate)
FilteredGraph
.
protected FilteredGraph()
initialize(Graph,
Predicate, Predicate)
, allows a subclass to initialize the
internal state during deserialization.
Method Detail |
---|
protected final void initialize(Graph delegateGraph, org.apache.commons.collections.Predicate nodePred, org.apache.commons.collections.Predicate edgePred)
protected final Graph getDelegate()
writeObject()
method.
protected final org.apache.commons.collections.Predicate getEdgePredicate()
writeObject()
method.
protected final org.apache.commons.collections.Predicate getNodePredicate()
writeObject()
method.
protected Collection nodes()
AbstractGraph
Collection
view of all the nodes
in this Graph
. This method is only called
by nodes( Predicate )
.
nodes
in class AbstractGraph
protected Collection edges()
AbstractGraph
Collection
view of all the
Graph.Edges
in this Graph
.
This method is only called by edges( Predicate )
.
edges
in class AbstractGraph
protected Traverser traverser(Object node)
AbstractGraph
Traverser
over those
Graph.Edges
incident to the specified node.
This method is only called by traverser( node, Predicate )
.
traverser
in class AbstractGraph
public boolean addNode(Object node)
AbstractGraph
UnsupportedOperationException
.
addNode
in interface Graph
addNode
in class AbstractGraph
node
- the node to be added to this Graph
.
true
if this Graph
changed
as a result of the call, false
if this
Graph
already contains the specified node.public boolean removeNode(Object node)
AbstractGraph
Iterator.remove()
operation.
Note that this implementation will throw an
UnsupportedOperationException
if the iterator
returned by this graph's nodes( null ).iterator()
method does not implement the remove
method and
this graph contains the specified node.
removeNode
in interface Graph
removeNode
in class AbstractGraph
node
- the node to be removed from this
Graph
.
true
if this Graph
contained
node
.public boolean containsNode(Object node)
AbstractGraph
containsNode
in interface Graph
containsNode
in class AbstractGraph
node
- the node whose presence in this Graph
is to be tested.
true
if this Graph
contains
the specified node.public Graph.Edge addEdge(Object object, Object tail, Object head, boolean isDirected)
AbstractGraph
UnsupportedOperationException
.
addEdge
in interface Graph
addEdge
in class AbstractGraph
object
- the user-defined object to be contained in the
new edge.tail
- the first endpoint of the new edge.head
- the second endpoint of the new edge.isDirected
- whether the new edge is directed.
Graph.Edge
if this
Graph
changed as a result of the call,
null
if this Graph
does not allow
duplicate edges and already contains the specified edge.public boolean removeEdge(Graph.Edge edge)
AbstractGraph
edge
. If
it finds the element, it removes the element using using the
Iterator.remove()
operation.
Note that this implementation will throw an
UnsupportedOperationException
if the traverser
returned by this graph's traverser( node, predicate )
method does not implement the
removeEdge
method and this graph contains the
specified edge.
removeEdge
in interface Graph
removeEdge
in class AbstractGraph
edge
- the Graph.Edge
to be removed from
this Graph
.
true
if this Graph
contained
the specified Graph.Edge
.public boolean containsEdge(Graph.Edge edge)
AbstractGraph
edge
,
looking for it and returning true
if found.
containsEdge
in interface Graph
containsEdge
in class AbstractGraph
edge
- the Graph.Edge
whose presence in this
Graph
is to be tested.
true
if this Graph
contains
the specified Graph.Edge
.public void addGraphListener(GraphListener listener)
GraphListener
which will be
notified whenever this ObservableGraph's
structure changes. If the wrapped graph does not implement
ObservableGraph
, then this method with throw an
UnsupportedOperationException
.
addGraphListener
in interface ObservableGraph
public void removeGraphListener(GraphListener listener)
GraphListener
. If the
wrapped graph does not implement ObservableGraph
, then
this method with throw an
UnsupportedOperationException
.
removeGraphListener
in interface ObservableGraph
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |