public class TLcdPartitionedGraph<N,E> extends TLcdLimitedEditablePartitionedGraph<N,E> implements ILcdEditableGraph<N,E>
ILcdLimitedEditablePartitionedGraph
that is
also an ILcdEditableGraph
. This means the graph can be used wherever
a TLcdGraph can be used. The addNode
method uses an implementation-specific
node assignment policy to decide in which of its partitions the new node will
be added. This method can be overwritten to implement an editable graph with
a another assignment policy.Constructor and Description |
---|
TLcdPartitionedGraph()
Constructs a new, empty
TLcdPartitionedGraph . |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(E aEdge,
N aStartNode,
N aEndNode,
int aFireEventMode)
Adds an edge to this graph, connecting the two given nodes.
|
void |
addNode(N aNode,
int aFireEventMode)
Adds a node to this graph.
|
boolean |
canAddEdge(E aEdge,
N aStartNode,
N aEndNode)
Returns
true if the given edge can be added to this graph,
false otherwise. |
boolean |
canAddNode(N aNode)
Returns
true if the given node can be added to this graph,
false otherwise. |
boolean |
canAddPartition(ILcdGraph<N,E> aPartition)
Returns
true if the given partition can be added to this partitioned
graph, false otherwise. |
boolean |
canRemoveEdge(E aEdge)
Returns
true if the given edge can be removed from this graph,
false otherwise. |
boolean |
canRemoveNode(N aNode)
Returns
true if the given node can be removed from this graph,
false otherwise. |
void |
clear(int aFireEventMode)
Clears the graph; all edges and nodes are removed.
|
void |
edgeChanged(E aEdge,
int aEventMode)
This method should be called when the given edge has changed.
|
void |
edgesChanged(Vector<E> aEdges,
int aEventMode)
This method should be called when the given edges have changed.
|
void |
fireCollectedGraphChanges()
Fires all the collected graph changes, i.e., all graph events that have been
generated using the ILcdFireEventMode.FIRE_LATER mode, after the
previous call to
fireCollectedGraphChanges() . |
void |
nodeChanged(N aNode,
int aEventMode)
This method should be called when the given node has changed.
|
void |
nodesChanged(Vector<N> aNodes,
int aEventMode)
This method should be called when the given nodes have changed.
|
E |
removeEdge(E aEdge,
int aFireEventMode)
Removes an edge from this graph.
|
void |
removeEdges(int aFireEventMode)
Removes all edges from this graph - nodes will remain in the graph.
|
N |
removeNode(N aNode,
int aFireEventMode)
Removes a node from this graph.
|
addBoundaryEdge, addGraphListener, addPartition, addPartitionedGraphListener, boundaryEdgeChanged, boundaryEdgesChanged, canAddBoundaryEdge, canRemoveBoundaryEdge, canRemoveBoundaryEdges, canRemovePartition, clear, clearBoundaryGraph, containsEdge, containsNode, containsPartition, fireCollectedPartitionedGraphChanges, getBoundaryEdges, getBoundaryGraph, getBoundaryNodes, getEdges, getEdges, getEndNode, getNodes, getOppositeNode, getPartitionForEdge, getPartitionForNode, getPartitions, getStartNode, isConnected, removeBoundaryEdge, removeBoundaryEdges, removeGraphListener, removePartition, removePartitionedGraphListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addGraphListener, containsEdge, containsNode, getEdges, getEdges, getEndNode, getNodes, getOppositeNode, getStartNode, isConnected, removeGraphListener
public TLcdPartitionedGraph()
TLcdPartitionedGraph
.public boolean canAddPartition(ILcdGraph<N,E> aPartition)
true
if the given partition can be added to this partitioned
graph, false
otherwise. More specifically, a partition can be added to this
graph if the following conditions are met:
null
ILcdEditableGraph
interface.canAddPartition
in interface ILcdLimitedEditablePartitionedGraph<N,E>
canAddPartition
in class TLcdLimitedEditablePartitionedGraph<N,E>
aPartition
- the partition to be verified.true
if the partition can be added to this graph,
false
otherwise.public boolean canAddNode(N aNode)
true
if the given node can be added to this graph,
false
otherwise. More specifically, a node can be added to this
graph if the following conditions are met:
null
canAddNode
in interface ILcdEditableGraph<N,E>
aNode
- the node to be verified.true
if the node can be added to this graph,
false
otherwise.public void addNode(N aNode, int aFireEventMode)
getPartitions()
method. This method can be
overwritten by subclasses that implement a specific policy in combination with
the addNode(ILcdGraph aPartition, Object aNode)
method, e.g. add
the nodes to partitions according to their geographical position.addNode
in interface ILcdEditableGraph<N,E>
aNode
- the node to be added to this graph.
canAddNode(aNode)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
canAddNode(aNode)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public boolean canRemoveNode(N aNode)
ILcdEditableGraph
true
if the given node can be removed from this graph,
false
otherwise. More specifically, a node can be remove from
this graph if the following conditions are met:
null
canRemoveNode
in interface ILcdEditableGraph<N,E>
aNode
- the node to be verified.true
if the node can be removed from this graph,
false
otherwise.public N removeNode(N aNode, int aFireEventMode)
ILcdEditableGraph
removeNode
in interface ILcdEditableGraph<N,E>
aNode
- the node to be removed from this graph.aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
canRemoveNode(aNode)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public boolean canAddEdge(E aEdge, N aStartNode, N aEndNode)
ILcdEditableGraph
true
if the given edge can be added to this graph,
false
otherwise. More specifically, an edge can be added to
this graph if the following conditions are met:
null
canAddEdge
in interface ILcdEditableGraph<N,E>
aEdge
- the edge to be verified.aStartNode
- the first node that should be connected by the given edge.aEndNode
- the second node that should be connected by the given edge.true
if the edge can be added to this graph,
false
otherwise.public void addEdge(E aEdge, N aStartNode, N aEndNode, int aFireEventMode)
ILcdEditableGraph
addEdge
in interface ILcdEditableGraph<N,E>
aEdge
- the edge to be added to this graph.aStartNode
- the first node that should be connected by the given edge.aEndNode
- the second node that should be connected by the given edge.aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
canAddEdge(aEdge, aStartNode, aEndNode)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public boolean canRemoveEdge(E aEdge)
ILcdEditableGraph
true
if the given edge can be removed from this graph,
false
otherwise. More specifically, a edge can be remove from
this graph if the following conditions are met:
null
canRemoveEdge
in interface ILcdEditableGraph<N,E>
aEdge
- the edge to be verified.true
if the edge can be removed from this graph,
false
otherwise.public E removeEdge(E aEdge, int aFireEventMode)
ILcdEditableGraph
removeEdge
in interface ILcdEditableGraph<N,E>
aEdge
- the edge to be removed from this graph.aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
canRemoveEdge(aEdge)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public void removeEdges(int aFireEventMode)
ILcdEditableGraph
removeEdges
in interface ILcdEditableGraph<N,E>
aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.public void clear(int aFireEventMode)
ILcdEditableGraph
clear
in interface ILcdEditableGraph<N,E>
aFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.public void nodeChanged(N aNode, int aEventMode)
ILcdEditableGraph
containsPartition(aNode)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.nodeChanged
in interface ILcdEditableGraph<N,E>
aNode
- the node that has changed.aEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.public void nodesChanged(Vector<N> aNodes, int aEventMode)
ILcdEditableGraph
nodesChanged
in interface ILcdEditableGraph<N,E>
aNodes
- a vector containing the nodes that have changed.aEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
node
object in the given vector should hold that:
containsPartition(node)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public void edgeChanged(E aEdge, int aEventMode)
ILcdEditableGraph
edgeChanged
in interface ILcdEditableGraph<N,E>
aEdge
- the edge that has changed.aEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
containsBoundaryEdge(aEdge)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public void edgesChanged(Vector<E> aEdges, int aEventMode)
ILcdEditableGraph
edgesChanged
in interface ILcdEditableGraph<N,E>
aEdges
- a vector containing the edges that have changed.aEventMode
- the mode for sending out the TLcdGraphChangedEvent. This
can be one of ILcdFireEventMode.FIRE_NOW,
ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
edge
object in the given vector should hold that:
containsBoundaryEdge(edge)
-
Note: this validation is potentially expensive, and should be avoided
whenever possible.public void fireCollectedGraphChanges()
ILcdLimitedEditablePartitionedGraph
fireCollectedGraphChanges()
.
Note that a fireCollectedGraphChanges()
call is made whenever
a graph event is generated in the ILcdFireEventMode.FIRE_NOW
,
to guarantee the correct order of the events.fireCollectedGraphChanges
in interface ILcdEditableGraph<N,E>
fireCollectedGraphChanges
in interface ILcdLimitedEditablePartitionedGraph<N,E>
fireCollectedGraphChanges
in class TLcdLimitedEditablePartitionedGraph<N,E>