Package com.luciad.network.graph
Interface ILcdGraph<N,E>
- All Known Subinterfaces:
ILcdEditableGraph<N,
,E> ILcdLimitedEditablePartitionedGraph<N,
,E> ILcdPartitionedGraph<N,
E>
- All Known Implementing Classes:
TLcdGraph
,TLcdLimitedEditablePartitionedGraph
,TLcdNumericGraph
,TLcdPartitionedGraph
public interface ILcdGraph<N,E>
An
ILcdGraph
represents a general graph, which can contain nodes, connected by edges.
The following invariants should always hold for every ILcdGraph
object:
- an edge will be contained in a graph no more than once.
- a node will be contained in a graph no more than once.
- the start node and end node of an edge that is contained in a graph, should both be part of that graph.
- Since:
- 5.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGraphListener
(ILcdGraphListener<N, E> aGraphListener) Registers the givenILcdGraphListener
with this graph.boolean
containsEdge
(E aEdge) Returns true ifaEdge
is contained in this graph, false otherwise.boolean
containsNode
(N aNode) Returns true ifaNode
is part of this graph, false otherwise.getEdges()
Returns an Enumeration containing all edges in this graph.Returns an Enumeration containing all edges connected to the given node.getEndNode
(E aEdge) Returns the end node of the given edge in this graph.getNodes()
Returns an Enumeration containing all nodes in this graph.getOppositeNode
(E aEdge, N aNode) IfaNode
is one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throwsIllegalArgumentException
.getStartNode
(E aEdge) Returns the start node of the given edge in this graph.boolean
isConnected
(E aEdge, N aNode) Returns true ifaNode
is one the nodes to which this edge is connected.void
removeGraphListener
(ILcdGraphListener<N, E> aGraphListener) Unregisters the givenILcdGraphListener
from this graph.
-
Method Details
-
containsNode
Returns true ifaNode
is part of this graph, false otherwise.- Parameters:
aNode
- the node to be checked.- Returns:
true
ifaNode
is part of the graph,false
otherwise.- Throws:
NullPointerException
- if the node isnull
.
-
getNodes
Enumeration<N> getNodes()Returns an Enumeration containing all nodes in this graph.- Returns:
- an Enumeration containing all nodes in this graph.
-
containsEdge
Returns true ifaEdge
is contained in this graph, false otherwise.- Parameters:
aEdge
- the edge to be checked- Returns:
true
ifaEdge
is part of the graph,false
otherwise.- Throws:
NullPointerException
- if the edge isnull
.
-
getEdges
Enumeration<E> getEdges()Returns an Enumeration containing all edges in this graph.- Returns:
- an Enumeration containing all edges in this graph.
-
getEdges
Returns an Enumeration containing all edges connected to the given node.- Parameters:
aNode
- the node whose connected edges should be returned.- Returns:
- an Enumeration containing all edges connected to the given node.
- Throws:
IllegalArgumentException
-aNode
is not part of this graph.NullPointerException
- if the node isnull
.
-
getStartNode
Returns the start node of the given edge in this graph.- Parameters:
aEdge
- the edge whose start node should be returned.- Returns:
- the start node.
- Throws:
IllegalArgumentException
-aEdge
is not part of this graph.NullPointerException
- if the edge isnull
.
-
getEndNode
Returns the end node of the given edge in this graph.- Parameters:
aEdge
- the edge whose end node should be returned.- Returns:
- the end node.
- Throws:
IllegalArgumentException
-aEdge
is not part of this graph.NullPointerException
- if the edge isnull
.
-
getOppositeNode
IfaNode
is one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throwsIllegalArgumentException
.- Parameters:
aEdge
- the edge whose opposite node should be returned.aNode
- one of the twoObject
's connected by the given edge.- Returns:
- if
aNode
is one of the two nodes connected by this edge, returns the other node connected by this edge. - Throws:
IllegalArgumentException
-aNode
is not connected by this edge oraEdge
is not part of this graph.NullPointerException
- if one of the arguments isnull
.
-
isConnected
Returns true ifaNode
is one the nodes to which this edge is connected.- Parameters:
aEdge
- the edge whose connectivity should be checked.aNode
- the node whose connectivity should be checked.- Returns:
- true if
aNode
is one the nodes to which this edge is connected. - Throws:
IllegalArgumentException
-aEdge
is not part of this graph.NullPointerException
- if one of the arguments isnull
.
-
addGraphListener
Registers the givenILcdGraphListener
with this graph. All events generated by this graph afterwards will be sent to the given listener, until it is removed from this graph.- Parameters:
aGraphListener
- the graph listener to be registered with this graph.- Throws:
NullPointerException
- if the given listener isnull
.
-
removeGraphListener
Unregisters the givenILcdGraphListener
from this graph. After it has been unregistered, no events generated by this graph will be sent to the given listener anymore.- Parameters:
aGraphListener
- the graph listener to be unregistered from this graph.- Throws:
NullPointerException
- if the given listener isnull
.IllegalArgumentException
- if the given listener is not currently registered as a listener of this graph.
-