Add an existing item in the tree. A new node is inserted or an existing one updated, if one for the same period already exists.

@param invoiceItem new existing invoice item on disk.
762521
public void addItem(final InvoiceItem invoiceItem) {
        Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem);

        switch (invoiceItem.getInvoiceItemType()) {
            case RECURRING:
                if (invoiceItem.getAmount().compareTo(BigDecimal.ZERO) == 0) {
                    // Nothing to repair -- https://github.com/killbill/killbill/issues/783
                    existingIgnoredItems.add(invoiceItem);
                } else {
                    root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)));
                }
                break;

            case REPAIR_ADJ:
                root.addExistingItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.CANCEL)));
                break;

            case FIXED:
                existingIgnoredItems.add(invoiceItem);
                break;

            case ITEM_ADJ:
                pendingItemAdj.add(invoiceItem);
                break;

            default:
                break;
        }
    }
660501
protected void doAdd(final ItemData item, final WorkspaceStorageConnection con, final Set<QPath> addedNodes,
      ChangedSizeHandler sizeHandler) throws RepositoryException, InvalidItemStateException
   {
      if (item.isNode())
      {
         final NodeData node = (NodeData)item;

         checkSameNameSibling(node, con, addedNodes);
         addedNodes.add(node.getQPath());

         con.add(node);
      }
      else
      {
         con.add((PropertyData)item, sizeHandler);
      }
   }
633218
public function addItem(Item $item, int $qty = 1): void
    {
        for ($i = 0; $i < $qty; ++$i) {
            $this->items->insert($item);
        }
        $this->logger->log(LogLevel::INFO, "added {$qty} x {$item->getDescription()}", ['item' => $item]);
    }
1040155
protected void addNode( Node nodeToInsert, Node insertBeforeNode )
    {
        // Insert node.
        nodeToInsert.next = insertBeforeNode;
        nodeToInsert.previous = insertBeforeNode.previous;
        insertBeforeNode.previous.next = nodeToInsert;
        insertBeforeNode.previous = nodeToInsert;
    }
237517
public function addInvoices(\AgentSIB\Diadoc\Api\Proto\Events\XmlDocumentAttachment $value)
    {
        if ($this->Invoices === null) {
            $this->Invoices = new \Protobuf\MessageCollection();
        }

        $this->Invoices->add($value);
    }
1310615
def add(self, item):
        
        if isinstance(item, list):
            self.rows.append(Row(item))
        elif isinstance(item, Row):
            self.rows.append(item)
        else:
            raise InvalidMessageItemError(item, item.__class__)
1140957
public void addItem (@Nonnull final ReIndexWorkItem aItem) throws IllegalStateException
  {
    ValueEnforcer.notNull (aItem, "Item");
    m_aRWLock.writeLocked ( () -> {
      internalCreateItem (aItem);
    });
    LOGGER.info ("Added " + aItem.getLogText () + " to re-try list for retry #" + (aItem.getRetryCount () + 1));
  }
913632
protected ListSetItem<T> newItem(IModel<T> itemModel)
	{
		ListSetItem<T> item = new ListSetItem<T>(Integer.toString(counter++), itemModel);
		populateItem(item);
		return item;
	}
634902
public void addExistingItem(final ItemsNodeInterval newNode) {
        Preconditions.checkState(newNode.getItems().size() == 1, "Invalid node=%s", newNode);
        final Item item = newNode.getItems().get(0);

        addNode(newNode,
                new AddNodeCallback() {
                    @Override
                    public boolean onExistingNode(final NodeInterval existingNode) {
                        final ItemsInterval existingOrNewNodeItems = ((ItemsNodeInterval) existingNode).getItemsInterval();
                        existingOrNewNodeItems.add(item);
                        // There is no new node added but instead we just populated the list of items for the already existing node
                        return false;
                    }

                    @Override
                    public boolean shouldInsertNode(final NodeInterval insertionNode) {
                        // Always want to insert node in the tree when we find the right place.
                        return true;
                    }
                });
    }
1089271
protected function submitAddCollectionItem()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('collection_item');
        $this->addCollectionItem();
    }
1127801
def add(self, item):
        """"""
        if not item in self.items:
            self.items.append(item)
25340
@Override
    public void addOrUpdateItem(T item) {
        synchronized (LOCK) {
            // Update memory cache
            cache.onObjectUpdated(item.getEngineId(), item);

            List<T> items = new ArrayList<T>();
            items.add(item);
            asyncStorageInt.addOrUpdateItems(items);

            for (ListEngineDisplayListener<T> l : listeners) {
                l.addOrUpdate(item);
            }
        }
    }
894519
public void addItem(String term, Integer offsetStart, Integer offsetEnd,
      Integer posIncr, BytesRef payload, Integer flags) {
    if (!closed) {
      tokenNumber++;
      MtasUpdateRequestProcessorResultItem item = new MtasUpdateRequestProcessorResultItem(
          term, offsetStart, offsetEnd, posIncr, payload, flags);
      try {
        objectOutputStream.writeObject(item);
        objectOutputStream.reset();
        objectOutputStream.flush();
      } catch (IOException e) {
        forceCloseAndDelete();
        log.debug(e);
      }
    }
  }
915704
void insert_in_list(final WorkItem new_work) {
	int i;
	boolean done = false;
	for (i = 0; i < works.size() && !done; i++) {
	    final WorkItem item = (WorkItem) works.elementAt(i);
	    if (item.wake_up_date.tv_sec < new_work.wake_up_date.tv_sec) {
		continue;
	    } else if (item.wake_up_date.tv_sec == new_work.wake_up_date.tv_sec) {
		if (item.wake_up_date.tv_usec < new_work.wake_up_date.tv_usec) {
		    continue;
		} else {
		    works.insertElementAt(new_work, i);
		    done = true;
		}
	    } else {
		works.insertElementAt(new_work, i);
		done = true;
	    }
	}
	if (i == works.size()) {
	    works.add(new_work);
	}
    }
173836
def addItem(self, item, message=None):
        """"""
        if message is None:
            message = 'Adding item %s' % item.path
        try:
            v = Version.new(repo=self)
            v.addItem(item)
            v.save(message)
        except VersionError, e:
            raise RepoError(e)
629116
public function addItem(CNabuDataObject $item)
    {
        if (is_array($nodes = $this->extractNodes($item)) && count($nodes) > 0) {
            if ($this->index === null) {
                $this->index = $nodes;
            } else {
                $this->index = array_merge($this->index, $nodes);
            }
        }
    }
1061835
public function addItem(GridItem $gridItem)
    {
        if (!$this->items->contains($gridItem)) {
            $this->items->add($gridItem);
        }
    }