Interface ILcdLimitedEditablePartitionedGraph<N,E>
- All Superinterfaces:
ILcdGraph<N,
,E> ILcdPartitionedGraph<N,
E>
- All Known Implementing Classes:
TLcdLimitedEditablePartitionedGraph
,TLcdPartitionedGraph
An
ILcdLimitedEditablePartitionedGraph
is a partitioned graph
with editable internal boundaries, and to which partitions can be added (or
removed). The partitions themselves must not be editable.
All methods for editing the internal boundaries or partitions will modify
the partitioned graph structure as well as the 'normal' graph structure (e.g.
addPartition
will result in a partition being added, but also in
the addition of all the nodes and edges in that partition to this graph) and will
thus generate two events: a TLcdPartitionedGraphChangedEvent
and
a TLcdGraphChangedEvent
. Therefore, all editing method have two
fire event modes: one for the partitioned graph event, and one for the
normal graph event that is generated.- Since:
- 5.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBoundaryEdge
(E aEdge, N aStartNode, N aEndNode, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Adds the given edge to the boundary graph of this partitioned graph.void
addPartition
(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Adds a partition to this graph.void
boundaryEdgeChanged
(E aBoundaryEdge, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) This method should be called when the given boundary edge has changed.void
boundaryEdgesChanged
(Vector<E> aBoundaryEdges, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) This method should be called when the given boundary edges have changed.boolean
canAddBoundaryEdge
(E aEdge, N aStartNode, N aEndNode) Returnstrue
if the given boundary edge can be added to this partitioned graph,false
otherwise.boolean
canAddPartition
(ILcdGraph<N, E> aPartition) Returnstrue
if the given partition can be added to this partitioned graph,false
otherwise.boolean
canRemoveBoundaryEdge
(E aEdge) Returnstrue
if the given boundary edge can be removed from this graph,false
otherwise.boolean
canRemoveBoundaryEdges
(ILcdGraph<N, E> aPartition) Returnstrue
if the boundary edge connected to the given partition can be removed from this graph,false
otherwise.boolean
canRemovePartition
(ILcdGraph<N, E> aPartition) Returnstrue
if the given partition can be removed from this partitioned graph,false
otherwise.void
clear
(int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Clears the graph; all partitions are removed from this graph and the boundary graph is cleared.void
clearBoundaryGraph
(int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Clears the boundary graph of this partitioned graph, i.e. all its boundary edges and boundary nodes are removed from its boundary graph.void
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 tofireCollectedGraphChanges()
.void
Fires all the collected partitioned graph changes, i.e., all partitioned graph events that have been generated using the ILcdFireEventMode.FIRE_LATER mode, after the previous call tofireCollectedPartitionedGraphChanges()
.removeBoundaryEdge
(E aEdge, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Removes the given boundary edge from the boundary graph of this partitioned graph.removeBoundaryEdges
(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Removes all boundary edges that are connected to the given partition.void
removePartition
(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Removes the given partition from this graph.Methods inherited from interface com.luciad.network.graph.ILcdGraph
addGraphListener, containsEdge, containsNode, getEdges, getEdges, getEndNode, getNodes, getOppositeNode, getStartNode, isConnected, removeGraphListener
Methods inherited from interface com.luciad.network.graph.partition.ILcdPartitionedGraph
addPartitionedGraphListener, containsPartition, getBoundaryEdges, getBoundaryGraph, getBoundaryNodes, getPartitionForEdge, getPartitionForNode, getPartitions, removePartitionedGraphListener
-
Method Details
-
canAddBoundaryEdge
Returnstrue
if the given boundary edge can be added to this partitioned graph,false
otherwise. More specifically, a boundary edge can be added to this graph if the following conditions are met:- the boundary edge is not
null
- the boundary edge is not yet part of this graph
- the given nodes are both part of this graph
- the given nodes are part of different partitions
- the boundary edge satisfies all additional implementation-specific requirements (see the documentation of the implementing class).
- 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:
true
if the boundary edge can be added to this graph,false
otherwise.
- the boundary edge is not
-
addBoundaryEdge
void addBoundaryEdge(E aEdge, N aStartNode, N aEndNode, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Adds the given edge to the boundary graph of this partitioned graph.- Parameters:
aEdge
- the edge that should be added.aStartNode
- the start node of the edge.aEndNode
- the end node of the edge.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
canAddBoundaryEdge(aEdge, aStartNode, aEndNode)
- Note: this validation is potentially expensive, and should be avoided whenever possible.- Throws:
NullPointerException
- if one of the arguments isnull
.
-
canRemoveBoundaryEdge
Returnstrue
if the given boundary edge can be removed from this graph,false
otherwise. More specifically, a boundary edge can be remove from this graph if the following conditions are met:- the boundary edge is not
null
- the boundary edge is part of the boundary graph of this partitioned graph
- Parameters:
aEdge
- the boundary edge to be verified.- Returns:
true
if the boundary edge can be removed from this graph,false
otherwise.
- the boundary edge is not
-
removeBoundaryEdge
Removes the given boundary edge from the boundary graph of this partitioned graph.- Parameters:
aEdge
- the boundary edge that should be removed.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
canRemoveBoundaryEdge(aEdge)
- Note: this validation is potentially expensive, and should be avoided whenever possible.- Returns:
- the boundary edge that was removed.
- Throws:
NullPointerException
- if the given edge isnull
.
-
canRemoveBoundaryEdges
Returnstrue
if the boundary edge connected to the given partition can be removed from this graph,false
otherwise. More specifically, the boundary edges connected to the given partition can be removed from this graph if the following conditions are met:- the partition is not
null
- the partition is part of this partitioned graph
- Parameters:
aPartition
- the partition to be verified.- Returns:
true
if the boundary edges connected to the given partition can be removed from this graph,false
otherwise.
- the partition is not
-
removeBoundaryEdges
Enumeration<E> removeBoundaryEdges(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Removes all boundary edges that are connected to the given partition.- Parameters:
aPartition
- the partition whose boundary edges should be removed.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
canRemoveBoundaryEdges(aPartition)
- Note: this validation is potentially expensive, and should be avoided whenever possible.- Returns:
- an enumeration with all edges that have been removed.
- Throws:
NullPointerException
- if the given partition isnull
.
-
clearBoundaryGraph
void clearBoundaryGraph(int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Clears the boundary graph of this partitioned graph, i.e. all its boundary edges and boundary nodes are removed from its boundary graph.- Parameters:
aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
-
canAddPartition
Returnstrue
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:- 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 satisfies all additional implementation-specific requirements (see the documentation of the implementing class).
- Parameters:
aPartition
- the partition to be verified.- Returns:
true
if the partition can be added to this graph,false
otherwise.
- the partition is not
-
addPartition
void addPartition(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Adds a partition to this graph. From the moment a partition is added to the partitioned graph, the client becomes partly responsible himself for maintaining the invariants of the partitioned graph in which it is contained. More specifically, the user should always check himself whether adding a node or an edge to a partition, will not violate the invariants that each node and edge should be unique within a graph (the partitioned graph it is part of, in this case). The most easy way to edit partitions without violating the invariants, is to use the edit methods of the partitioned graph, instead of using the methods of the partition directly. These methods will guarantee that no invariant shall be violated.- Parameters:
aPartition
- the partition to be added to this graph.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
canAddPartition(aPartition)
- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
canRemovePartition
Returnstrue
if the given partition can be removed from this partitioned graph,false
otherwise. More specifically, a partition can be removed from this graph if the following conditions are met:- the partition is not
null
- the partition is part of this graph
- there are no boundary edges in this graph, connected to the given partition
- Parameters:
aPartition
- the partition to be verified.- Returns:
true
if the partition can be removed from this graph,false
otherwise.
- the partition is not
-
removePartition
void removePartition(ILcdGraph<N, E> aPartition, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Removes the given partition from this graph. A partition can only be removed if there are no connections any more between that partition and the other partitions. By removing a partition, modifications to the partition have no influence any more on this graph, and can no longer violate its invariants.- Parameters:
aPartition
- the partition to be removed from this graph.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
canRemovePartition(aPartition)
- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
clear
void clear(int aPartitionedGraphFireEventMode, int aGraphFireEventMode) Clears the graph; all partitions are removed from this graph and the boundary graph is cleared. Note that no recursive clearing is done, i.e. all partitions remain unmodified and can still be used on their own. By clearing the graph, modifications to any of these partitions have no influence any more on this graph, and can no longer violate the invariants of this graph.- Parameters:
aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent. This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.
-
fireCollectedPartitionedGraphChanges
void fireCollectedPartitionedGraphChanges()Fires all the collected partitioned graph changes, i.e., all partitioned graph events that have been generated using the ILcdFireEventMode.FIRE_LATER mode, after the previous call tofireCollectedPartitionedGraphChanges()
. Note that afireCollectedPartitionedGraphChanges()
call is made whenever a partitioned graph event is generated in theILcdFireEventMode.FIRE_NOW
, to guarantee the correct order of the events. -
fireCollectedGraphChanges
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 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. -
boundaryEdgeChanged
void boundaryEdgeChanged(E aBoundaryEdge, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) This method should be called when the given boundary edge has changed.- Parameters:
aBoundaryEdge
- the boundary edge that has changed.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
getBoundaryGraph().containsBoundaryEdge(aBoundaryEdge)
- Note: this validation is potentially expensive, and should be avoided whenever possible.
-
boundaryEdgesChanged
void boundaryEdgesChanged(Vector<E> aBoundaryEdges, int aPartitionedGraphFireEventMode, int aGraphFireEventMode) This method should be called when the given boundary edges have changed.- Parameters:
aBoundaryEdges
- a vector containing the boundary edges that have changed.aPartitionedGraphFireEventMode
- the mode for sending out the TLcdPartitionedGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.aGraphFireEventMode
- the mode for sending out the TLcdGraphChangedEvent This can be one ofILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT
.- Preconditions:
- for each
boundaryEdge
in the given vector should hold that:getBoundaryGraph().containsBoundaryEdge(boundaryEdge)
- Note: this validation is potentially expensive, and should be avoided whenever possible.
-