@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_GREATER ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_LESS || r == Expr.CMP_EQUAL ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_GREATER || r == Expr.CMP_EQUAL ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_GREATER ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_LESS ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_GREATER || r == Expr.CMP_EQUAL ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_LESS || r == Expr.CMP_EQUAL ) ; }
@Override public NodeValue eval(NodeValue x, NodeValue y) { int r = NodeValue.compare(x, y) ; return NodeValue.booleanReturn( r == Expr.CMP_LESS ) ; }
/** Compare by value (and only value) if possible. * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) * @param nv1 * @param nv2 * @return negative, 0 , or positive for not possible, less than, equal, greater than. * @throws ExprNotComparableException */ public static int compare(NodeValue nv1, NodeValue nv2) { // Called from E_LessThat etc // and NodeUtils.comparLiteralsByValue if ( nv1 == null || nv2 == null ) //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; throw new ARQInternalErrorException("Attempt to compare on null") ; int x = compare(nv1, nv2, false) ; return x ; }
/** Compare by value (and only value) if possible. * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) * @param nv1 * @param nv2 * @return negative, 0 , or positive for not possible, less than, equal, greater than. * @throws ExprNotComparableException */ public static int compare(NodeValue nv1, NodeValue nv2) { // Called from E_LessThat etc // and NodeUtils.comparLiteralsByValue if ( nv1 == null || nv2 == null ) //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; throw new ARQInternalErrorException("Attempt to compare on null") ; int x = compare(nv1, nv2, false) ; return x ; }
/** Compare by value if possible else compare by kind/type/lexical form * Only use when you want an ordering regardless of form of NodeValue, * for example in ORDER BY * * @param nv1 * @param nv2 * @return negative, 0, or postive for less than, equal, greater than. */ public static int compareAlways(NodeValue nv1, NodeValue nv2) { // ***** Only called from a test. Sort out with NodeUtils. try { int x = compare(nv1, nv2, true) ; // Same? if ( x != Expr.CMP_EQUAL ) return x ; } catch (ExprNotComparableException ex) { /* Drop through */ } return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; }
/** Compare by value if possible else compare by kind/type/lexical form * Only use when you want an ordering regardless of form of NodeValue, * for example in ORDER BY * * @param nv1 * @param nv2 * @return negative, 0, or postive for less than, equal, greater than. */ public static int compareAlways(NodeValue nv1, NodeValue nv2) { // ***** Only called from a test. Sort out with NodeUtils. try { int x = compare(nv1, nv2, true) ; // Same? if ( x != Expr.CMP_EQUAL ) return x ; } catch (ExprNotComparableException ex) { /* Drop through */ } return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; }