public interface ILcdGraph<N,E>
ILcdGraph
represents a general graph, which can contain nodes, connected by edges.
The following invariants should always hold for every ILcdGraph
object:
Modifier and Type | Method and Description |
---|---|
void |
addGraphListener(ILcdGraphListener<N,E> aGraphListener)
Registers the given
ILcdGraphListener with this graph. |
boolean |
containsEdge(E aEdge)
Returns true if
aEdge is contained in this graph, false otherwise. |
boolean |
containsNode(N aNode)
Returns true if
aNode is part of this graph, false otherwise. |
Enumeration<E> |
getEdges()
Returns an Enumeration containing all edges in this graph.
|
Enumeration<E> |
getEdges(N aNode)
Returns an Enumeration containing all edges connected to the given node.
|
N |
getEndNode(E aEdge)
Returns the end node of the given edge in this graph.
|
Enumeration<N> |
getNodes()
Returns an Enumeration containing all nodes in this graph.
|
N |
getOppositeNode(E aEdge,
N aNode)
If
aNode is one of the two nodes connected by the given edge in this graph, returns the other node,
otherwise throws IllegalArgumentException . |
N |
getStartNode(E aEdge)
Returns the start node of the given edge in this graph.
|
boolean |
isConnected(E aEdge,
N aNode)
Returns true if
aNode is one the nodes to which this edge is connected. |
void |
removeGraphListener(ILcdGraphListener<N,E> aGraphListener)
Unregisters the given
ILcdGraphListener from this graph. |
boolean containsNode(N aNode)
aNode
is part of this graph, false otherwise.aNode
- the node to be checked.true
if aNode
is part of the graph, false
otherwise.NullPointerException
- if the node is null
.Enumeration<N> getNodes()
boolean containsEdge(E aEdge)
aEdge
is contained in this graph, false otherwise.aEdge
- the edge to be checkedtrue
if aEdge
is part of the graph, false
otherwise.NullPointerException
- if the edge is null
.Enumeration<E> getEdges()
Enumeration<E> getEdges(N aNode)
aNode
- the node whose connected edges should be returned.IllegalArgumentException
- aNode
is not part of this graph.NullPointerException
- if the node is null
.N getStartNode(E aEdge)
aEdge
- the edge whose start node should be returned.IllegalArgumentException
- aEdge
is not part of this graph.NullPointerException
- if the edge is null
.N getEndNode(E aEdge)
aEdge
- the edge whose end node should be returned.IllegalArgumentException
- aEdge
is not part of this graph.NullPointerException
- if the edge is null
.N getOppositeNode(E aEdge, N aNode)
aNode
is one of the two nodes connected by the given edge in this graph, returns the other node,
otherwise throws IllegalArgumentException
.aNode
- one of the two Object
's connected by the given edge.aEdge
- the edge whose opposite node should be returned.aNode
is one of the two nodes connected by this edge, returns the other
node connected by this edge.IllegalArgumentException
- aNode
is not connected by this edge
or aEdge
is not part of this graph.NullPointerException
- if one of the arguments is null
.boolean isConnected(E aEdge, N aNode)
aNode
is one the nodes to which this edge is connected.aEdge
- the edge whose connectivity should be checked.aNode
- the node whose connectivity should be checked.aNode
is one the nodes to which this edge is connected.IllegalArgumentException
- aEdge
is not part of this graph.NullPointerException
- if one of the arguments is null
.void addGraphListener(ILcdGraphListener<N,E> aGraphListener)
ILcdGraphListener
with this graph. All events
generated by this graph afterwards will be sent to the given listener, until
it is removed from this graph.aGraphListener
- the graph listener to be registered with this graph.NullPointerException
- if the given listener is null
.void removeGraphListener(ILcdGraphListener<N,E> aGraphListener)
ILcdGraphListener
from this graph. After it
has been unregistered, no events generated by this graph will be sent to the
given listener anymore.aGraphListener
- the graph listener to be unregistered from this graph.NullPointerException
- if the given listener is null
.IllegalArgumentException
- if the given listener is not currently
registered as a listener of this graph.