fleXplorer.Types
Class Limit<Type extends java.lang.Comparable<Type>>

java.lang.Object
  extended by fleXplorer.Types.Limit<Type>

public class Limit<Type extends java.lang.Comparable<Type>>
extends java.lang.Object

Version:
1.0

Constructor Summary
Limit(boolean closed, boolean lower, Type value)
          Constructs a Limit and sets its value, if it is closed, if it is the lower limit of an Interval.
 
Method Summary
 int compareTo(Limit<Type> another)
          Compares this Limit with the specified Limit for order, according their values.
 Limit<Type> lower(boolean closed, Type value)
          Constructs and returns a lower Limit of an Interval.
 Limit<Type> upper(boolean closed, Type value)
          Constructs and returns a upper Limit of an Interval.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Limit

public Limit(boolean closed,
             boolean lower,
             Type value)
Constructs a Limit and sets its value, if it is closed, if it is the lower limit of an Interval. Preconditions: The type of value must be comparable.
Postconditions: Constructs a Limit and sets its value, if it is closed, if it is the lower limit of an Interval.

Parameters:
closed - Defines if Limit is closed.
lower - Defines if Limit is the lower limit of an Interval.
value - The comparable value of Limit.
Method Detail

upper

public Limit<Type> upper(boolean closed,
                         Type value)
Constructs and returns a upper Limit of an Interval. Preconditions: The type of value must be comparable.
Postconditions: Calls the constructor of class and constructs an upper Limit with the specified values.

Parameters:
closed - Defines if Limit is closed.
value - The comparable value of Limit.
Returns:
a upper Limit with the specified values.

lower

public Limit<Type> lower(boolean closed,
                         Type value)
Constructs and returns a lower Limit of an Interval. Preconditions: The type of value must be comparable.
Postconditions: Calls the constructor of class and constructs a lower Limit with the specified values.

Parameters:
closed - Defines if Limit is closed.
value - The comparable value of Limit.
Returns:
a lower Limit with the specified values.

compareTo

public int compareTo(Limit<Type> another)
Compares this Limit with the specified Limit for order, according their values. Returns a negative integer, zero, or a positive integer as this Limit is less than, equal to, or greater than the specified Limit. Preconditions: Limits must be in the same type.
Postconditions: Checks if values are null, if not calls the Comparable.compareTo().

Parameters:
another - the Limit to be compared.
Returns:
a negative integer, zero, or a positive integer as this Limit is less than, equal to, or greater than the specified Limit.