public DocumentRevisionTree add(InternalDocumentRevision documentRevision) {
        Misc.checkArgument(!sequenceMap.containsKey(documentRevision.getSequence()),
                "The revision must not be added to the tree before.");

        if(documentNumericId == -1l && docId == null){
            documentNumericId = documentRevision.getInternalNumericId();
            docId = documentRevision.getId();
        } else if (!(documentRevision.getInternalNumericId() == documentNumericId ||
                documentRevision.getId().equals(docId))) {
            //document is not part of the same three though exception
            throw new IllegalArgumentException("Document revision is not part of the same tree");

        }

        if(documentRevision.getParent() <= 0) {
            addRootDBObject(documentRevision);
        } else {
            addNode(documentRevision);
        }
        return this;
    }
public DocumentRevisionTree add ( InternalDocumentRevision documentRevision ) { Misc . checkArgument ( ! sequenceMap . containsKey ( documentRevision . getSequence ( ) ) , "The revision must not be added to the tree before." ) ; if ( documentNumericId == - 1l && docId == null ) { documentNumericId = documentRevision . getInternalNumericId ( ) ; docId = documentRevision . getId ( ) ; } else if ( ! ( documentRevision . getInternalNumericId ( ) == documentNumericId || documentRevision . getId ( ) . equals ( docId ) ) ) { throw new IllegalArgumentException ( "Document revision is not part of the same tree" ) ; } if ( documentRevision . getParent ( ) <= 0 ) { addRootDBObject ( documentRevision ) ; } else { addNode ( documentRevision ) ; } return this ; }
<p>Adds a new {@link InternalDocumentRevision} to the document.</p>

<p>The {@code DocumentRevision}'s parent, if there is one, must already be in
the document tree.</p>

@param documentRevision the {@code DocumentRevision} to add
@return {@code DocumentRevisionTree} for method chaining