| java.lang.Object org.apache.commons.lang.CharRange
CharRange | final public class CharRange implements Serializable(Code) | | A contiguous range of characters, optionally negated.
Instances are immutable.
author: Stephen Colebourne author: Chris Feldhacker author: Gary Gregory since: 1.0 version: $Id: CharRange.java 471626 2006-11-06 04:02:09Z bayard $ |
Constructor Summary | |
public | CharRange(char ch) | public | CharRange(char ch, boolean negated) | public | CharRange(char start, char end) | public | CharRange(char start, char end, boolean negated) Constructs a CharRange over a set of characters,
optionally negating the range.
A negated range includes everything except that defined by the
start and end characters.
If start and end are in the wrong order, they are reversed. |
CharRange | public CharRange(char ch)(Code) | | Constructs a CharRange over a single character.
Parameters: ch - only character in this range |
CharRange | public CharRange(char ch, boolean negated)(Code) | | Constructs a CharRange over a single character,
optionally negating the range.
A negated range includes everything except the specified char.
Parameters: ch - only character in this range Parameters: negated - true to express everything except the range |
CharRange | public CharRange(char start, char end)(Code) | | Constructs a CharRange over a set of characters.
Parameters: start - first character, inclusive, in this range Parameters: end - last character, inclusive, in this range |
CharRange | public CharRange(char start, char end, boolean negated)(Code) | | Constructs a CharRange over a set of characters,
optionally negating the range.
A negated range includes everything except that defined by the
start and end characters.
If start and end are in the wrong order, they are reversed.
Thus a-e is the same as e-a .
Parameters: start - first character, inclusive, in this range Parameters: end - last character, inclusive, in this range Parameters: negated - true to express everything except the range |
contains | public boolean contains(char ch)(Code) | | Is the character specified contained in this range.
Parameters: ch - the character to check true if this range contains the input character |
contains | public boolean contains(CharRange range)(Code) | | Are all the characters of the passed in range contained in
this range.
Parameters: range - the range to check against true if this range entirely contains the input range throws: IllegalArgumentException - if null input |
equals | public boolean equals(Object obj)(Code) | | Compares two CharRange objects, returning true if they represent
exactly the same range of characters defined in the same way.
Parameters: obj - the object to compare to true if equal |
getEnd | public char getEnd()(Code) | | Gets the end character for this character range.
the end char (inclusive) |
getStart | public char getStart()(Code) | | Gets the start character for this character range.
the start char (inclusive) |
hashCode | public int hashCode()(Code) | | Gets a hashCode compatible with the equals method.
a suitable hashCode |
isNegated | public boolean isNegated()(Code) | | Is this CharRange negated.
A negated range includes everything except that defined by the
start and end characters.
true is negated |
toString | public String toString()(Code) | | Gets a string representation of the character range.
string representation of this range |
|
|