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 Details

    • TLcdPartitionedGraph

      public TLcdPartitionedGraph()
      Constructs a new, empty TLcdPartitionedGraph.
  • Method Details

    • canAddPartition

      public boolean canAddPartition(ILcdGraph<N,E> aPartition)
      Returns 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:
      • 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 ILcdEditableGraph interface.
      Specified by:
      canAddPartition in interface ILcdLimitedEditablePartitionedGraph<N,E>
      Overrides:
      canAddPartition in class TLcdLimitedEditablePartitionedGraph<N,E>
      Parameters:
      aPartition - the partition to be verified.
      Returns:
      true if the partition can be added to this graph, false otherwise.
    • canAddNode

      public boolean canAddNode(N aNode)
      Returns 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:
      • 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:
      canAddNode in interface ILcdEditableGraph<N,E>
      Parameters:
      aNode - the node to be verified.
      Returns:
      true if the node can be added to this graph, false otherwise.
    • addNode

      public void addNode(N aNode, int aFireEventMode)
      Adds a node to this graph. The node will be added to the first partition that is returned by the 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.
      Specified by:
      addNode in interface ILcdEditableGraph<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 of ILcdFireEventMode.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

      public boolean canRemoveNode(N aNode)
      Description copied from interface: ILcdEditableGraph
      Returns 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:
      • 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:
      canRemoveNode in interface ILcdEditableGraph<N,E>
      Parameters:
      aNode - the node to be verified.
      Returns:
      true if the node can be removed from this graph, false otherwise.
    • removeNode

      public N removeNode(N aNode, int aFireEventMode)
      Description copied from interface: ILcdEditableGraph
      Removes a node from this graph.
      Specified by:
      removeNode in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
      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

      public boolean canAddEdge(E aEdge, N aStartNode, N aEndNode)
      Description copied from interface: ILcdEditableGraph
      Returns 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:
      • 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:
      canAddEdge in interface ILcdEditableGraph<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:
      true if the edge can be added to this graph, false otherwise.
    • addEdge

      public void addEdge(E aEdge, N aStartNode, N aEndNode, int aFireEventMode)
      Description copied from interface: ILcdEditableGraph
      Adds an edge to this graph, connecting the two given nodes.
      Specified by:
      addEdge in interface ILcdEditableGraph<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 of ILcdFireEventMode.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

      public boolean canRemoveEdge(E aEdge)
      Description copied from interface: ILcdEditableGraph
      Returns 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:
      • the edge is not null
      • the edge is part of this graph
      Specified by:
      canRemoveEdge in interface ILcdEditableGraph<N,E>
      Parameters:
      aEdge - the edge to be verified.
      Returns:
      true if the edge can be removed from this graph, false otherwise.
    • removeEdge

      public E removeEdge(E aEdge, int aFireEventMode)
      Description copied from interface: ILcdEditableGraph
      Removes an edge from this graph.
      Specified by:
      removeEdge in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
      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: ILcdEditableGraph
      Removes all edges from this graph - nodes will remain in the graph.
      Specified by:
      removeEdges in interface ILcdEditableGraph<N,E>
      Parameters:
      aFireEventMode - the mode for sending out the TLcdGraphChangedEvent. This can be one of ILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.
    • clear

      public void clear(int aFireEventMode)
      Description copied from interface: ILcdEditableGraph
      Clears the graph; all edges and nodes are removed.
      Specified by:
      clear in interface ILcdEditableGraph<N,E>
      Parameters:
      aFireEventMode - the mode for sending out the TLcdGraphChangedEvent. This can be one of ILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER or ILcdFireEventMode.NO_EVENT.
    • nodeChanged

      public void nodeChanged(N aNode, int aEventMode)
      Description copied from interface: ILcdEditableGraph
      This 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:
      nodeChanged in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
    • nodesChanged

      public void nodesChanged(Vector<N> aNodes, int aEventMode)
      Description copied from interface: ILcdEditableGraph
      This method should be called when the given nodes have changed.
      Specified by:
      nodesChanged in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
      Preconditions:
      for each node object in the given vector should hold that: containsPartition(node) - Note: this validation is potentially expensive, and should be avoided whenever possible.
    • edgeChanged

      public void edgeChanged(E aEdge, int aEventMode)
      Description copied from interface: ILcdEditableGraph
      This method should be called when the given edge has changed.
      Specified by:
      edgeChanged in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
      Preconditions:
      containsBoundaryEdge(aEdge) - Note: this validation is potentially expensive, and should be avoided whenever possible.
    • edgesChanged

      public void edgesChanged(Vector<E> aEdges, int aEventMode)
      Description copied from interface: ILcdEditableGraph
      This method should be called when the given edges have changed.
      Specified by:
      edgesChanged in interface ILcdEditableGraph<N,E>
      Parameters:
      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.
      Preconditions:
      for each edge object 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: ILcdLimitedEditablePartitionedGraph
      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(). 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.
      Specified by:
      fireCollectedGraphChanges in interface ILcdEditableGraph<N,E>
      Specified by:
      fireCollectedGraphChanges in interface ILcdLimitedEditablePartitionedGraph<N,E>
      Overrides:
      fireCollectedGraphChanges in class TLcdLimitedEditablePartitionedGraph<N,E>