|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
CEDigraph is an interface for representing directed graphs of nodes linked by zero or one edge. Each node and edge must be a unique Object in the digraph. Reusing edges and nodes may produce unpredictable results.
By default, this digraph uses equals() as the method to determine identity. Persistent versions may use hasSameIdentity() instead, for example.
One could create a subclass of CEDigraph that will work with zero or more edges by extending this interface. I have not done that.
Direct implementations of CEDigraph should have a single constructor that takes a CEDigraph as a parameter. Some implementations should provide a view of this CEDigraph, by implementing the net.walend.collection.View interface. Others should copy the parameter to produced an immutable CEDigraph.
Field Summary | |
static CEDigraph |
EMPTY
|
Method Summary | |
boolean |
containsCEDigraph(CEDigraph digraph)
Returns true if digraph is a subgraph of this CEDigraph. |
boolean |
containsEdge(java.lang.Object fromNode,
java.lang.Object toNode)
Returns true if the digraph contains any edge from fromNode to toNode |
boolean |
containsEdge(java.lang.Object fromNode,
java.lang.Object toNode,
java.lang.Object edge)
Returns true if edge links fromNode to toNode |
boolean |
containsNode(java.lang.Object node)
|
boolean |
containsNodes(Set nodes)
|
int |
countInboundEdges(java.lang.Object node)
|
int |
countOutboundEdges(java.lang.Object node)
|
int |
edgeCount()
|
EdgeIterator |
edgeIterator()
|
java.lang.Object |
getEdge(java.lang.Object fromNode,
java.lang.Object toNode)
Returns null if either node is not in the digraph or if no edge links fromNode to toNode |
Set |
getFromNodes(java.lang.Object node)
Returns the set of nodes that can reach this node by crossing one edge. |
Set |
getInboundEdges(java.lang.Object node)
Returns the empty set if node is not in the digraph, or if node has no inbound edges. |
Set |
getNodes()
|
Set |
getOutboundEdges(java.lang.Object node)
Returns the empty set if node is not in the digraph, or if node has no outbound edges. |
Set |
getToNodes(java.lang.Object node)
Returns the set of nodes that can be reached from this node by crossing one edge. |
CEDigraph |
intersectWithCEDigraph(CEDigraph digraph)
Returns a new digraph that is the intersection of this with digraph. |
boolean |
isEdgeFree()
Returns true if this CEDigraph has no edges. |
boolean |
isEmpty()
|
int |
nodeCount()
|
java.util.Iterator |
nodeIterator()
Implementations should explicitly state how they interpret nodeIterator()'s remove method. |
boolean |
sameCEDigraphAs(CEDigraph digraph)
Returns true if digraph is the same as this; that is, if this.containsCEDigraph(digraph) and digraph.containsCEDigraph(this). |
CEDigraph |
unionCEDigraph(CEDigraph digraph)
Returns a new digraph that is the union of this with digraph. |
Methods inherited from interface net.walend.collection.HasState |
getPrincipleInterface, sameStateAs |
Field Detail |
public static final CEDigraph EMPTY
Method Detail |
public int nodeCount()
public int edgeCount()
public boolean isEmpty()
public boolean containsNode(java.lang.Object node)
public boolean containsEdge(java.lang.Object fromNode, java.lang.Object toNode) throws NodeMissingException
NodeMissingException
- if either node is missing from the digraph.public boolean containsEdge(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge) throws NodeMissingException
NodeMissingException
- if either node is missing from the digraph.public int countInboundEdges(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public int countOutboundEdges(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public Set getInboundEdges(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public Set getOutboundEdges(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public java.lang.Object getEdge(java.lang.Object fromNode, java.lang.Object toNode) throws NodeMissingException
NodeMissingException
- if either node is missing from the digraph.public Set getFromNodes(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public Set getToNodes(java.lang.Object node) throws NodeMissingException
NodeMissingException
- if node is not in the digraph.public java.util.Iterator nodeIterator()
public EdgeIterator edgeIterator()
public Set getNodes()
public boolean isEdgeFree()
public boolean containsNodes(Set nodes)
public boolean containsCEDigraph(CEDigraph digraph)
public boolean sameCEDigraphAs(CEDigraph digraph)
public CEDigraph intersectWithCEDigraph(CEDigraph digraph)
public CEDigraph unionCEDigraph(CEDigraph digraph)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |