Class TLcdPartitionedGraph<N,E>
java.lang.Object
com.luciad.network.graph.partition.TLcdLimitedEditablePartitionedGraph<N,E>
com.luciad.network.graph.partition.TLcdPartitionedGraph<N,E>
- All Implemented Interfaces:
ILcdEditableGraph<N,,E> ILcdGraph<N,,E> ILcdLimitedEditablePartitionedGraph<N,,E> ILcdPartitionedGraph<N,E>
public class TLcdPartitionedGraph<N,E>
extends TLcdLimitedEditablePartitionedGraph<N,E>
implements ILcdEditableGraph<N,E>
An implementation of
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.- Since:
- 5.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an edge to this graph, connecting the two given nodes.voidAdds a node to this graph.booleancanAddEdge(E aEdge, N aStartNode, N aEndNode) Returnstrueif the given edge can be added to this graph,falseotherwise.booleancanAddNode(N aNode) Returnstrueif the given node can be added to this graph,falseotherwise.booleancanAddPartition(ILcdGraph<N, E> aPartition) Returnstrueif the given partition can be added to this partitioned graph,falseotherwise.booleancanRemoveEdge(E aEdge) Returnstrueif the given edge can be removed from this graph,falseotherwise.booleancanRemoveNode(N aNode) Returnstrueif the given node can be removed from this graph,falseotherwise.voidclear(int aFireEventMode) Clears the graph; all edges and nodes are removed.voidedgeChanged(E aEdge, int aEventMode) This method should be called when the given edge has changed.voidedgesChanged(Vector<E> aEdges, int aEventMode) This method should be called when the given edges have changed.voidFires all the collected graph changes, i.e., all graph events that have been generated using the ILcdFireEventMode.FIRE_LATER mode, after the previous call tofireCollectedGraphChanges().voidnodeChanged(N aNode, int aEventMode) This method should be called when the given node has changed.voidnodesChanged(Vector<N> aNodes, int aEventMode) This method should be called when the given nodes have changed.removeEdge(E aEdge, int aFireEventMode) Removes an edge from this graph.voidremoveEdges(int aFireEventMode) Removes all edges from this graph - nodes will remain in the graph.removeNode(N aNode, int aFireEventMode) Removes a node from this graph.Methods inherited from class com.luciad.network.graph.partition.TLcdLimitedEditablePartitionedGraph
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, removePartitionedGraphListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.network.graph.ILcdGraph
addGraphListener, containsEdge, containsNode, getEdges, getEdges, getEndNode, getNodes, getOppositeNode, getStartNode, isConnected, removeGraphListener
-
Constructor Details
-
TLcdPartitionedGraph
public TLcdPartitionedGraph()Constructs a new, emptyTLcdPartitionedGraph.
-
-
Method Details
-
canAddPartition
Returnstrueif the given partition can be added to this partitioned graph,falseotherwise. More specifically, a partition can be added to this graph if the following conditions are met:- the partition is not
null - the partition is not yet part of this graph
- the partition contains no nodes or edges that are already part of this graph
- the partition is editable (implements the
ILcdEditableGraphinterface.
- Specified by:
canAddPartitionin interfaceILcdLimitedEditablePartitionedGraph<N,E> - Overrides:
canAddPartitionin classTLcdLimitedEditablePartitionedGraph<N,E> - Parameters:
aPartition- the partition to be verified.- Returns:
trueif the partition can be added to this graph,falseotherwise.
- the partition is not
-
canAddNode
Returnstrueif the given node can be added to this graph,falseotherwise. More specifically, a node can be added to this graph if the following conditions are met:- the node is not
null - the node is not yet part of this graph
- there are already partitions contained in this graph.
- the node satisfies all additional implementation-specific requirements (see the documentation of the implementing class).
- Specified by:
canAddNodein interfaceILcdEditableGraph<N,E> - Parameters:
aNode- the node to be verified.- Returns:
trueif the node can be added to this graph,falseotherwise.
- the node is not
-
addNode
Adds a node to this graph. The node will be added to the first partition that is returned by thegetPartitions()method. This method can be overwritten by subclasses that implement a specific policy in combination with theaddNode(ILcdGraph aPartition, Object aNode)method, e.g. add the nodes to partitions according to their geographical position.- Specified by:
addNodein interfaceILcdEditableGraph<N,E> - Parameters:
aNode- the node to be added to this graph.- Preconditions:
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 ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
canAddNode(aNode)- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
canRemoveNode
Description copied from interface:ILcdEditableGraphReturnstrueif the given node can be removed from this graph,falseotherwise. More specifically, a node can be remove from this graph if the following conditions are met:- the node is not
null - the node is part of this graph
- there are no edges in this graph, connected to the node
- Specified by:
canRemoveNodein interfaceILcdEditableGraph<N,E> - Parameters:
aNode- the node to be verified.- Returns:
trueif the node can be removed from this graph,falseotherwise.
- the node is not
-
removeNode
Description copied from interface:ILcdEditableGraphRemoves a node from this graph.- Specified by:
removeNodein interfaceILcdEditableGraph<N,E> - Parameters:
aNode- the node to be removed from this graph.aFireEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
canRemoveNode(aNode)- Note: this validation is potentially expensive, and should be avoided whenever possible.- Returns:
- the node that was removed from the graph.
-
canAddEdge
Description copied from interface:ILcdEditableGraphReturnstrueif the given edge can be added to this graph,falseotherwise. More specifically, an edge can be added to this graph if the following conditions are met:- none of the arguments is
null - the edge is not yet part of this graph
- both nodes are part of this graph
- the edge satisfies all additional implementation-specific requirements (see the documentation of the implementing class).
- Specified by:
canAddEdgein interfaceILcdEditableGraph<N,E> - Parameters:
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.- Returns:
trueif the edge can be added to this graph,falseotherwise.
- none of the arguments is
-
addEdge
Description copied from interface:ILcdEditableGraphAdds an edge to this graph, connecting the two given nodes.- Specified by:
addEdgein interfaceILcdEditableGraph<N,E> - Parameters:
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 ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
canAddEdge(aEdge, aStartNode, aEndNode)- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
canRemoveEdge
Description copied from interface:ILcdEditableGraphReturnstrueif the given edge can be removed from this graph,falseotherwise. More specifically, a edge can be remove from this graph if the following conditions are met:- the edge is not
null - the edge is part of this graph
- Specified by:
canRemoveEdgein interfaceILcdEditableGraph<N,E> - Parameters:
aEdge- the edge to be verified.- Returns:
trueif the edge can be removed from this graph,falseotherwise.
- the edge is not
-
removeEdge
Description copied from interface:ILcdEditableGraphRemoves an edge from this graph.- Specified by:
removeEdgein interfaceILcdEditableGraph<N,E> - Parameters:
aEdge- the edge to be removed from this graph.aFireEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
canRemoveEdge(aEdge)- Note: this validation is potentially expensive, and should be avoided whenever possible.- Returns:
- the edge which was removed from the graph.
-
removeEdges
public void removeEdges(int aFireEventMode) Description copied from interface:ILcdEditableGraphRemoves all edges from this graph - nodes will remain in the graph.- Specified by:
removeEdgesin interfaceILcdEditableGraph<N,E> - Parameters:
aFireEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.
-
clear
public void clear(int aFireEventMode) Description copied from interface:ILcdEditableGraphClears the graph; all edges and nodes are removed.- Specified by:
clearin interfaceILcdEditableGraph<N,E> - Parameters:
aFireEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.
-
nodeChanged
Description copied from interface:ILcdEditableGraphThis method should be called when the given node has changed.- Preconditions:
containsPartition(aNode)- Note: this validation is potentially expensive, and should be avoided whenever possible.- Specified by:
nodeChangedin interfaceILcdEditableGraph<N,E> - Parameters:
aNode- the node that has changed.aEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.
-
nodesChanged
Description copied from interface:ILcdEditableGraphThis method should be called when the given nodes have changed.- Specified by:
nodesChangedin interfaceILcdEditableGraph<N,E> - Parameters:
aNodes- a vector containing the nodes that have changed.aEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
- for each
nodeobject in the given vector should hold that:containsPartition(node)- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
edgeChanged
Description copied from interface:ILcdEditableGraphThis method should be called when the given edge has changed.- Specified by:
edgeChangedin interfaceILcdEditableGraph<N,E> - Parameters:
aEdge- the edge that has changed.aEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
containsBoundaryEdge(aEdge)- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
edgesChanged
Description copied from interface:ILcdEditableGraphThis method should be called when the given edges have changed.- Specified by:
edgesChangedin interfaceILcdEditableGraph<N,E> - Parameters:
aEdges- a vector containing the edges that have changed.aEventMode- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.- Preconditions:
- for each
edgeobject in the given vector should hold that:containsBoundaryEdge(edge)- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
fireCollectedGraphChanges
public void fireCollectedGraphChanges()Description copied from interface:ILcdLimitedEditablePartitionedGraphFires all the collected graph changes, i.e., all graph events that have been generated using the ILcdFireEventMode.FIRE_LATER mode, after the previous call tofireCollectedGraphChanges(). Note that afireCollectedGraphChanges()call is made whenever a graph event is generated in theILcdFireEventMode.FIRE_NOW, to guarantee the correct order of the events.- Specified by:
fireCollectedGraphChangesin interfaceILcdEditableGraph<N,E> - Specified by:
fireCollectedGraphChangesin interfaceILcdLimitedEditablePartitionedGraph<N,E> - Overrides:
fireCollectedGraphChangesin classTLcdLimitedEditablePartitionedGraph<N,E>
-