public final class Interval
extends java.lang.Object
| Constructor and Description |
|---|
Interval(Interval other)
Copy constructor
|
Interval(int start,
int end)
Constuct a new interval from
start to end. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int point)
Return
true iff point is contained in this interval. |
boolean |
contains(Interval other)
Return
true iff this interval completely contains the
other one. |
Interval |
copy()
Make a copy of this interval.
|
boolean |
equals(java.lang.Object o)
Return
true if o is an interval
with the same borders. |
private static boolean |
isPrintable(int c)
Check whether a character is printable.
|
void |
setEnd(int end)
Set a new last character
|
void |
setStart(int start)
Set a new first character
|
java.lang.String |
toString()
Get a String representation of this interval.
|
public Interval(int start,
int end)
start to end.start - first character the interval should containend - last character the interval should containpublic Interval(Interval other)
public boolean contains(int point)
true iff point is contained in this interval.point - the character to checkpublic boolean contains(Interval other)
true iff this interval completely contains the
other one.other - the other intervalpublic boolean equals(java.lang.Object o)
true if o is an interval
with the same borders.equals in class java.lang.Objecto - the object to check equality withpublic void setEnd(int end)
end - the new last character of this intervalpublic void setStart(int start)
start - the new first character of this intervalprivate static boolean isPrintable(int c)
c - the character to checkpublic java.lang.String toString()
toString in class java.lang.Object"[start-end]" or
"[start]" (if there is only one character in
the interval) where start and
end are either a number (the character code)
or something of the from 'a'.public Interval copy()