com.novell.xml.xpath
Class ComparisonExpr

java.lang.Object
  extended bycom.novell.xml.xpath.BinaryExpr
      extended bycom.novell.xml.xpath.BooleanExpr
          extended bycom.novell.xml.xpath.ComparisonExpr
All Implemented Interfaces:
Expression
Direct Known Subclasses:
EqualsExpr, GreaterThanEqualsExpr, GreaterThanExpr, LessThanEqualsExpr, LessThanExpr, NotEqualsExpr

public abstract class ComparisonExpr
extends BooleanExpr
implements Expression

Base class for EqualityExpr and RelationalExpr implementations


Field Summary
 
Fields inherited from class com.novell.xml.xpath.BinaryExpr
lhs, rhs
 
Constructor Summary
protected ComparisonExpr(Expression lhs, Expression rhs)
           
 
Method Summary
protected  boolean compareBooleans(boolean lhs, boolean rhs, int compare)
          Compare two booleans according to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareNodeSetAndNumber(NodeSet lhs, double rhs, int compare)
          Compare a node-set and a number according to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareNodeSetAndString(NodeSet lhs, String rhs, int compare)
          Compare a node-set and a string according to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareNodeSets(NodeSet lhs, NodeSet rhs, int compare)
          Compare two node sets according to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareNumbers(double lhs, double rhs, int compare)
          Compare two numbers according to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareOperands(ExpressionValue lhs, ExpressionValue rhs, int compare)
          Compare two operandsaccording to XPath rules for RelationalExpr and EqualityExpr
protected  boolean compareStrings(String lhs, String rhs, int compare)
          Compare two strings according to XPath rules for RelationalExpr and EqualityExpr
 
Methods inherited from class com.novell.xml.xpath.BooleanExpr
getResultType
 
Methods inherited from class com.novell.xml.xpath.BinaryExpr
dump, isConstant, registerForReset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.novell.xml.xpath.Expression
dump, evaluate, getResultType, isConstant, registerForReset
 

Constructor Detail

ComparisonExpr

protected ComparisonExpr(Expression lhs,
                         Expression rhs)
Method Detail

compareOperands

protected boolean compareOperands(ExpressionValue lhs,
                                  ExpressionValue rhs,
                                  int compare)
                           throws XPathEvaluationException
Compare two operandsaccording to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand
rhs - The right-hand operand
compare - The desired comparison to find: -3 lhs not equal to rhs '!=' -2 lhs less than rhs '<' -1 lhs less than or equals to rhs '<=' 0 lhs equal to rhs '=' 1 lhs greater than or equal to rhs '>' 2 lhs greater than rhs '>=' 3 lhs not equal to rhs '!='
Returns:
true if and only if there is a node from the lhs and a node from the rhs that satisfy the passed relationship
Throws:
XPathEvaluationException

compareNodeSets

protected boolean compareNodeSets(NodeSet lhs,
                                  NodeSet rhs,
                                  int compare)
Compare two node sets according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand
rhs - The right-hand operand
compare - The desired comparison to find: -2 lhs lexically less than rhs -1 lhs lexically less than or equals to rhs 0 lhs lexically equal to rhs 1 lhs lexically greater than or equal to rhs 2 lhs lexically greater than rhs
Returns:
true if and only if there is a node from the lhs and a node from the rhs that satisfy the passed relationship

compareNodeSetAndString

protected boolean compareNodeSetAndString(NodeSet lhs,
                                          String rhs,
                                          int compare)
Compare a node-set and a string according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand node-set
rhs - The right-hand operand string
compare - The desired comparison to find: -2 lhs lexically less than rhs -1 lhs lexically less than or equals to rhs 0 lhs lexically equal to rhs 1 lhs lexically greater than or equal to rhs 2 lhs lexically greater than rhs
Returns:
true if and only if there is a node from the lhs that satisfies the passed relationship

compareNodeSetAndNumber

protected boolean compareNodeSetAndNumber(NodeSet lhs,
                                          double rhs,
                                          int compare)
Compare a node-set and a number according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand node-set
rhs - The right-hand operand number
compare - The desired comparison to find: -2 lhs numerically less than rhs -1 lhs numerically less than or equals to rhs 0 lhs numerically equal to rhs 1 lhs numerically greater than or equal to rhs 2 lhs numerically greater than rhs
Returns:
true if and only if there is a node from the lhs that satisfies the passed relationship

compareBooleans

protected boolean compareBooleans(boolean lhs,
                                  boolean rhs,
                                  int compare)
Compare two booleans according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand
rhs - The right-hand operand
compare - The desired comparison to find: -3 lhs numerically not equal to rhs -2 lhs numerically less than rhs -1 lhs numerically less than or equals to rhs 0 lhs numerically equal to rhs 1 lhs numerically greater than or equal to rhs 2 lhs numerically greater than rhs 3 lhs numerically not equal to rhs
Returns:
true if and only if there is a node from the lhs that satisfies the passed relationship

compareNumbers

protected boolean compareNumbers(double lhs,
                                 double rhs,
                                 int compare)
Compare two numbers according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand
rhs - The right-hand operand
compare - The desired comparison to find: -3 lhs numerically not equal to rhs -2 lhs numerically less than rhs -1 lhs numerically less than or equals to rhs 0 lhs numerically equal to rhs 1 lhs numerically greater than or equal to rhs 2 lhs numerically greater than rhs 3 lhs numerically not equal to rhs
Returns:
true if and only if there is a node from the lhs that satisfies the passed relationship

compareStrings

protected boolean compareStrings(String lhs,
                                 String rhs,
                                 int compare)
Compare two strings according to XPath rules for RelationalExpr and EqualityExpr

Parameters:
lhs - The left-hand operand
rhs - The right-hand operand
compare - The desired comparison to find: -3 lhs numerically not equal to rhs -2 lhs numerically less than rhs -1 lhs numerically less than or equals to rhs 0 lhs numerically equal to rhs 1 lhs numerically greater than or equal to rhs 2 lhs numerically greater than rhs 3 lhs numerically not equal to rhs
Returns:
true if and only if there is a node from the lhs that satisfies the passed relationship