|
J avolution v5.3 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.text.CharArray
public final class CharArray
This class represents a CharSequence
backed up by a char array. Instances of this class are
typically used/reused to provide CharSequence views
over existing character buffers.
Instances of this classes have the following properties:
CharSequence (e.g. String).String and can be
used to retrieve data from maps for which the keys are
String instances.Boolean, int).
| Constructor Summary | |
|---|---|
CharArray()
Default constructor (empty character array). |
|
CharArray(int capacity)
Creates a character array of specified default capacity. |
|
CharArray(java.lang.String string)
Creates a character array from the specified String. |
|
| Method Summary | |
|---|---|
char[] |
array()
Returns the underlying array. |
char |
charAt(int index)
|
int |
compareTo(java.lang.Object seq)
Compares this character array with the specified character sequence lexicographically. |
boolean |
equals(CharArray that)
Compares this character array against the specified CharArray. |
boolean |
equals(java.lang.Object that)
Compares this character sequence against the specified object ( String or CharSequence). |
boolean |
equals(java.lang.String str)
Compares this character array against the specified String. |
void |
getChars(int start,
int end,
char[] dest,
int destPos)
|
int |
hashCode()
Returns the hash code for this CharArray. |
int |
length()
Returns the length of this character sequence. |
int |
offset()
Returns the offset of the first character in the underlying array. |
int |
offsetOf(char c)
Returns the offset within this character array of the first occurrence of the specified character searching forward from this character array offset() to offset() + length(). |
int |
offsetOf(java.lang.CharSequence csq)
Returns the offset within this character array of the first occurrence of the specified characters sequence searching forward from this character array offset() to offset() + length(). |
CharArray |
setArray(char[] array,
int offset,
int length)
Sets the underlying array of this CharArray. |
java.lang.CharSequence |
subSequence(int start,
int end)
|
boolean |
toBoolean()
Returns the boolean represented by this character array. |
double |
toDouble()
Returns the double represented by this character array. |
float |
toFloat()
Returns the float represented by this character array. |
int |
toInt()
Returns the decimal int represented by this character array. |
int |
toInt(int radix)
Returns the int represented by this character array
in the specified radix. |
long |
toLong()
Returns the decimal long represented by this character
array. |
long |
toLong(int radix)
Returns the decimal long represented by this character
array in the specified radix. |
java.lang.String |
toString()
Returns the String |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CharArray()
public CharArray(int capacity)
capacity - the backing array default capacity.public CharArray(java.lang.String string)
string - the string source.| Method Detail |
|---|
public char[] array()
public int length()
length in interface java.lang.CharSequencepublic int offset()
public CharArray setArray(char[] array,
int offset,
int length)
offset - the new offset.array - the new underlying array.length - the new length.
thispublic final int offsetOf(java.lang.CharSequence csq)
offset() to offset() + length().
csq - a character sequence searched for.
[offset(), offset() + length()[
or -1 if the character sequence is not found.public final int offsetOf(char c)
offset() to offset() + length().
c - the character to search for.
[offset(), offset() + length()[
or -1 if the character is not found.public java.lang.String toString()
String corresponding to this character
sequence. The String returned is always allocated on the
heap and can safely be referenced elsewhere.
- Specified by:
toString in interface java.lang.CharSequence- Overrides:
toString in class java.lang.Object
- Returns:
- the
java.lang.String for this character sequence.
public int hashCode()
CharArray.
Note: Returns the same hashCode as java.lang.String
(consistent with equals(java.lang.Object))
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object that)
String or CharSequence).
equals in class java.lang.Objectthat - the object to compare with.
true if both objects represent the same sequence;
false otherwise.public boolean equals(CharArray that)
CharArray.
that - the character array to compare with.
true if both objects represent the same sequence;
false otherwise.public boolean equals(java.lang.String str)
str - the string to compare with.
true if both objects represent the same sequence;
false otherwise.public int compareTo(java.lang.Object seq)
compareTo in interface java.lang.Comparableseq - the character sequence to be compared.
FastComparator.LEXICAL.compare(this, seq)
java.lang.ClassCastException - if the specifed object is not a
CharSequence.public boolean toBoolean()
boolean represented by this character array.
boolean value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable boolean.public int toInt()
int represented by this character array.
toInt(10)
java.lang.NumberFormatException - if this character sequence
does not contain a parsable int.public int toInt(int radix)
int represented by this character array
in the specified radix.
radix - the radix (e.g. 16 for hexadecimal).
int value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable int.public long toLong()
long represented by this character
array.
long value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable long.public long toLong(int radix)
long represented by this character
array in the specified radix.
radix - the radix (e.g. 16 for hexadecimal).
long value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable long.public float toFloat()
float represented by this character array.
float value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable float.public double toDouble()
double represented by this character array.
double value.
java.lang.NumberFormatException - if this character sequence
does not contain a parsable double.public char charAt(int index)
charAt in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequence
public void getChars(int start,
int end,
char[] dest,
int destPos)
|
J avolution v5.3 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||