public void addPredicate ( final INodeReadTrx mTransaction ) { assert getPipeStack ( ) . size ( ) >= 2 ; final AbsAxis mPredicate = getPipeStack ( ) . pop ( ) . getExpr ( ) ; if ( mPredicate instanceof LiteralExpr ) { mPredicate . hasNext ( ) ; // if is numeric literal -> abbrev for position() final int type = mTransaction . getNode ( ) . getTypeKey ( ) ; if ( type == NamePageHash . generateHashForString ( "xs:integer" ) || type == NamePageHash . generateHashForString ( "xs:double" ) || type == NamePageHash . generateHashForString ( "xs:float" ) || type == NamePageHash . generateHashForString ( "xs:decimal" ) ) { throw new IllegalStateException ( "function fn:position() is not implemented yet." ) ; // getExpression().add( // new PosFilter(transaction, (int) // Double.parseDouble(transaction // .getValue()))); // return; // TODO: YES! it is dirty! // AtomicValue pos = // new AtomicValue(mTransaction.getNode().getRawValue(), // mTransaction // .keyForName("xs:integer")); // long position = mTransaction.getItemList().addItem(pos); // mPredicate.reset(mTransaction.getNode().getNodeKey()); // IAxis function = // new FNPosition(mTransaction, new ArrayList<IAxis>(), // FuncDef.POS.getMin(), FuncDef.POS // .getMax(), // mTransaction.keyForName(FuncDef.POS.getReturnType())); // IAxis expectedPos = new LiteralExpr(mTransaction, position); // // mPredicate = new ValueComp(mTransaction, function, // expectedPos, CompKind.EQ); } } getExpression ( ) . add ( new PredicateFilterAxis ( mTransaction , mPredicate ) ) ; }
Adds a predicate to the pipeline .