public final class BasicIntInterval extends java.lang.Object implements IntInterval, java.lang.Comparable<BasicIntInterval>
Class BasicIntInterval represents an interval of
consecutive integers.
BasicIntInterval are immutable.| Constructor and Description |
|---|
BasicIntInterval(int start,
int end)
Constructs an
SimpleIntInterval instance. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BasicIntInterval o)
Compares the specified
BasicIntInterval with this for order,
and returns a negative integer, zero, or a positive integer as
this is less than, equal to, or greater than the specified
BasicIntInterval object. |
int |
end()
Returns the end of the interval (inclusive).
|
boolean |
equals(java.lang.Object obj)
Returns
true if the specified object is an
BasicIntInterval instance and
this.start() == ((BasicIntInterval) obj).start(), and
this.end() == ((BasicIntInterval) obj).end(),
and returns false otherwise. |
int |
hashCode()
Returns a hash code value for the object.
|
int |
start()
Returns the start of the interval (inclusive).
|
java.lang.String |
toString()
Returns a string representation of
this. |
public BasicIntInterval(int start,
int end)
SimpleIntInterval instance.start - the starting integer (inclusive).end - the ending integer (inclusive).java.lang.IllegalArgumentException - if start>end.public int start()
IntIntervalstart in interface IntIntervalpublic int end()
IntIntervalend in interface IntIntervalpublic int hashCode()
Returns a hash code value for the object.
The hash code is defined by the following calculation:
int hash = 3;
hash += 59 * hash + this.start();
hash += 59 * hash + this.end();
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
true if the specified object is an
BasicIntInterval instance and
this.start() == ((BasicIntInterval) obj).start(), and
this.end() == ((BasicIntInterval) obj).end(),
and returns false otherwise.equals in class java.lang.Objectobj - the object to be compared with this for equality.true if the specified object is equal to
this, and returns false otherwise.public int compareTo(BasicIntInterval o)
BasicIntInterval with this for order,
and returns a negative integer, zero, or a positive integer as
this is less than, equal to, or greater than the specified
BasicIntInterval object.
BasicIntInterval objects are
ordered by their start and their end values in that order.compareTo in interface java.lang.Comparable<BasicIntInterval>o - the BasicIntInterval to be compared with this.public java.lang.String toString()
this. The exact
details of the representation are unspecified and subject to change.toString in class java.lang.Objectthis. The exact
details of the representation are unspecified and subject to change.