|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectannas.graph.Graph<N,A>
N
- Node typeA
- Arc typepublic abstract class Graph<N,A extends ArcInterface<N>>
Base graph class
Constructor Summary | |
---|---|
Graph()
Default Constructor |
|
Graph(GraphObserver observer)
Constructor used to set the observer from creation |
Method Summary | |
---|---|
boolean |
addArc(N tail,
N head,
WeightedInterface wi)
Adds an arc to the graph |
boolean |
addNode(N node)
Adds a node to the graph |
boolean |
contains(N node)
Checks if the graph contains a node |
java.util.ArrayList<A> |
getArc(N tail)
Gets all arcs which originate from the given node |
java.util.ArrayList<A> |
getArc(N tail,
N head)
Gets all arcs from the tail to the head |
ArcFactory<N,A> |
getArcFactory()
Gets the @see ArcFactory used by the graph |
java.util.ArrayList<N> |
getNodeMap()
Gets a list of nodes in the graph |
int |
getNuArcs()
Number of arcs contained within the graph |
int |
getNuNodes()
Number of nodes contained within the graph |
GraphObserver |
getObserver()
Current GraphObserver |
int |
getVersion()
Gets the version of the graph. |
boolean |
removeArc(N tail)
Removes all arcs with originating from a node |
boolean |
removeArc(N tail,
A arc)
Removes an arc from the graph |
boolean |
removeArc(N tail,
N head)
Removes all arc from the graph |
boolean |
removeNode(N node)
Removes a node from the graph |
void |
resetArcs()
Removes all arcs from the graph |
void |
setObserver(GraphObserver observer)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Graph()
public Graph(GraphObserver observer)
observer
- Method Detail |
---|
public GraphObserver getObserver()
GraphInterface
getObserver
in interface GraphInterface<N,A extends ArcInterface<N>>
public void setObserver(GraphObserver observer)
public boolean addArc(N tail, N head, WeightedInterface wi)
GraphInterface
addArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- Tail of the archead
- Head of the arcwi
- WeightedInterface
public boolean addNode(N node)
GraphInterface
addNode
in interface GraphInterface<N,A extends ArcInterface<N>>
node
- to add to the graph
public boolean contains(N node)
GraphInterface
contains
in interface GraphInterface<N,A extends ArcInterface<N>>
node
- to check if it is contained within the graph
public java.util.ArrayList<A> getArc(N tail)
GraphInterface
getArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- tail of the arcs
public java.util.ArrayList<A> getArc(N tail, N head)
GraphInterface
getArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- tail of the archead
- head of the arc
public ArcFactory<N,A> getArcFactory()
GraphInterface
getArcFactory
in interface GraphInterface<N,A extends ArcInterface<N>>
public java.util.ArrayList<N> getNodeMap()
GraphInterface
getNodeMap
in interface GraphInterface<N,A extends ArcInterface<N>>
public boolean removeArc(N tail, A arc)
GraphInterface
removeArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- tail of the arc to removearc
- arc to remove
public boolean removeArc(N tail, N head)
GraphInterface
removeArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- tail of the arc to removehead
- head of the arc to remove
public boolean removeArc(N tail)
GraphInterface
removeArc
in interface GraphInterface<N,A extends ArcInterface<N>>
tail
- tail of the arc
public void resetArcs()
GraphInterface
resetArcs
in interface GraphInterface<N,A extends ArcInterface<N>>
public boolean removeNode(N node)
GraphInterface
removeNode
in interface GraphInterface<N,A extends ArcInterface<N>>
node
- to remove from the graph
public int getVersion()
GraphInterface
getVersion
in interface GraphInterface<N,A extends ArcInterface<N>>
public int getNuArcs()
GraphInterface
getNuArcs
in interface GraphInterface<N,A extends ArcInterface<N>>
public int getNuNodes()
GraphInterface
getNuNodes
in interface GraphInterface<N,A extends ArcInterface<N>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |