jwo.utils.expression
Class MathOperator

java.lang.Object
  extended by jwo.utils.expression.MathOperator

public final class MathOperator
extends Object

Stores an enumerated list of operators that may be parsed by the MathParser. Modified from original code described at www.devx.com/premier/mgznarch/javapro/2001/05may01/ps0105/ps0105.asp.

Version:
2.3, 1st October, 2008.
Author:
Daniel Savarese with additions and modifications by Jo Wood.

Field Summary
static MathOperator ABS
          Absolute value function.
static MathOperator ACOS
          Trigonometrical inverse cosine function.
static MathOperator ADD
          Addition operator.
static MathOperator AND
          'and' Boolean operator.
static MathOperator ASIN
          Trigonometrical inverse sine function.
static MathOperator ATAN
          Trigonometrical inverse tangent function (returning semicircular angle +-Pi/2).
static MathOperator ATAN2
          Inverse tangent function (returns full +-PI angle).
static MathOperator BLUE
          Extracts blue component from a 32 bit colour value.
static MathOperator COMPARE
          String compare function.
static MathOperator CONCATENATE
          String concatenate operator.
static MathOperator COS
          Trigonometrical cosine function.
static MathOperator DIVIDE
          Division operator.
static MathOperator E
          Function to return constant e.
static MathOperator EQUAL
          'Equal to' comparative operator.
static MathOperator EXPONENT
          Exponential (power) operator.
static MathOperator FOCAL
          Focal neighbourhood operator.
static MathOperator GAUSS
          Gaussian (normal) random number function.
static MathOperator GREATER_THAN
          'Greater than' comparative operator.
static MathOperator GREATER_THAN_EQUAL
          'Greater than or equal to' comparative operator.
static MathOperator GREEN
          Extracts green component from a 32 bit colour value.
static MathOperator IF
          Logical condition if block.
static MathOperator IFELSE
          Logical condition function if (condition, true value, false value).
static MathOperator LESS_THAN
          'Less than' comparative operator.
static MathOperator LESS_THAN_EQUAL
          'Less than or equal to' comparative operator.
static MathOperator LN
          Natural log function.
static MathOperator MAX
          Maximum of given arguments function.
static MathOperator MEDIAN
          Median of given arguments function.
static MathOperator MIN
          Minimum of given arguments function.
static MathOperator MODE
          Mode of given arguments function.
static MathOperator MODULUS
          Modulus operator.
static MathOperator MULTIPLY
          Multiplication operator.
static MathOperator NOT
          'not' Boolean operator.
static MathOperator NOT_EQUAL
          'Not equal to' comparative operator.
static MathOperator NULL
          Function to return null identifier.
static MathOperator OR
          'or' Boolean operator.
static MathOperator PERCENTILE
          Given percentile of given arguments function.
static MathOperator PI
          Function to return constant Pi.
static MathOperator QUOTEFN
          String quoting function.
static MathOperator RAND
          Rectangular random number function.
static MathOperator RANK
          Rank of first given argument in the list of remaining arguments.
static MathOperator RED
          Extracts red component from a 32 bit colour value.
static MathOperator RGB
          Creates a 32 bit colour value from the given red, green and blue components.
static MathOperator ROUND
          Decimal rounding function.
static MathOperator SIN
          Trigonometrical sine function.
static MathOperator SQRT
          Square root function.
static MathOperator STRLEN
          Reports the length of a string
static MathOperator SUBSTRING
          Extracts a substring from a string
static MathOperator SUBTRACT
          Subtraction operator.
static MathOperator TAN
          Trigonometrical tangent function.
static MathOperator UNARY_SUBTRACT
          Unary minus operator (eg -25).
static MathOperator WHILE
          Logical condition while loop.
static MathOperator X
          Shortcut variable used to represent spatial x coordinate.
static MathOperator Y
          Shortcut variable used to represent spatial y coordinate.
static MathOperator Z1
          Shortcut variable used to represent primary attribute.
static MathOperator Z2
          Shortcut variable used to represent secondary attribute.
 
Constructor Summary
MathOperator()
           
 
Method Summary
static void addShortcutVars()
          Deprecated. This method is included for backward compatibility only and should only be used if the more general form of variable substitution via the Substitutable interface (the preferred mechanism) is not being used.
static String getHelpMessage(Object operator)
          Reports the help message associated with the given operator.
static MathOperator getOperator(Object token)
          Retrieves the operator matching the given type.
 String toString()
          Reports a string representation of this operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD

public static final MathOperator ADD
Addition operator.


SUBTRACT

public static final MathOperator SUBTRACT
Subtraction operator.


UNARY_SUBTRACT

public static final MathOperator UNARY_SUBTRACT
Unary minus operator (eg -25).


MULTIPLY

public static final MathOperator MULTIPLY
Multiplication operator.


DIVIDE

public static final MathOperator DIVIDE
Division operator.


