org.exist.xpath
Class OpNumeric

java.lang.Object
  extended byorg.exist.xpath.PathExpr
      extended byorg.exist.xpath.BinaryOp
          extended byorg.exist.xpath.OpNumeric
All Implemented Interfaces:
Expression

public class OpNumeric
extends BinaryOp

numeric operation on two operands by +, -, *, div, mod etc..


Field Summary
protected  DBBroker broker
           
protected  int operator
           
protected  NodeSet temp
           
 
Fields inherited from class org.exist.xpath.PathExpr
docs, inPredicate, keepVirtual, pool, steps
 
Constructor Summary
OpNumeric(BrokerPool pool, Expression left, Expression right, int operator)
           
OpNumeric(BrokerPool pool, int operator)
           
 
Method Summary
 double applyOperator(double left, double right)
           
 Value eval(DocumentSet docs, NodeSet context, NodeProxy node)
          Evaluate the expression represented by this object.
 java.lang.String pprint()
          Return a readable representation of this expression.
 DocumentSet preselect(DocumentSet in_docs)
          Determine the documents, taken from in_docs, for which this expression will possibly yield a result.
 int returnsType()
          The type of value, this expression returns.
 
Methods inherited from class org.exist.xpath.BinaryOp
getLeft, getRight
 
Methods inherited from class org.exist.xpath.PathExpr
add, add, addDocument, addPath, addPredicate, getDocumentSet, getExpression, getLength, preselect, setDocumentSet, setFirstExpression, setInPredicate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operator

protected int operator

temp

protected NodeSet temp

broker

protected DBBroker broker
Constructor Detail

OpNumeric

public OpNumeric(BrokerPool pool,
                 int operator)

OpNumeric

public OpNumeric(BrokerPool pool,
                 Expression left,
                 Expression right,
                 int operator)
Method Detail

returnsType

public int returnsType()
Description copied from interface: Expression
The type of value, this expression returns. Depending on the type of expression, this method should return one of the constants defined in class Constants, e.g. TYPE_NODELIST, TYPE_STRING, TYPE_NUM, TYPE_BOOL.

Specified by:
returnsType in interface Expression
Overrides:
returnsType in class BinaryOp

preselect

public DocumentSet preselect(DocumentSet in_docs)
Description copied from interface: Expression
Determine the documents, taken from in_docs, for which this expression will possibly yield a result. An expression does not have to do anything here. It may simply return in_docs. This method is used to restrict the range of documents in question for a given xpath-expression. It is called before the xpath-expression is actually executed.

Specified by:
preselect in interface Expression
Specified by:
preselect in class BinaryOp

eval

public Value eval(DocumentSet docs,
                  NodeSet context,
                  NodeProxy node)
Description copied from interface: Expression
Evaluate the expression represented by this object. Depending on the context in which this expression is executed, either context, node or both of them may be set. An implementing class should know how to handle this. Most classes only expect context to contain a list of nodes which represents the current context of this expression.

Specified by:
eval in interface Expression
Specified by:
eval in class BinaryOp

applyOperator

public double applyOperator(double left,
                            double right)

pprint

public java.lang.String pprint()
Description copied from interface: Expression
Return a readable representation of this expression. This method is called whenever the xpath-query should be displayed to the user.

Specified by:
pprint in interface Expression
Specified by:
pprint in class BinaryOp


Copyright (C) Wolfgang Meier. All rights reserved.