public boolean eval(VTDNavHuge vn) { boolean b; count++; // increment the position expr.setPosition(count); if (expr.isNumerical()){ b = (expr.evalNumber(vn)== count); } else{ b = expr.evalBoolean(vn); } return b; }
public int evalNodeSet(VTDNavHuge vn) throws XPathEvalExceptionHuge, NavExceptionHuge { // TODO Auto-generated method stub return exprVal.evalNodeSet(vn); }
if (left.isNodeSet() && right.isNodeSet()) { return compNodeSetNodeSet(left, right, vn, op); } else { if (left.isNumerical() && right.isNodeSet()){ return compNumericalNodeSet(left, right, vn, op); if (left.isNodeSet() && right.isNumerical()) { return compNodeSetNumerical(left, right, vn, op); if (left.isString() && right.isNodeSet()){ return compStringNodeSet(left, right, vn, op); if (left.isNodeSet() && right.isString()) { return compNodeSetString(left, right, vn, op); if (left.isBoolean() || right.isBoolean()) { if (op == EQ) return left.evalBoolean(vn) == right.evalBoolean(vn); else return left.evalBoolean(vn) != right.evalBoolean(vn); if (left.isNumerical() || right.isNumerical()) { if (op == EQ) return left.evalNumber(vn) == right.evalNumber(vn); else return left.evalNumber(vn) != right.evalNumber(vn); st1 = left.evalString(vn); st2 = right.evalString(vn);
private int count(VTDNavHuge vn){ int a = -1; if (argCount()!=1 || argumentList.e.isNodeSet()==false) throw new IllegalArgumentException ("Count()'s argument count is invalid"); vn.push2(); try{ a = 0; argumentList.e.adjust(vn.getTokenCount()); while(argumentList.e.evalNodeSet(vn)!=-1){ a ++; } argumentList.e.reset(vn); vn.pop2(); }catch(Exception e){ argumentList.e.reset(vn); vn.pop2(); } return a; }
private boolean contains(VTDNavHuge vn){ String s2 = argumentList.next.e.evalString(vn); if (argumentList.e.isNodeSet()){ int a = evalFirstArgumentListNodeSet(vn); if (a==-1) return false; try { return vn.contains(a, s2); }catch (Exception e){ return false; } } String s1 = argumentList.e.evalString(vn); //return s1.contains(s2); return s1.indexOf(s2)!=-1; //return (s1.i)) }
/** * evalXPathToString() evaluates the xpath expression to a String * @return String * */ public String evalXPathToString(){ return xpe.evalString(vn); } /**
private int evalFirstArgumentListNodeSet2(VTDNavHuge vn){ vn.push2(); int size = vn.contextStack2.size; int a = -1; try { a = argumentList.e.evalNodeSet(vn); } catch (Exception e) { } vn.contextStack2.size = size; argumentList.e.reset(vn); vn.pop2(); return a; }
/** * This method returns the next node in the nodeset * it returns -1 if there is no more node * Afer finishing evaluating, don't forget to <em> reset the xpath </em> * @return int corresponding to the VTD index */ public int evalXPath() throws XPathEvalExceptionHuge, NavExceptionHuge{ if (xpe!=null){ if (ft == true){ if (vn != null){ stackSize = vn.contextStack2.size; } ft = false; xpe.adjust(vn.getTokenCount()); } return xpe.evalNodeSet(vn); } throw new PilotExceptionHuge(" Null XPath expression "); }
public boolean requireContextSize() { // boolean b = false; UnionExpr tmp = this; while (tmp != null) { if (tmp.e.requireContextSize()== true){ return true; } tmp = tmp.next; } return false; }
/** * evalXPathToBoolean() evaluates the xpath expression to a boolean * @return boolean * */ public boolean evalXPathToBoolean(){ return xpe.evalBoolean(vn); } /**
/** * evalXPathToNumber() evaluates the xpath expression to a double * @return double * */ public double evalXPathToNumber(){ return xpe.evalNumber(vn); } /**
public boolean isString() { // TODO Auto-generated method stub return exprVal.isString(); }
public boolean isNumerical() { // TODO Auto-generated method stub return e.isNumerical(); }
public boolean isBoolean() { // TODO Auto-generated method stub return e.isBoolean(); }
public boolean isNodeSet() { // TODO Auto-generated method stub return exprVal.isNodeSet(); }
if (left.isNodeSet() && right.isNodeSet()) { return compNodeSetNodeSet(left, right, vn, op); } else { if (left.isNumerical() && right.isNodeSet()){ return compNumericalNodeSet(left, right, vn, op); if (left.isNodeSet() && right.isNumerical()) { return compNodeSetNumerical(left, right, vn, op); if (left.isString() && right.isNodeSet()){ return compStringNodeSet(left, right, vn, op); if (left.isNodeSet() && right.isString()) { return compNodeSetString(left, right, vn, op); if (left.isBoolean() || right.isBoolean()) { if (op == EQ) return left.evalBoolean(vn) == right.evalBoolean(vn); else return left.evalBoolean(vn) != right.evalBoolean(vn); if (left.isNumerical() || right.isNumerical()) { if (op == EQ) return left.evalNumber(vn) == right.evalNumber(vn); else return left.evalNumber(vn) != right.evalNumber(vn); st1 = left.evalString(vn); st2 = right.evalString(vn);
private int count(VTDNavHuge vn){ int a = -1; if (argCount()!=1 || argumentList.e.isNodeSet()==false) throw new IllegalArgumentException ("Count()'s argument count is invalid"); vn.push2(); try{ a = 0; argumentList.e.adjust(vn.getTokenCount()); while(argumentList.e.evalNodeSet(vn)!=-1){ a ++; } argumentList.e.reset(vn); vn.pop2(); }catch(Exception e){ argumentList.e.reset(vn); vn.pop2(); } return a; }
private boolean contains(VTDNavHuge vn){ String s2 = argumentList.next.e.evalString(vn); if (argumentList.e.isNodeSet()){ int a = evalFirstArgumentListNodeSet(vn); if (a==-1) return false; try { return vn.contains(a, s2); }catch (Exception e){ return false; } } String s1 = argumentList.e.evalString(vn); //return s1.contains(s2); return s1.indexOf(s2)!=-1; //return (s1.i)) }
/** * evalXPathToString() evaluates the xpath expression to a String * @return String * */ public String evalXPathToString(){ return xpe.evalString(vn); } /**