EXPONENT

public static final MathOperator EXPONENT
Exponential (power) operator.


MODULUS

public static final MathOperator MODULUS
Modulus operator.


CONCATENATE

public static final MathOperator CONCATENATE
String concatenate operator.


RAND

public static final MathOperator RAND
Rectangular random number function.


GAUSS

public static final MathOperator GAUSS
Gaussian (normal) random number function.


PI

public static final MathOperator PI
Function to return constant Pi.


E

public static final MathOperator E
Function to return constant e.


NULL

public static final MathOperator NULL
Function to return null identifier.


SIN

public static final MathOperator SIN
Trigonometrical sine function.


COS

public static final MathOperator COS
Trigonometrical cosine function.


TAN

public static final MathOperator TAN
Trigonometrical tangent function.


ASIN

public static final MathOperator ASIN
Trigonometrical inverse sine function.


ACOS

public static final MathOperator ACOS
Trigonometrical inverse cosine function.


ATAN

public static final MathOperator ATAN
Trigonometrical inverse tangent function (returning semicircular angle +-Pi/2).


SQRT

public static final MathOperator SQRT
Square root function.


LN

public static final MathOperator LN
Natural log function.


ROUND

public static final MathOperator ROUND
Decimal rounding function.


ABS

public static final MathOperator ABS
Absolute value function.


IF

public static final MathOperator IF
Logical condition if block.


WHILE

public static final MathOperator WHILE
Logical condition while loop.


QUOTEFN

public static final MathOperator QUOTEFN
String quoting function.


STRLEN

public static final MathOperator STRLEN
Reports the length of a string


RED

public static final MathOperator RED
Extracts red component from a 32 bit colour value.


GREEN

public static final MathOperator GREEN
Extracts green component from a 32 bit colour value.


BLUE

public static final MathOperator BLUE
Extracts blue component from a 32 bit colour value.


FOCAL

public static final MathOperator FOCAL
Focal neighbourhood operator.


ATAN2

public static final MathOperator ATAN2
Inverse tangent function (returns full +-PI angle).


COMPARE

public static final MathOperator COMPARE
String compare function.


IFELSE

public static final MathOperator IFELSE
Logical condition function if (condition, true value, false value).


RGB

public static final MathOperator RGB
Creates a 32 bit colour value from the given red, green and blue components.


SUBSTRING

public static final MathOperator SUBSTRING
Extracts a substring from a string


MAX

public static final MathOperator MAX
Maximum of given arguments function.


MIN

public static final MathOperator MIN
Minimum of given arguments function.


MODE

public static final MathOperator MODE
Mode of given arguments function.


MEDIAN

public static final MathOperator MEDIAN
Median of given arguments function.


PERCENTILE

public static final MathOperator PERCENTILE
Given percentile of given arguments function.


RANK

public static final MathOperator RANK
Rank of first given argument in the list of remaining arguments.


GREATER_THAN

public static final MathOperator GREATER_THAN
'Greater than' comparative operator.


GREATER_THAN_EQUAL

public static final MathOperator GREATER_THAN_EQUAL
'Greater than or equal to' comparative operator.


LESS_THAN

public static final MathOperator LESS_THAN
'Less than' comparative operator.


LESS_THAN_EQUAL

public static final MathOperator LESS_THAN_EQUAL
'Less than or equal to' comparative operator.


EQUAL

public static final MathOperator EQUAL
'Equal to' comparative operator.


NOT_EQUAL

public static final MathOperator NOT_EQUAL
'Not equal to' comparative operator.


AND

public static final MathOperator AND
'and' Boolean operator.


OR

public static final MathOperator OR
'or' Boolean operator.


NOT

public static final MathOperator NOT
'not' Boolean operator.


Z1

public static final MathOperator Z1
Shortcut variable used to represent primary attribute.


Z2

public static final MathOperator Z2
Shortcut variable used to represent secondary attribute.


X

public static final MathOperator X
Shortcut variable used to represent spatial x coordinate.


Y

public static final MathOperator Y
Shortcut variable used to represent spatial y coordinate.

Constructor Detail

MathOperator

public MathOperator()
Method Detail

getOperator

public static final MathOperator getOperator(Object token)
Retrieves the operator matching the given type.

Parameters:
token - Type of operator to retrieve.
Returns:
Matched operator.

addShortcutVars

public static void addShortcutVars()
Deprecated. This method is included for backward compatibility only and should only be used if the more general form of variable substitution via the Substitutable interface (the preferred mechanism) is not being used.

Adds the shortcut variables (x,y,z1,z2) to the list of operators available.


toString

public String toString()
Reports a string representation of this operator.

Overrides:
toString in class Object
Returns:
String representation of this operator.

getHelpMessage

public static String getHelpMessage(Object operator)
Reports the help message associated with the given operator.

Parameters:
operator - Operator requiring help message.
Returns:
Help message for the given operator.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009