NodeWrapper implements SiblingCountingNode { @Override public int compareOrder(final NodeInfo node) { if (getDocumentNumber() != node.getDocumentNumber()) { throw new IllegalStateException("May not be called on different trees!"); } return Navigator.compareOrder(this, (NodeWrapper) checkNotNull(node)); } NodeWrapper(final DocumentWrapper docWrapper, final long nodeKeyToStart); @Override Value atomize(); @Override int compareOrder(final NodeInfo node); void copy(final Receiver out, final int copyOption,
			final int locationId); @Override void generateId(final FastStringBuffer buf); @Override String getAttributeValue(final int fingerprint); @Override String getBaseURI(); @Override int getColumnNumber(); @Override Configuration getConfiguration(); @Override int[] getDeclaredNamespaces(final int[] buffer); @Override String getDisplayName(); @Override long getDocumentNumber(); @Override DocumentInfo getDocumentRoot(); @Override int getFingerprint(); @Override int getLineNumber(); @Override String getLocalPart(); @Override int getNameCode(); @Override NamePool getNamePool(); @Override int getNodeKind(); @Override NodeInfo getParent(); @Override String getPrefix(); @Override NodeInfo getRoot(); @Override final String getStringValue(); @Override final CharSequence getStringValueCS(); @Override String getSystemId(); int getTypeAnnotation(); @Override String getURI(); @Override boolean hasChildNodes(); @Override boolean isId(); @Override boolean isIdref(); @Override boolean isNilled(); @Override boolean isSameNodeInfo(final NodeInfo pOther); @Override AxisIterator iterateAxis(final byte axisNumber); @Override AxisIterator iterateAxis(final byte axisNumber, final NodeTest nodeTest); @Override void setSystemId(final String systemId); @Override SequenceIterator getTypedValue(); @Override int getSiblingPosition(); long getKey();  }
@Test public void testCompareOrder() throws XPathException, SirixException { final Processor proc = new Processor(false); final Configuration config = proc.getUnderlyingConfiguration(); final Session session = generateSession(); final NodeWriteTrx trx = session.beginNodeWriteTrx(); trx.commit(); trx.close(); NodeInfo node = new DocumentWrapper(session, config); NodeInfo other = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 3); try { node.compareOrder(other); fail(); } catch (final IllegalStateException e) { } node = new DocumentWrapper(mHolder.getSession(), config); other = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 3); assertEquals(-1, node.compareOrder(other)); node = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 3); other = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 0); assertEquals(1, node.compareOrder(other)); node = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 3); other = new NodeWrapper(new DocumentWrapper(mHolder.getSession(), config), 3); assertEquals(0, node.compareOrder(other)); session.close(); mDatabase.close(); }