Insert an operation on the given node to the beginning of the queue.

@param node the node where to insert the {@link Operation}.
@param o the operation to insert.
421487
public void insertOperation(final MemcachedNode node, final Operation o) {
    o.setHandlingNode(node);
    o.initialize();
    node.insertOp(o);
    addedQueue.offer(node);
    metrics.markMeter(OVERALL_REQUEST_METRIC);

    Selector s = selector.wakeup();
    assert s == selector : "Wakeup returned the wrong selector.";
    getLogger().debug("Added %s to %s", o, node);
  }
1280217
public void addLast(final T node) {
        if ( this.firstNode == null ) {
            this.firstNode = node;
            this.lastNode = node;
        } else {
            T currentLast = this.lastNode;
            currentLast.setNext( node );
            node.setPrevious( currentLast );
            this.lastNode = node;            
        }
        
        this.size++;
    }
132352
public boolean add(Object o) {
        // find the index where this item should go
        // add the item @ the specified index
        int idx = 0;
        if(!isEmpty()) {
            idx = findInsertionPoint(o);
        }

        try {
            super.add(idx, o);
        }
        catch(IndexOutOfBoundsException e) {
            return false;
        }
        return true;
    }
1137949
private void addNode(Node n) {
    Node target = null;
    Node fn = null;
    String name = null;

    switch (n.getToken()) {
      // handles assignment cases like:
      // a = function() {}
      // a = b = c = function() {}
      case ASSIGN:
        if (!n.getFirstChild().isQualifiedName()) {
          compiler.report(JSError.make(n, INJECTED_FUNCTION_ON_NON_QNAME));
          return;
        }
        name = n.getFirstChild().getQualifiedName();
        // last node of chained assignment.
        fn = n;
        while (fn.isAssign()) {
          fn = fn.getLastChild();
        }
        target = n.getParent();
        break;

      // handles function case:
      // function fnName() {}
      case FUNCTION:
        name = NodeUtil.getName(n);
        fn = n;
        target = n;
        if (n.getParent().isAssign()
            && n.getParent().getJSDocInfo().isNgInject()) {
          // This is a function assigned into a symbol, e.g. a regular function
          // declaration in a goog.module or goog.scope.
          // Skip in this traversal, it is handled when visiting the assign.
          return;
        }
        break;

      // handles var declaration cases like:
      // var a = function() {}
      // var a = b = function() {}
      case VAR:
      case LET:
      case CONST:
        name = n.getFirstChild().getString();
        // looks for a function node.
        fn = getDeclarationRValue(n);
        target = n;
        break;

      // handles class method case:
      // class clName(){
      //   constructor(){}
      //   someMethod(){} <===
      // }
      case MEMBER_FUNCTION_DEF:
        Node parent = n.getParent();
        if (parent.isClassMembers()){
          Node classNode = parent.getParent();
          String midPart = n.isStaticMember() ? "." : ".prototype.";
          name = NodeUtil.getName(classNode) + midPart + n.getString();
          if (NodeUtil.isEs6ConstructorMemberFunctionDef(n)) {
            name = NodeUtil.getName(classNode);
          }
          fn = n.getFirstChild();
          if (classNode.getParent().isAssign() || classNode.getParent().isName()) {
            target = classNode.getGrandparent();
          } else {
            target = classNode;
          }
        }
        break;
      default:
        break;
    }

    if (fn == null || !fn.isFunction()) {
      compiler.report(JSError.make(n, INJECT_NON_FUNCTION_ERROR));
      return;
    }
    // report an error if the function declaration did not take place in a block or global scope
    if (!target.getParent().isScript()
        && !target.getParent().isBlock()
        && !target.getParent().isModuleBody()) {
      compiler.report(JSError.make(n, INJECT_IN_NON_GLOBAL_OR_BLOCK_ERROR));
      return;
    }
    // checks that name is present, which must always be the case unless the
    // compiler allowed a syntax error or a dangling anonymous function
    // expression.
    checkNotNull(name);
    // registers the node.
    injectables.add(new NodeContext(name, n, fn, target));
  }
1266823
public void set(XEvent o) {
		list.remove(position);
		list.add(position, o);
	}
