org.basex.query.xpath.expr
Class Calculation

java.lang.Object
  extended by org.basex.query.xpath.expr.Expr
      extended by org.basex.query.xpath.expr.DualExpr
          extended by org.basex.query.xpath.expr.Calculation

public final class Calculation
extends DualExpr

Calculation Expression.

Author:
Workgroup DBIS, University of Konstanz 2005-07, ISC License, Christian Gruen

Field Summary
 Calc type
          Expression Type.
 
Fields inherited from class org.basex.query.xpath.expr.DualExpr
expr1, expr2
 
Constructor Summary
Calculation(Expr e1, Expr e2, Calc t)
          Constructor.
 
Method Summary
 Expr compile(XPContext ctx)
          Tries to optimize the Expression.
 Num eval(XPContext ctx)
          Evaluates the expression with the specified context set.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.xpath.expr.DualExpr
usesPos, usesSize
 
Methods inherited from class org.basex.query.xpath.expr.Expr
indexEquivalent, indexSizes, returnedValue, sameAs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public Calc type
Expression Type.

Constructor Detail

Calculation

public Calculation(Expr e1,
                   Expr e2,
                   Calc t)
Constructor.

Parameters:
e1 - first expression (factor or dividend)
e2 - second expression (factor or divisor)
t - MultiplicativeExpr.MULTIPLICATION / DIVISION / MODULO
Method Detail

compile

public Expr compile(XPContext ctx)
             throws EvalException
Description copied from class: Expr
Tries to optimize the Expression.

Specified by:
compile in class Expr
Parameters:
ctx - expression context
Returns:
optimized Expression
Throws:
EvalException - evaluation exception

eval

public Num eval(XPContext ctx)
         throws EvalException
Description copied from class: Expr
Evaluates the expression with the specified context set. Additionally provides a context

Specified by:
eval in class Expr
Parameters:
ctx - query context
Returns:
resulting XPathValue
Throws:
EvalException - evaluation exception

toString

public java.lang.String toString()
Specified by:
toString in class Expr