org.hawk.ds
Enum OperatorEnum

java.lang.Object
  extended by java.lang.Enum<OperatorEnum>
      extended by org.hawk.ds.OperatorEnum
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<OperatorEnum>

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

This defines all the operation supported in hawk. This requires the operator symbol along with its precedence.


Enum Constant Summary
AND
           
ARRAYBRACKET
           
ASSIGN
           
DIVIDE
           
EQUAL
           
GREATER
           
GREATERTHANEQUAL
           
LESSER
           
LESSTHANEQUAL
           
MINUS
           
MULTIPLY
           
OR
           
PLUS
           
REFERENCE
           
REMAINDER
           
XNOR
           
XOR
           
 
Method Summary
 boolean equals(OperatorEnum other)
          This checks equality of two operators
 java.lang.String getOperator()
           
 int getPrecedence()
           
static OperatorEnum matches(java.lang.String substr)
          This returns OperatorEnum if the input parameter matches with any of the known operators.
static OperatorEnum matchesExactly(java.lang.String substr)
          This returns OperatorEnum if the input parameter matches with any of the known operators.
 void setPrecedence(int precedence)
           
static OperatorEnum value(java.lang.String operatorStr)
          This creates OperatorEnum from operator raw string.
static OperatorEnum valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static OperatorEnum[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PLUS

public static final OperatorEnum PLUS

MINUS

public static final OperatorEnum MINUS

REMAINDER

public static final OperatorEnum REMAINDER

MULTIPLY

public static final OperatorEnum MULTIPLY

DIVIDE

public static final OperatorEnum DIVIDE

GREATER

public static final OperatorEnum GREATER

LESSER

public static final OperatorEnum LESSER

GREATERTHANEQUAL

public static final OperatorEnum GREATERTHANEQUAL

LESSTHANEQUAL

public static final OperatorEnum LESSTHANEQUAL

EQUAL

public static final OperatorEnum EQUAL

OR

public static final OperatorEnum OR

AND

public static final OperatorEnum AND

ARRAYBRACKET

public static final OperatorEnum ARRAYBRACKET

REFERENCE

public static final OperatorEnum REFERENCE

XOR

public static final OperatorEnum XOR

XNOR

public static final OperatorEnum XNOR

ASSIGN

public static final OperatorEnum ASSIGN
Method Detail

values

public static OperatorEnum[] 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 (OperatorEnum c : OperatorEnum.values())
    System.out.println(c);

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

valueOf

public static OperatorEnum 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

getOperator

public java.lang.String getOperator()

getPrecedence

public int getPrecedence()

setPrecedence

public void setPrecedence(int precedence)

value

public static OperatorEnum value(java.lang.String operatorStr)
This creates OperatorEnum from operator raw string.

Parameters:
operatorStr - raw string input
Returns:
returns the OperatorEnum if it is valid otherwise null

equals

public boolean equals(OperatorEnum other)
This checks equality of two operators

Parameters:
other - checks for equality against it
Returns:
returns Boolean.TRUE if the operators are equal or Boolean.FALSE. If the input is null it returns Boolean.FALSE

matchesExactly

public static OperatorEnum matchesExactly(java.lang.String substr)
This returns OperatorEnum if the input parameter matches with any of the known operators.

Parameters:
substr -
Returns:
returns OperatorEnum if the input parameter matches with any of the known operators.

matches

public static OperatorEnum matches(java.lang.String substr)
This returns OperatorEnum if the input parameter matches with any of the known operators.

Parameters:
substr -
Returns:
returns OperatorEnum if the input parameter matches with any of the known operators.