JIVE Platform
Release 0.3.1

edu.buffalo.cse.jive.ui.search
Enum RelationalOperator

java.lang.Object
  extended by java.lang.Enum<RelationalOperator>
      extended by edu.buffalo.cse.jive.ui.search.RelationalOperator
All Implemented Interfaces:
Serializable, Comparable<RelationalOperator>

public enum RelationalOperator
extends Enum<RelationalOperator>

A representation of a relational operator for use by an IJiveSearchQuery. The operator can be used to compare a Value object with either another Value or with a String.

Value#Encoded objects may be compared using any of the available operators. All other Value objects can only be compared with NONE, EQUAL, or NOT_EQUAL.

See Also:
evaluate(Value, Value), evaluate(Value, String)

Enum Constant Summary
EQUAL
          A relational operator used to determine if two values are equal.
GREATER_THAN
          A relational operator used to determine if one value is greater than another value.
GREATER_THAN_OR_EQUAL
          A relational operator used to determine if one value is greater than or equal to another value.
LESS_THAN
          A relational operator used to determine if one value is less than another value.
LESS_THAN_OR_EQUAL
          A relational operator used to determine if one value is less than or equal to another value.
NONE
          A relational operator which always evaluates to true.
NOT_EQUAL
          A relational operator used to determine if two values are not equal.
 
Method Summary
protected
<T> boolean
compare(Comparable<T> left, T right)
          Compares the two operands using the Comparable interface.
protected  boolean compare(String left, String right)
          Compares the supplied strings by first converting them to the appropriate type.
abstract  boolean evaluate(Value left, String right)
          Evaluates the operator on the supplied values.
abstract  boolean evaluate(Value left, Value right)
          Evaluates the operator on the supplied values.
static RelationalOperator fromString(String operator)
          Returns the RelationalOperator represented by the supplied string.
 String toString()
           
static RelationalOperator valueOf(String name)
          Returns the enum constant of this type with the specified name.
static RelationalOperator[] 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, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final RelationalOperator NONE
A relational operator which always evaluates to true.


EQUAL

public static final RelationalOperator EQUAL
A relational operator used to determine if two values are equal.


NOT_EQUAL

public static final RelationalOperator NOT_EQUAL
A relational operator used to determine if two values are not equal.


LESS_THAN

public static final RelationalOperator LESS_THAN
A relational operator used to determine if one value is less than another value.


LESS_THAN_OR_EQUAL

public static final RelationalOperator LESS_THAN_OR_EQUAL
A relational operator used to determine if one value is less than or equal to another value.


GREATER_THAN

public static final RelationalOperator GREATER_THAN
A relational operator used to determine if one value is greater than another value.


GREATER_THAN_OR_EQUAL

public static final RelationalOperator GREATER_THAN_OR_EQUAL
A relational operator used to determine if one value is greater than or equal to another value.

Method Detail

values

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

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

valueOf

public static RelationalOperator valueOf(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toString

public String toString()
Overrides:
toString in class Enum<RelationalOperator>

evaluate

public abstract boolean evaluate(Value left,
                                 Value right)
Evaluates the operator on the supplied values.

Parameters:
left - the left operand
right - the right operand
Returns:
the evaluation result

evaluate

public abstract boolean evaluate(Value left,
                                 String right)
Evaluates the operator on the supplied values.

Parameters:
left - the left operand
right - the right operand
Returns:
the evaluation result

compare

protected boolean compare(String left,
                          String right)
Compares the supplied strings by first converting them to the appropriate type.

Parameters:
left - the left operand
right - the right operand
Returns:
the comparison result

compare

protected <T> boolean compare(Comparable<T> left,
                              T right)
Compares the two operands using the Comparable interface.

Type Parameters:
T - the type of the operands
Parameters:
left - the left operand
right - the right operand
Returns:
the comparison result

fromString

public static RelationalOperator fromString(String operator)
Returns the RelationalOperator represented by the supplied string.

Parameters:
operator - the string representation
Returns:
the operator represented by the string

JIVE Platform
Release 0.3.1