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>
-
-
Constructor Summary
Constructors Constructor Description AbstractInterval(E left, E right)
AbstractInterval(E left, E right, boolean bLeftClosed, boolean bRightClosed, boolean bReverse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(E e)
boolean
contains(ME interval)
boolean
equals(Object o)
E
getLeftEndpoint()
E
getRightEndpoint()
int
hashCode()
boolean
isLeftClosed()
boolean
isReverse()
boolean
isRightClosed()
String
toString()
-
-
-
Method Detail
-
getLeftEndpoint
public E 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
public E 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
public boolean contains(E e)
- 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
public boolean contains(ME interval)
- 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
-
-