org.ourgrid.common.matcher
Class Interval

java.lang.Object
  extended by org.ourgrid.common.matcher.Interval

public class Interval
extends java.lang.Object

Defines a closed interval and permits that logical conjunctions alters the interval .


Field Summary
static java.lang.String EQUAL
           
static java.lang.String GREATER
           
static java.lang.String GREATER_EQUAL
           
static java.lang.String LESS
           
static java.lang.String LESS_EQUAL
           
static int UNDEFINED
           
 
Constructor Summary
Interval()
          Constructs a Interval [ - infinity, infinity ]
 
Method Summary
 int getLeftMargin()
          Returns the left margin of the interval.
 int getRightMargin()
          Returns the right margin of the interval.
 boolean isInInterval(int factor)
          Verifies a number is in the interval
 boolean isUndefiined()
          Checks if the margins were not set yet.
 void modifyInterval(java.lang.String expression)
          Modifies the interval with the expression.
 java.lang.String toString()
          Returns a String representation of the Interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GREATER_EQUAL

public static final java.lang.String GREATER_EQUAL
See Also:
Constant Field Values

LESS_EQUAL

public static final java.lang.String LESS_EQUAL
See Also:
Constant Field Values

EQUAL

public static final java.lang.String EQUAL
See Also:
Constant Field Values

GREATER

public static final java.lang.String GREATER
See Also:
Constant Field Values

LESS

public static final java.lang.String LESS
See Also:
Constant Field Values

UNDEFINED

public static final int UNDEFINED
See Also:
Constant Field Values
Constructor Detail

Interval

public Interval()
Constructs a Interval [ - infinity, infinity ]

Method Detail

modifyInterval

public void modifyInterval(java.lang.String expression)
                    throws InvalidIntervalModificationException
Modifies the interval with the expression.

Parameters:
expression - Sintax: "Operator number" Valid operators are: " <=", ">=", "==", ">", " <"
Throws:
InvalidIntervalModificationException

isInInterval

public boolean isInInterval(int factor)
Verifies a number is in the interval

Parameters:
factor - The number
Returns:
If the number is in the interval

getLeftMargin

public int getLeftMargin()
Returns the left margin of the interval.

Returns:
Returns the leftMargin.

getRightMargin

public int getRightMargin()
Returns the right margin of the interval.

Returns:
Returns the rightMargin.

toString

public java.lang.String toString()
Returns a String representation of the Interval.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of the Interval.

isUndefiined

public boolean isUndefiined()
Checks if the margins were not set yet.

Returns:
true case the margins were not set yet. false otherwise.