/** * Returns <code>Boolean.TRUE</code> if the boolean value of * <code>obj</code> is false, and <code>Boolean.FALSE</code> otherwise. * The boolean value is calculated as if by the XPath <code>boolean</code> * function. * * @param obj the object whose boolean value is inverted * @param nav the <code>Navigator</code> used to calculate the boolean value of <code>obj</code> * * @return <code>Boolean.TRUE</code> if the boolean value of * <code>obj</code> is false, and <code>Boolean.FALSE</code> otherwise */ public static Boolean evaluate(Object obj, Navigator nav) { return ( ( BooleanFunction.evaluate( obj, nav ).booleanValue() ) ? Boolean.FALSE : Boolean.TRUE ); }
new BooleanFunction() );
"boolean", new BooleanFunction());
/** Convert the argument to a <code>Boolean</code> * * @param context the context at the point in the * expression when the function is called * @param args a list with exactly one item which will be converted to a * <code>Boolean</code> * * @return the result of evaluating the function; * <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code> * * @throws FunctionCallException if <code>args</code> has more or less than one item */ public Object call(Context context, List args) throws FunctionCallException { if ( args.size() == 1 ) { return evaluate( args.get(0), context.getNavigator() ); } throw new FunctionCallException("boolean() requires one argument"); }
"boolean", new BooleanFunction());
public Object evaluate(Context context) throws JaxenException { Navigator nav = context.getNavigator(); Boolean lhsValue = BooleanFunction.evaluate( getLHS().evaluate( context ), nav ); if ( lhsValue.booleanValue() ) { return Boolean.TRUE; } // Short circuits are required in XPath. "The right operand is not // evaluated if the left operand evaluates to true." Boolean rhsValue = BooleanFunction.evaluate( getRHS().evaluate( context ), nav ); if ( rhsValue.booleanValue() ) { return Boolean.TRUE; } return Boolean.FALSE; }
public Object evaluate(Context context) throws JaxenException { Navigator nav = context.getNavigator(); Boolean lhsValue = BooleanFunction.evaluate( getLHS().evaluate( context ), nav ); if ( !lhsValue.booleanValue() ) { return Boolean.FALSE; } // Short circuits are required in XPath. "The right operand is not // evaluated if the left operand evaluates to false." Boolean rhsValue = BooleanFunction.evaluate( getRHS().evaluate( context ), nav ); if ( !rhsValue.booleanValue() ) { return Boolean.FALSE; } return Boolean.TRUE; }
/** Retrieve a boolean-value interpretation of this XPath * expression when evaluated against a given context. * * <p> * The boolean-value of the expression is determined per * the <code>boolean(..)</code> function defined * in the XPath specification. This means that an expression * that selects zero nodes will return <code>false</code>, * while an expression that selects one or more nodes will * return <code>true</code>. * </p> * * @param node the node, node-set or Context object for evaluation. This value can be null. * * @return the boolean-value of the result of evaluating this expression with the specified context node * @throws JaxenException if an XPath error occurs during expression evaluation */ public boolean booleanValueOf(Object node) throws JaxenException { Context context = getContext( node ); List result = selectNodesForContext( context ); if ( result == null ) return false; return BooleanFunction.evaluate( result, context.getNavigator() ).booleanValue(); }
BooleanFunction.evaluate(predResult, predContext.getNavigator()); if (includes.booleanValue()) {
BooleanFunction.evaluate(predResult, predContext.getNavigator()); if (includes.booleanValue()) {
private boolean evaluateObjectObject( Object lhs, Object rhs, Navigator nav ) { if( eitherIsBoolean( lhs, rhs ) ) { return evaluateObjectObject( BooleanFunction.evaluate( lhs, nav ), BooleanFunction.evaluate( rhs, nav ) ); } else if( eitherIsNumber( lhs, rhs ) ) { return evaluateObjectObject( NumberFunction.evaluate( lhs, nav ), NumberFunction.evaluate( rhs, nav ) ); } else { return evaluateObjectObject( StringFunction.evaluate( lhs, nav ), StringFunction.evaluate( rhs, nav ) ); } }
public static Object evaluate(Object condition, Object trueObj, Object falseObj, Navigator nav) throws FunctionCallException { return BooleanFunction.evaluate(condition, nav).booleanValue() ? trueObj : falseObj; } }
boolean includeFts = BooleanFunction.evaluate(includeFtsObj, nav); QName qname = QName.createQName(nav.getAttributeNamespaceUri(attribute), ISO9075.decode(nav .getAttributeName(attribute)));
boolean includeFts = BooleanFunction.evaluate(includeFtsObj, nav); QName qname = QName.createQName(nav.getAttributeNamespaceUri(attribute), ISO9075.decode(nav .getAttributeName(attribute)));