|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ed.inf.graph.impl.Graph
public final class Graph
Constructor Summary | |
---|---|
Graph()
|
|
Graph(Graph other)
|
Method Summary | |
---|---|
(package private) void |
addNewNode(Node newNode)
|
boolean |
canCopyHere(IBasicSubgraph<? extends Node,? extends Edge> subGraph)
Tests whether the subGraph can be copied to this graph. |
boolean |
canCreateEdges()
|
boolean |
canCreateNodes()
|
boolean |
canCreateSubgraphs()
|
boolean |
canRemoveSubgraphs()
|
boolean |
containsConnection(IBasicPair<? extends Node,? extends Edge> ends)
Tests if the graph has an edge between the defined ends. |
boolean |
containsConnection(Node thisNode,
Node thatNode)
Tests if the graph contains an edge connecting these nodes. |
boolean |
containsEdge(Edge edge)
Tests if the graph contains the edge. |
boolean |
containsEdge(int edgeIdx)
Tests if the graph contains the edge of the given index. |
boolean |
containsNode(int nodeIdx)
Tests if the graph contains the node with the given index number. |
boolean |
containsNode(Node node)
Tests if this node exists in the graph. |
void |
copyHere(IBasicSubgraph<? extends Node,? extends Edge> subGraph)
Copies a subgraph into this graph. |
EdgeFactory |
edgeFactory()
Gets the edgeFactory for this class. |
java.util.Iterator<Edge> |
edgeIterator()
Get an iterator that traverses all the edges in this graph. |
Subgraph |
getCopiedComponents()
Retrieves the nodes and edges created in this graph by the last copy operation. |
IGraphState<Node,Edge> |
getCurrentState()
Get the current state of the graph as a momento. |
Edge |
getEdge(int edgeIdx)
Get the edge with this index. |
Node |
getNode(int index)
Get the node matching the nodeIdx. |
int |
getNumEdges()
Get the number of edges in the graph. |
int |
getNumNodes()
Get the number of nodes in the graph. |
NodeFactory |
nodeFactory()
Gets the nodeFactory for this class. |
java.util.Iterator<Node> |
nodeIterator()
Get an iterator that traverses all the nodes in this graph. |
void |
removeSubgraph(IBasicSubgraph<? extends Node,? extends Edge> subgraph)
Removes the nodes and edges defined in the subgraph from this graph. |
void |
restoreState(IGraphState<Node,Edge> previousState)
Restores the graph state to the state stored by the previousState
object. |
SubgraphFactory |
subgraphFactory()
Gets the subgraphFactory for this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Graph()
public Graph(Graph other)
Method Detail |
---|
public Node getNode(int index)
IBasicGraph
getNode
in interface IBasicGraph<Node,Edge>
index
- the node index to lookup.
public boolean canCreateEdges()
public boolean canCreateNodes()
public boolean canCreateSubgraphs()
public boolean canRemoveSubgraphs()
public boolean containsNode(Node node)
IBasicGraph
containsNode
in interface IBasicGraph<Node,Edge>
node
- to be tested.
public boolean containsConnection(Node thisNode, Node thatNode)
IBasicGraph
containsConnection
in interface IBasicGraph<Node,Edge>
thisNode
- a node to test.thatNode
- the other node to test.
public EdgeFactory edgeFactory()
IModifiableGraph
edgeFactory
in interface IModifiableGraph<Node,Edge>
edgeFactory
in interface IUndirectedGraph<Node,Edge>
public NodeFactory nodeFactory()
IModifiableGraph
nodeFactory
in interface IModifiableGraph<Node,Edge>
public SubgraphFactory subgraphFactory()
IModifiableGraph
subgraphFactory
in interface IModifiableGraph<Node,Edge>
public java.util.Iterator<Edge> edgeIterator()
IBasicGraph
edgeIterator
in interface IBasicGraph<Node,Edge>
public java.util.Iterator<Node> nodeIterator()
IBasicGraph
nodeIterator
in interface IBasicGraph<Node,Edge>
public int getNumEdges()
IBasicGraph
getNumEdges
in interface IBasicGraph<Node,Edge>
public int getNumNodes()
IBasicGraph
getNumNodes
in interface IBasicGraph<Node,Edge>
public void removeSubgraph(IBasicSubgraph<? extends Node,? extends Edge> subgraph)
IModifiableGraph
removeSubgraph
in interface IModifiableGraph<Node,Edge>
subgraph
- The subgraph to remove, cannot be null.public boolean containsEdge(Edge edge)
IBasicGraph
containsEdge
in interface IBasicGraph<Node,Edge>
edge
- the edge to test.
public boolean containsEdge(int edgeIdx)
IBasicGraph
containsEdge
in interface IBasicGraph<Node,Edge>
edgeIdx
- the index to test.
public boolean containsNode(int nodeIdx)
IBasicGraph
containsNode
in interface IBasicGraph<Node,Edge>
nodeIdx
- The index number of the node.
public Edge getEdge(int edgeIdx)
IBasicGraph
getEdge
in interface IBasicGraph<Node,Edge>
edgeIdx
- The index of the edge.
void addNewNode(Node newNode)
public boolean containsConnection(IBasicPair<? extends Node,? extends Edge> ends)
IBasicGraph
containsConnection
in interface IBasicGraph<Node,Edge>
ends
- the ends of the edge to test.
public IGraphState<Node,Edge> getCurrentState()
IRestorableGraph
getCurrentState
in interface IRestorableGraph<Node,Edge>
public void restoreState(IGraphState<Node,Edge> previousState)
IRestorableGraph
previousState
object.
restoreState
in interface IRestorableGraph<Node,Edge>
previousState
- The previous state to be restored.public boolean canCopyHere(IBasicSubgraph<? extends Node,? extends Edge> subGraph)
IModifiableGraph
canCopyHere
in interface IModifiableGraph<Node,Edge>
subGraph
- the subgraph to test, can be null.
public void copyHere(IBasicSubgraph<? extends Node,? extends Edge> subGraph)
IModifiableGraph
copyHere
in interface IModifiableGraph<Node,Edge>
subGraph
- the subgraph to copypublic Subgraph getCopiedComponents()
IModifiableGraph
getCopiedComponents
in interface IModifiableGraph<Node,Edge>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |