ExpressionSingle { public void add(final Axis pAx) { Axis axis = pAx; if (isDupOrd(axis)) { axis = new DupFilterAxis(axis.asXdmNodeReadTrx(), axis); DupState.nodup = true; } switch (mNumber) { case 0: mFirstAxis = axis; mNumber++; break; case 1: mExpr = new NestedAxis(mFirstAxis, axis); mNumber++; break; default: final Axis cache = mExpr; mExpr = new NestedAxis(cache, axis); } } ExpressionSingle(); void add(final Axis pAx); Axis getExpr(); int getSize(); boolean isDupOrd(final Axis ax); boolean isOrdered();  }
@Test public void testAdd() throws SirixException { final ExpressionSingle builder = new ExpressionSingle(); AbstractAxis self = new SelfAxis(holder.getXmlNodeReadTrx()); builder.add(self); assertEquals(builder.getExpr(), self); AbstractAxis axis1 = new SelfAxis(holder.getXmlNodeReadTrx()); AbstractAxis axis2 = new SelfAxis(holder.getXmlNodeReadTrx()); builder.add(axis1); builder.add(axis2); assertTrue(builder.getExpr() instanceof NestedAxis); }