Package jflex
Class Interval
- java.lang.Object
-
- jflex.Interval
-
public final class Interval extends java.lang.ObjectAn 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 booleancontains(int point)Returntrueiffpointis contained in this interval.booleancontains(Interval other)Returntrueiff this interval completely contains the other one.Intervalcopy()Make a copy of this interval.booleanequals(java.lang.Object o)private static booleanisPrintable(int c)Check whether a character is printable.voidsetEnd(int end)Set a new last charactervoidsetStart(int start)Set a new first characterjava.lang.StringtoString()Get a String representation of this interval.
-
-
-
Method Detail
-
contains
public boolean contains(int point)
Returntrueiffpointis 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)
Returntrueiff 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
trueifois an interval with the same borders.- Overrides:
equalsin 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:
toStringin classjava.lang.Object- Returns:
- a string
"[start-end]"or"[start]"(if there is only one character in the interval) wherestartandendare 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
-
-