Example #1
0
  /** Removes the Object identified by the specified id from this Surface's {@link Layout}. */
  @Override
  public void requestRemove(String id) {
    Node<T> node = layout.getNode(id);
    if (node == null) {
      return;
    }

    List<Node<T>> affectedNodes = engine.requestRemoveElement(this, node);

    if (!affectedNodes.isEmpty()) {
      engine.adjustWeights(this);

      // Signal the client to remove the object associated with the removed "node".
      node.force(
          this, /* isMoveOperation() ? ChangeType.REMOVE_RETAIN : */ ChangeType.REMOVE_DISCARD);

      for (Node<T> n : affectedNodes) {
        n.set(this, ChangeType.RESIZE_RELOCATE);
      }

      removeNodeReferences(node);

      getPathIterator().assemblePaths(layout.getRoot());
    } else {
      //////////  VETO REMOVE /////////
    }
  }
Example #2
0
 private void shift(Node n) {
   Node L = n.left;
   T val;
   while (L.right != null && L.right.right != null) {
     L = L.right;
   }
   val = L.right.data;
   n.set(val);
   n.left = L.left;
   L.right = null; // make it disappear from the bottom of the tree
 }
  static void lazy(int node, int colour) {
    Node temp = tree[node];

    if (temp.colour == colour) return;

    temp.colour = colour;
    temp.set = new HashSet<Integer>();
    temp.set.add(colour);
    temp.lazy = -1;

    Iterator<Integer> iterator = temp.list.iterator();

    while (iterator.hasNext()) {
      int curr = iterator.next();

      if (curr == temp.parent) continue;

      tree[curr].lazy = colour;
    }
  }
 /**
  * Sets the node's value with the given value. Notifies the listeners on the change by calling
  * their set() method.
  */
 public void set(short value) {
   super.set(value);
   affectedGate.setDirty();
 }
Example #5
0
 /**
  * This method sets a node rule base to another one
  *
  * @param br The node rule base
  */
 public void set(NodeRuleBase br) {
   super.set(br);
   for (int i = 0; i < br.children.length; i++) children[i] = br.children[i].clone();
 }