45784
protected void setNode(Node node) {
        assert node!=null;
        if(node instanceof Slave)
            this.nodeName = node.getNodeName();
        else
            this.nodeName = null;

        setNumExecutors(node.getNumExecutors());
        if (this.temporarilyOffline) {
            // When we get a new node, push our current temp offline
            // status to it (as the status is not carried across
            // configuration changes that recreate the node).
            // Since this is also called the very first time this
            // Computer is created, avoid pushing an empty status
            // as that could overwrite any status that the Node
            // brought along from its persisted config data.
            node.setTemporaryOfflineCause(this.offlineCause);
        }
    }
166910
public JsonNode apply(final JsonNode node) {
        requireNonNull(node, "node");
        JsonNode ret = node.deepCopy();
        for (final JsonPatchOperation operation : operations) {
            ret = operation.apply(ret);
        }

        return ret;
    }
411380
function (node, newNode) {
        return node.nextSibling ? node.parentNode.insertBefore(newNode, node.nextSibling):
            node.parentNode.appendChild(newNode);
    }
455620
public void insertSiblingAfter(Node node) {
    if (node != null) {
      node.setNextSibling(getNextSibling());
      node.setPrevSibling(this);
    }
  }
756957
private void pushScope(Node node) {
    checkNotNull(curNode);
    checkNotNull(node);
    scopeRoots.add(node);
    recordScopeRoot(node);
    if (scopeCallback != null) {
      scopeCallback.enterScope(this);
    }
  }
115727
public function insert(Node $node) : void
    {
        $node->setParent($this->scope);
        $this->scope->insert($node);
    }
42737
public void performWithLock (final NodeObject.Lock lock, final LockedOperation operation)
    {
        acquireLock(lock, new ResultListener<String>() {
            public void requestCompleted (String nodeName) {
                if (getNodeObject().nodeName.equals(nodeName)) {
                    // lock acquired successfully - perform the operation, and release the lock.
                    try {
                        operation.run();
                    } finally {
                        releaseLock(lock, new ResultListener.NOOP<String>());
                    }
                } else {
                    // some other peer beat us to it
                    operation.fail(nodeName);
                    if (nodeName == null) {
                        log.warning("Lock acquired by null?", "lock", lock);
                    }
                }
            }
            public void requestFailed (Exception cause) {
                log.warning("Lock acquisition failed", "lock", lock, cause);
                operation.fail(null);
            }
        });
    }
112997
def insert_node(self, node):
        
        if self._is_node_reserved(node):
            return False

        # Put node in map
        self._node_map[node.get_id()] = node
        return True
1241282
private void doNodeJoined(final Node node) {
    tasks.runTask(new Handler<Task>() {
      @Override
      public void handle(final Task task) {
        if (currentContext != null) {
          log.info(String.format("%s - %s joined the cluster. Uploading components to new node", NetworkManager.this, node.address()));
          installModules(node, currentContext, new Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Void> result) {
              if (result.failed()) {
                log.error(result.cause());
              } else {
                log.info(String.format("%s - Successfully uploaded components to %s", NetworkManager.this, node.address()));
              }
              task.complete();
            }
          });
        } else {
          task.complete();
        }
      }
    });
  }
819802
public void addNode(N node)
    {
        if(!nodes.containsKey(node))
            nodes.put(node, new Pair<HashSet<N>, HashSet<N>>(new HashSet<N>(), new HashSet<N>()));
    }
1097119
@Override
	public void addNode(Node n) {
		if (nodeAccess.getCapacity() < getNodeIndex(nodePos) + NODE_SIZE)
			nodeAccess.ensureCapacity(nodeAccess.getCapacity() + INITIAL_NODE_FILE_SIZE);
		nodIdMapping.put(n.getId(), nodePos);
		
		long nodeIndex = getNodeIndex(nodePos);
		
		nodeAccess.setLong( nodeIndex      , n.getId() );
		nodeAccess.setLong( nodeIndex + 8  ,    -1l    );
		nodeAccess.setLong( nodeIndex + 16 ,    -1l    );
		
		nodeAccess.setLong( 0 , ++nodePos );
		
	}
207973
void add(Node node) {

		if (!(node instanceof Criteria)) {
			throw new IllegalArgumentException("Can only add instances of Criteria");
		}

		node.setParent(this);

		boolean containsNearFunction = this.siblings.stream().anyMatch(criteria -> criteria.getPredicates().stream()
				.anyMatch(predicate -> predicate.getKey().equalsIgnoreCase("$within")));

		Criteria criteria = (Criteria) node;
		if (containsNearFunction) {
			this.siblings.add(0, criteria);
		} else {
			this.siblings.add(criteria);
		}

		this.mostRecentSibling = node;
	}