Package jflex
Class Interval
java.lang.Object
jflex.Interval
An interval of characters with basic operations.
- Version:
- JFlex 1.7.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int point) Returntrueiffpointis contained in this interval.booleanReturntrueiff this interval completely contains the other one.copy()Make a copy of this interval.booleanprivate static booleanisPrintable(int c) Check whether a character is printable.voidsetEnd(int end) Set a new last charactervoidsetStart(int start) Set a new first charactertoString()Get a String representation of this interval.
-
Field Details
-
start
public int start -
end
public int end
-
-
Constructor Details
-
Interval
public Interval(int start, int end) Construct a new interval fromstarttoend.- Parameters:
start- first character the interval should containend- last character the interval should contain
-
Interval
Copy constructor.- Parameters:
other- aIntervalobject.
-
-
Method Details
-
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
Returntrueiff this interval completely contains the other one.- Parameters:
other- the other interval- Returns:
- whether this interval completely contains the other one.
-
equals
Return
trueifois an interval with the same borders. -
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
Get a String representation of this interval. -
copy
Make a copy of this interval.- Returns:
- the copy
-