org.basex.query.xpath.item
Enum Calc

java.lang.Object
  extended by java.lang.Enum<Calc>
      extended by org.basex.query.xpath.item.Calc
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Calc>

public enum Calc
extends java.lang.Enum<Calc>

This enumeration assembles different value comparisons.

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

Enum Constant Summary
DIV
          Expression Type: division.
MINUS
          Expression Type: subtraction.
MOD
          Expression Type: modulo.
MULT
          Expression Type: multiplication.
PLUS
          Expression Type: addition.
 
Field Summary
 java.lang.String name
          String representation.
 
Method Summary
abstract  double eval(double d1, double d2)
          Evaluates the expression.
 java.lang.String toString()
           
static Calc valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Calc[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PLUS

public static final Calc PLUS
Expression Type: addition.


MINUS

public static final Calc MINUS
Expression Type: subtraction.


MULT

public static final Calc MULT
Expression Type: multiplication.


DIV

public static final Calc DIV
Expression Type: division.


MOD

public static final Calc MOD
Expression Type: modulo.

Field Detail

name

public final java.lang.String name
String representation.

Method Detail

values

public static Calc[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Calc c : Calc.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Calc valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

eval

public abstract double eval(double d1,
                            double d2)
Evaluates the expression.

Parameters:
d1 - first value
d2 - second value
Returns:
result

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Enum<Calc>