Package gw.lang.reflect.interval
Class AbstractInterval<E extends Comparable<E>,ME extends AbstractInterval<E,ME>>
java.lang.Object
gw.lang.reflect.interval.AbstractInterval<E,ME>
- All Implemented Interfaces:
IInterval<E,
ME>
- Direct Known Subclasses:
ComparableInterval
,IterableInterval
public abstract class AbstractInterval<E extends Comparable<E>,ME extends AbstractInterval<E,ME>>
extends Object
implements IInterval<E,ME>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractInterval
(E left, E right) AbstractInterval
(E left, E right, boolean bLeftClosed, boolean bRightClosed, boolean bReverse) -
Method Summary
-
Field Details
-
_left
-
_right
-
_bLeftClosed
private final boolean _bLeftClosed -
_bRightClosed
private final boolean _bRightClosed -
_bReverse
private final boolean _bReverse
-
-
Constructor Details
-
AbstractInterval
-
AbstractInterval
-
-
Method Details
-
checkArgs
-
getLeftEndpoint
- Specified by:
getLeftEndpoint
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Returns:
- The left endpoint of this interval where the left <= right
-
getRightEndpoint
- Specified by:
getRightEndpoint
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Returns:
- The right endpoint of this interval where the left <= right
-
isLeftClosed
public boolean isLeftClosed()- Specified by:
isLeftClosed
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Returns:
- True if this interval includes the left endpoint. E.g., x >= foo indicates a left-closed interval starting with and including foo. Conversely, x > foo is said to be left-open because the interface starts with, but excludes foo i.e., there is no minimum value defined in the interval, rather the interval is open with foo as the limit of minimum values.
-
isRightClosed
public boolean isRightClosed()- Specified by:
isRightClosed
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Returns:
- True if this interval includes the right endpoint. E.g., x <= foo indicates a right-closed interval ending with and including foo. Conversely, x < foo is said to be right-open because the interface ends with, but excludes foo i.e., there is no maximum value defined in the interval, rather the interval is open with foo as the limit of maximum values.
-
contains
- Specified by:
contains
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Parameters:
e
- An element to test- Returns:
- True if elem is a proper element in the set of elements defining this interval.
-
contains
- Specified by:
contains
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Parameters:
interval
- An interval to test for containment- Returns:
- True if interval's endpoints are proper elements in the set of elements defining this interval.
-
isReverse
public boolean isReverse()- Specified by:
isReverse
in interfaceIInterval<E extends Comparable<E>,
ME extends AbstractInterval<E, ME>> - Returns:
- True if this interval iterates from the right by default e.g., if the interval is specified in reverse order: 10..1, Gosu will create a reverse intervall
-
equals
-
hashCode
public int hashCode() -
toString
-