Package jflex
Class Interval
- java.lang.Object
-
- jflex.Interval
-
public final class Interval extends java.lang.Object
An interval of characters with basic operations.- Version:
- JFlex 1.7.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(int point)
Returntrue
iffpoint
is contained in this interval.boolean
contains(Interval other)
Returntrue
iff this interval completely contains the other one.Interval
copy()
Make a copy of this interval.boolean
equals(java.lang.Object o)
private static boolean
isPrintable(int c)
Check whether a character is printable.void
setEnd(int end)
Set a new last charactervoid
setStart(int start)
Set a new first characterjava.lang.String
toString()
Get a String representation of this interval.
-
-
-
Method Detail
-
contains
public boolean contains(int point)
Returntrue
iffpoint
is contained in this interval.- Parameters:
point
- the character to check- Returns:
- whether the codepoint is contained in the interval.
-
contains
public boolean contains(Interval other)
Returntrue
iff this interval completely contains the other one.- Parameters:
other
- the other interval- Returns:
- whether this interval completely contains the other one.
-
equals
public boolean equals(java.lang.Object o)
Return
true
ifo
is an interval with the same borders.- Overrides:
equals
in classjava.lang.Object
-
setEnd
public void setEnd(int end)
Set a new last character- Parameters:
end
- the new last character of this interval
-
setStart
public void setStart(int start)
Set a new first character- Parameters:
start
- the new first character of this interval
-
isPrintable
private static boolean isPrintable(int c)
Check whether a character is printable.- Parameters:
c
- the character to check
-
toString
public java.lang.String toString()
Get a String representation of this interval.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string
"[start-end]"
or"[start]"
(if there is only one character in the interval) wherestart
andend
are either a number (the character code) or something of the from'a'
.
-
copy
public Interval copy()
Make a copy of this interval.- Returns:
- the copy
-
-