Esempio n. 1
0
    /** @see GraphListener#edgeRemoved(GraphEdgeChangeEvent) */
    public void edgeRemoved(GraphEdgeChangeEvent<V, E> e) {
      E jtEdge = e.getEdge();

      if (!jtElementsBeingRemoved.remove(jtEdge)) {
        handleJGraphTRemovedEdge(jtEdge);
      }
    }
 /** @see GraphListener#edgeRemoved(GraphEdgeChangeEvent) */
 public void edgeRemoved(GraphEdgeChangeEvent<V, E> e) {
   E edge = e.getEdge();
   V source = graph.getEdgeSource(edge);
   V target = graph.getEdgeTarget(edge);
   if (successorMap.containsKey(source)) {
     successorMap.get(source).removeNeighbor(target);
   }
   if (predecessorMap.containsKey(target)) {
     predecessorMap.get(target).removeNeighbor(source);
   }
 }
  /** @see GraphListener#edgeAdded(GraphEdgeChangeEvent) */
  public void edgeAdded(GraphEdgeChangeEvent<V, E> e) {
    E edge = e.getEdge();
    V source = graph.getEdgeSource(edge);
    V target = graph.getEdgeTarget(edge);

    // if a map does not already contain an entry,
    // then skip addNeighbor, since instantiating the map
    // will take care of processing the edge (which has already
    // been added)

    if (successorMap.containsKey(source)) {
      getSuccessors(source).addNeighbor(target);
    } else {
      getSuccessors(source);
    }
    if (predecessorMap.containsKey(target)) {
      getPredecessors(target).addNeighbor(source);
    } else {
      getPredecessors(target);
    }
  }