code: private void algorithm(final XMLEvent paramEvent) throws IOException, XMLStreamException, TTIOException {
          assert paramEvent != null;
          do {
              /*
               * Check if a node in the shreddered file on the same level equals
               * the current element node.
               */
              if (paramEvent.isStartElement()) {
                  mFound = checkElement(paramEvent.asStartElement());
              } else if (paramEvent.isCharacters()) {
                  mFound = checkText(paramEvent.asCharacters());
              }
              if (mWtx.getNode().getDataKey() != mNodeKey) {
                  mIsRightSibling = true;
              }
  
              mKeyMatches = mWtx.getNode().getDataKey();
              //
              // if (mFound && mIsRightSibling) {
              // /*
              // * Root element of next subtree in shreddered file matches
              // * so check all descendants. If they match the node must be
              // * inserted.
              // */
              // switch (paramEvent.getEventType()) {
              // case XMLStreamConstants.START_ELEMENT:
              // mMoved = EMoved.FIRSTNODE;
              // //mFound = checkDescendants(paramEvent.asStartElement());
              // mFound = checkDescendants(paramEvent.asStartElement());
              // break;
              // case XMLStreamConstants.CHARACTERS:
              // mFound = checkText(paramEvent.asCharacters());
              // break;
              // default:
              // // throw new
              // AssertionError("Node type not known or not implemented!");
              // }
              // mWtx.moveTo(mKeyMatches);
              // }
          } while (!mFound && mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey()));
          mWtx.moveTo(mNodeKey);
      }
docs: Main algorithm to determine if nodes are equal, have to be inserted, or
  have to be removed.
  
  @param paramEvent
  The currently parsed StAX event.
  @throws IOException
  In case the open operation fails (delegated from
  checkDescendants(...)).
  @throws XMLStreamException
  In case any StAX parser problem occurs.
  @throws TTIOException