Javolution 6.0.0 java
|
Public Member Functions | |
Text (String str) | |
int | length () |
Text | plus (Object obj) |
Text | plus (String str) |
Text | concat (Text that) |
Text | subtext (int start) |
Text | insert (int index, Text txt) |
Text | delete (int start, int end) |
Text | replace (java.lang.CharSequence target, java.lang.CharSequence replacement) |
Text | replace (CharSet charSet, java.lang.CharSequence replacement) |
java.lang.CharSequence | subSequence (int start, int end) |
int | indexOf (java.lang.CharSequence csq) |
int | indexOf (java.lang.CharSequence csq, int fromIndex) |
int | lastIndexOf (java.lang.CharSequence csq) |
int | lastIndexOf (java.lang.CharSequence csq, int fromIndex) |
boolean | startsWith (java.lang.CharSequence prefix) |
boolean | endsWith (java.lang.CharSequence suffix) |
boolean | startsWith (java.lang.CharSequence prefix, int index) |
Text | trim () |
Text | intern () |
boolean | contentEquals (java.lang.CharSequence csq) |
boolean | contentEqualsIgnoreCase (java.lang.CharSequence csq) |
boolean | equals (Object obj) |
int | hashCode () |
int | compareTo (CharSequence csq) |
Text | toText () |
void | printStatistics (PrintStream out) |
Text | toLowerCase () |
Text | toUpperCase () |
char | charAt (int index) |
int | indexOf (char c) |
int | indexOf (char c, int fromIndex) |
int | lastIndexOf (char c, int fromIndex) |
Text | subtext (int start, int end) |
void | getChars (int start, int end, char dest[], int destPos) |
String | toString () |
Text | copy () |
boolean | isBlank () |
boolean | isBlank (int start, int length) |
Text | trimStart () |
Text | trimEnd () |
Text | padLeft (int len) |
Text | padLeft (int len, char c) |
Text | padRight (int len) |
Text | padRight (int len, char c) |
int | indexOfAny (CharSet charSet) |
int | indexOfAny (CharSet charSet, int start) |
int | indexOfAny (CharSet charSet, int start, int length) |
int | lastIndexOfAny (CharSet charSet) |
int | lastIndexOfAny (CharSet charSet, int start) |
int | lastIndexOfAny (CharSet charSet, int start, int length) |
Text | value () |
Static Public Member Functions | |
static Text | valueOf (Object obj) |
static Text | valueOf (char[] chars) |
static Text | valueOf (char[] chars, int offset, int length) |
static Text | valueOf (boolean b) |
static Text | valueOf (char c) |
static Text | valueOf (int i) |
static Text | valueOf (int i, int radix) |
static Text | valueOf (long l) |
static Text | valueOf (long l, int radix) |
static Text | valueOf (float f) |
static Text | valueOf (double d) |
static Text | valueOf (double d, int digits, boolean scientific, boolean showZero) |
static Text | valueOf (char c, int length) |
Static Public Attributes | |
static final Text | EMPTY = new Text("").intern() |
Static Package Functions | |
static Text | valueOf (TextBuilder tb, int start, int end) |
Private Member Functions | |
Text (boolean isPrimitive) | |
Text | append (String str) |
Text | rightRotation () |
Text | leftRotation () |
int | getDepth () |
int | getNbrOfBranches () |
int | getNbrOfLeaves () |
Static Private Member Functions | |
static Text | valueOf (String str) |
static Text | valueOf (String str, int start, int end) |
static Text | newPrimitive (int length) |
static Text | newComposite (Text head, Text tail) |
Private Attributes | |
final char[] | _data |
int | _count |
Text | _head |
Text | _tail |
Static Private Attributes | |
static final long | serialVersionUID = 0x600L |
static final int | BLOCK_SIZE = 1 << 5 |
static final int | BLOCK_MASK = ~(BLOCK_SIZE - 1) |
static final FastMap< Text, Text > | INTERN |
static final Text | TRUE = new Text("true").intern() |
static final Text | FALSE = new Text("false").intern() |
An immutable character sequence with fast concatenation, insertion and deletion capabilities (O[Log(n)]) instead of O[n] for StringBuffer/StringBuilder).
This class has the same methods as Java String and .NET String with the following benefits:
java.lang.String
or CharSequence
. Text literals should be explicitly interned. Unlike strings literals and strings-value constant expressions, interning is not implicit. For example:[code] final static Text TRUE = new Text("true").intern(); final static Text FALSE = new Text("true").intern("false"); [/code]
Implementation Note: To avoid expensive copy operations , Text instances are broken down into smaller immutable sequences, they form a minimal-depth binary tree. The tree is maintained balanced automatically through tree rotations. Insertion/deletions are performed in O[Log(n)]
instead of O[n]
for StringBuffer/StringBuilder
.
|
private |
Creates a new text instance.
isPrimitive | indicates if primitive or composite. |
Definition at line 112 of file Text.java.
References javolution.text.Text._data, and javolution.text.Text.BLOCK_SIZE.
Referenced by javolution.text.Text.equals(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.Text().
javolution.text.Text.Text | ( | String | str | ) |
Creates a text holding the characters from the specified String
.
str | the string holding the character content. |
Definition at line 122 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.BLOCK_MASK, javolution.text.Text.BLOCK_SIZE, and javolution.text.Text.Text().
|
private |
Definition at line 374 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.append(), javolution.text.Text.BLOCK_SIZE, javolution.text.Text.getChars(), javolution.text.Text.length(), javolution.text.Text.newComposite(), and javolution.text.Text.newPrimitive().
Referenced by javolution.text.Text.append(), and javolution.text.Text.plus().
char javolution.text.Text.charAt | ( | int | index | ) |
Returns the character at the specified index.
index | the index of the character. |
IndexOutOfBoundsException | if (index < 0) || (index >= this.length()) |
Definition at line 897 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.charAt().
Referenced by javolution.text.Text.charAt(), javolution.text.Text.contentEquals(), javolution.text.Text.contentEqualsIgnoreCase(), javolution.text.Text.equals(), javolution.text.Text.hashCode(), javolution.text.Text.indexOf(), javolution.text.Text.indexOfAny(), javolution.text.Text.isBlank(), javolution.text.Text.lastIndexOf(), javolution.text.Text.lastIndexOfAny(), javolution.text.Text.trim(), javolution.text.Text.trimEnd(), and javolution.text.Text.trimStart().
int javolution.text.Text.compareTo | ( | CharSequence | csq | ) |
Compares this text to another character sequence or string lexicographically.
csq | the character sequence to be compared. |
TypeFormat.LEXICAL_COMPARATOR.compare(this, csq)
ClassCastException | if the specifed object is not a CharSequence or a String . |
Definition at line 808 of file Text.java.
References javolution.util.function.Equality< T >.compare(), and javolution.util.function.Equalities.LEXICAL.
Concatenates the specified text to the end of this text. This method is very fast (faster even than StringBuffer.append(String)
) and still returns a text instance with an internal binary tree of minimal depth!
that | the text that is concatenated. |
this + that
Definition at line 398 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.BLOCK_SIZE, javolution.text.Text.concat(), javolution.text.Text.getChars(), javolution.text.Text.leftRotation(), javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.rightRotation().
Referenced by javolution.text.Text.concat(), javolution.text.Text.delete(), javolution.text.Text.insert(), javolution.text.Text.padRight(), javolution.text.Text.plus(), javolution.text.Text.replace(), and javolution.text.Text.subtext().
boolean javolution.text.Text.contentEquals | ( | java.lang.CharSequence | csq | ) |
Indicates if this text has the same character content as the specified character sequence.
csq | the character sequence to compare with. |
true
if the specified character sequence has the same character content as this text; false
otherwise. Definition at line 720 of file Text.java.
References javolution.text.Text._count, and javolution.text.Text.charAt().
boolean javolution.text.Text.contentEqualsIgnoreCase | ( | java.lang.CharSequence | csq | ) |
Indicates if this text has the same character contend as the specified character sequence ignoring case considerations.
csq | the CharSequence to compare this text against. |
true
if the argument and this text are equal, ignoring case; false
otherwise. Definition at line 738 of file Text.java.
References javolution.text.Text._count, and javolution.text.Text.charAt().
Text javolution.text.Text.copy | ( | ) |
Definition at line 1056 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.copy(), javolution.text.Text.newComposite(), and javolution.text.Text.newPrimitive().
Referenced by javolution.text.Text.copy().
Text javolution.text.Text.delete | ( | int | start, |
int | end | ||
) |
Returns the text without the characters between the specified indexes.
start | the beginning index, inclusive. |
end | the ending index, exclusive. |
subtext(0, start).concat(subtext(end))
IndexOutOfBoundsException | if (start < 0) || (end < 0) || (start > end) || (end > this.length() |
Definition at line 493 of file Text.java.
References javolution.text.Text.concat(), and javolution.text.Text.subtext().
boolean javolution.text.Text.endsWith | ( | java.lang.CharSequence | suffix | ) |
Indicates if this text ends with the specified suffix.
suffix | the suffix. |
true
if the character sequence represented by the argument is a suffix of the character sequence represented by this text; false
otherwise. Definition at line 657 of file Text.java.
References javolution.text.Text.length(), and javolution.text.Text.startsWith().
boolean javolution.text.Text.equals | ( | Object | obj | ) |
Compares this text against the specified object for equality. Returns true
if the specified object is a text having the same character sequence as this text. For generic comparaison with any character sequence the contentEquals(CharSequence) should be used.
obj | the object to compare with or null . |
true
if that is a text with the same character sequence as this text; false
otherwise. Definition at line 769 of file Text.java.
References javolution.text.Text._count, javolution.text.Text.charAt(), and javolution.text.Text.Text().
void javolution.text.Text.getChars | ( | int | start, |
int | end, | ||
char | dest[], | ||
int | destPos | ||
) |
Copies the characters from this text into the destination character array.
start | the index of the first character to copy. |
end | the index after the last character to copy. |
dest | the destination array. |
destPos | the start offset in the destination array. |
IndexOutOfBoundsException | if (start < 0) || (end < 0) || (start > end) || (end > this.length()) |
Definition at line 1022 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.getChars().
Referenced by javolution.text.TextBuilder.append(), javolution.text.Text.append(), javolution.text.Text.concat(), javolution.text.Text.getChars(), javolution.io.CharSequenceReader.read(), and javolution.text.Text.toString().
|
private |
Definition at line 841 of file Text.java.
References javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.getDepth(), and javolution.lang.MathLib.max().
Referenced by javolution.text.Text.getDepth(), and javolution.text.Text.printStatistics().
|
private |
Definition at line 847 of file Text.java.
References javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.getNbrOfBranches().
Referenced by javolution.text.Text.getNbrOfBranches(), and javolution.text.Text.printStatistics().
|
private |
Definition at line 852 of file Text.java.
References javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.getNbrOfLeaves().
Referenced by javolution.text.Text.getNbrOfLeaves(), and javolution.text.Text.printStatistics().
int javolution.text.Text.hashCode | ( | ) |
Returns the hash code for this text.
Definition at line 790 of file Text.java.
References javolution.text.Text.charAt(), and javolution.text.Text.length().
int javolution.text.Text.indexOf | ( | char | c | ) |
Returns the index within this text of the first occurrence of the specified character, starting the search at the beginning.
c | the character to search for. |
0
, or -1
if the character does not occur. Definition at line 913 of file Text.java.
References javolution.text.Text.indexOf().
int javolution.text.Text.indexOf | ( | char | c, |
int | fromIndex | ||
) |
Returns the index within this text of the first occurrence of the specified character, starting the search at the specified index.
c | the character to search for. |
fromIndex | the index to start the search from. |
fromIndex
, or -1
if the character does not occur. Definition at line 927 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.indexOf(), and javolution.lang.MathLib.max().
int javolution.text.Text.indexOf | ( | java.lang.CharSequence | csq | ) |
Returns the index within this text of the first occurrence of the specified character sequence searching forward.
csq | a character sequence. |
-1
if the character sequence is not found. Definition at line 552 of file Text.java.
Referenced by javolution.text.Text.indexOf(), and javolution.text.Text.replace().
int javolution.text.Text.indexOf | ( | java.lang.CharSequence | csq, |
int | fromIndex | ||
) |
Returns the index within this text of the first occurrence of the specified characters sequence searching forward from the specified index.
csq | a character sequence. |
fromIndex | the index to start the search from. |
[fromIndex, length() - csq.length()]
or -1
if the character sequence is not found. Definition at line 567 of file Text.java.
References javolution.text.Text._count, javolution.text.Text.charAt(), and javolution.text.Text.indexOf().
int javolution.text.Text.indexOfAny | ( | CharSet | charSet | ) |
Returns the index within this text of the first occurrence of any character in the specified character set.
charSet | the character set. |
-1
if none. Definition at line 1220 of file Text.java.
References javolution.text.Text.length().
Referenced by javolution.text.Text.indexOfAny(), and javolution.text.Text.replace().
int javolution.text.Text.indexOfAny | ( | CharSet | charSet, |
int | start | ||
) |
Returns the index within a region of this text of the first occurrence of any character in the specified character set.
charSet | the character set. |
start | the index of the start of the search region in this text. |
-1
if none. Definition at line 1233 of file Text.java.
References javolution.text.Text.indexOfAny(), and javolution.text.Text.length().
int javolution.text.Text.indexOfAny | ( | CharSet | charSet, |
int | start, | ||
int | length | ||
) |
Returns the index within a region of this text of the first occurrence of any character in the specified character set.
charSet | the character set. |
start | the index of the start of the search region in this text. |
length | the length of the region to search. |
-1
if none. Definition at line 1247 of file Text.java.
References javolution.text.Text.charAt(), javolution.text.CharSet.contains(), and javolution.text.Text.length().
Returns the text having the specified text inserted at the specified location.
index | the insertion position. |
txt | the text being inserted. |
subtext(0, index).concat(txt).concat(subtext(index))
IndexOutOfBoundsException | if (index < 0) || (index > this.length()) |
Definition at line 480 of file Text.java.
References javolution.text.Text.concat(), and javolution.text.Text.subtext().
Referenced by javolution.text.Text.padLeft().
Text javolution.text.Text.intern | ( | ) |
Returns a text equals to this one from a pool of unique text instances.
Definition at line 707 of file Text.java.
References javolution.text.Text.INTERN.
boolean javolution.text.Text.isBlank | ( | ) |
Indicates if all characters of this text are whitespaces (no characters greater than the space character).
true
if this text contains only whitespace. Definition at line 1100 of file Text.java.
References javolution.text.Text.length().
boolean javolution.text.Text.isBlank | ( | int | start, |
int | length | ||
) |
Indicates if the specified sub-range of characters of this text are whitespaces (no characters greater than the space character).
start | the start index. |
length | the number of characters to inspect. |
Definition at line 1111 of file Text.java.
References javolution.text.Text.charAt(), and javolution.text.Text.length().
int javolution.text.Text.lastIndexOf | ( | char | c, |
int | fromIndex | ||
) |
Returns the index within this text of the first occurrence of the specified character, searching backward and starting at the specified index.
c | the character to search for. |
fromIndex | the index to start the search backward from. |
fromIndex
, or -1
if the character does not occur. Definition at line 957 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.lastIndexOf(), and javolution.lang.MathLib.min().
int javolution.text.Text.lastIndexOf | ( | java.lang.CharSequence | csq | ) |
Returns the index within this text of the last occurrence of the specified characters sequence searching backward.
csq | a character sequence. |
-1
if the character sequence is not found. Definition at line 599 of file Text.java.
References javolution.text.Text._count.
Referenced by javolution.text.Text.lastIndexOf().
int javolution.text.Text.lastIndexOf | ( | java.lang.CharSequence | csq, |
int | fromIndex | ||
) |
Returns the index within this text of the last occurrence of the specified character sequence searching backward from the specified index.
csq | a character sequence. |
fromIndex | the index to start the backward search from. |
[0, fromIndex]
or -1
if the character sequence is not found. Definition at line 613 of file Text.java.
References javolution.text.Text._count, javolution.text.Text.charAt(), and javolution.text.Text.lastIndexOf().
int javolution.text.Text.lastIndexOfAny | ( | CharSet | charSet | ) |
Returns the index within this text of the last occurrence of any character in the specified character set.
charSet | the character set. |
-1
if none. Definition at line 1264 of file Text.java.
References javolution.text.Text.length().
Referenced by javolution.text.Text.lastIndexOfAny().
int javolution.text.Text.lastIndexOfAny | ( | CharSet | charSet, |
int | start | ||
) |
Returns the index within a region of this text of the last occurrence of any character in the specified character set.
charSet | the character set. |
start | the index of the start of the search region in this text. |
-1
if none. Definition at line 1277 of file Text.java.
References javolution.text.Text.lastIndexOfAny(), and javolution.text.Text.length().
int javolution.text.Text.lastIndexOfAny | ( | CharSet | charSet, |
int | start, | ||
int | length | ||
) |
Returns the index within a region of this text of the last occurrence of any character in the specified character set.
charSet | the character set. |
start | the index of the start of the search region in this text. |
length | the length of the region to search. |
-1
if none. Definition at line 1291 of file Text.java.
References javolution.text.Text.charAt(), javolution.text.CharSet.contains(), and javolution.text.Text.length().
|
private |
Definition at line 447 of file Text.java.
References javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.newComposite().
Referenced by javolution.text.Text.concat().
int javolution.text.Text.length | ( | ) |
Returns the length of this text.
Definition at line 346 of file Text.java.
References javolution.text.Text._count.
Referenced by javolution.text.TextBuilder.append(), javolution.text.Text.append(), javolution.text.Text.concat(), javolution.text.Text.endsWith(), javolution.text.Text.hashCode(), javolution.text.Text.indexOfAny(), javolution.text.Text.isBlank(), javolution.text.Text.lastIndexOfAny(), javolution.text.Text.newPrimitive(), javolution.text.Text.padLeft(), javolution.text.Text.padRight(), javolution.text.Text.printStatistics(), javolution.text.Text.startsWith(), javolution.text.Text.subtext(), javolution.text.Text.trim(), javolution.text.Text.trimEnd(), javolution.text.Text.trimStart(), and javolution.text.Text.valueOf().
Returns a context allocated composite text instance.
head | the composite head. |
tail | the composite tail. |
Definition at line 1320 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.Text().
Referenced by javolution.text.Text.append(), javolution.text.Text.concat(), javolution.text.Text.copy(), javolution.text.Text.leftRotation(), javolution.text.Text.rightRotation(), javolution.text.Text.toLowerCase(), javolution.text.Text.toUpperCase(), and javolution.text.Text.valueOf().
|
staticprivate |
Returns a context allocated primitive text instance.
length | the primitive length. |
Definition at line 1307 of file Text.java.
References javolution.text.Text._count, javolution.text.Text.length(), and javolution.text.Text.Text().
Referenced by javolution.text.Text.append(), javolution.text.Text.concat(), javolution.text.Text.copy(), javolution.text.Text.subtext(), javolution.text.Text.toLowerCase(), javolution.text.Text.toUpperCase(), and javolution.text.Text.valueOf().
Text javolution.text.Text.padLeft | ( | int | len | ) |
Pads this text on the left with spaces to make the minimum total length as specified. The new length of the new text is equal to the original length plus (length()-len)
spaces.
len | the total number of characters to make this text equal to. |
an | IllegalArgumentException if the (len<0) . |
Text javolution.text.Text.padLeft | ( | int | len, |
char | c | ||
) |
Pads this text on the left to make the minimum total length as specified. Spaces or the given Unicode character are used to pad with.
The new length of the new text is equal to the original length plus (length()-len)
pad characters.
len | the total number of characters to make this text equal to. |
c | the character to pad using. |
an | IllegalArgumentException if the (len<0) . |
Definition at line 1176 of file Text.java.
References javolution.text.Text.insert(), javolution.text.Text.length(), and javolution.text.Text.valueOf().
Text javolution.text.Text.padRight | ( | int | len | ) |
Pads this text on the right with spaces to make the minimum total length as specified. The new length of the new text is equal to the original length plus (length()-len)
spaces.
len | the total number of characters to make this text equal to. |
an | IllegalArgumentException if the (len<0) . |
Text javolution.text.Text.padRight | ( | int | len, |
char | c | ||
) |
Pads this text on the right to make the minimum total length as specified. Spaces or the given Unicode character are used to pad with.
The new length of the new text is equal to the original length plus (length()-len)
pad characters.
len | the total number of characters to make this text equal to. |
c | the character to pad using. |
an | IllegalArgumentException if the (len<0) . |
Definition at line 1207 of file Text.java.
References javolution.text.Text.concat(), javolution.text.Text.length(), and javolution.text.Text.valueOf().
Text javolution.text.Text.plus | ( | Object | obj | ) |
Returns the concatenation of this text and the textual representation of the specified object.
obj | the object whose textual representation is concatenated. |
this.concat(Text.valueOf(obj))
Definition at line 357 of file Text.java.
References javolution.text.Text.concat(), and javolution.text.Text.valueOf().
Text javolution.text.Text.plus | ( | String | str | ) |
Returns the concatenation of this text and the specified String
(optimization).
str | the string whose characters are concatenated. |
this.concat(Text.valueOf(obj))
Definition at line 368 of file Text.java.
References javolution.text.Text.append(), javolution.text.Text.concat(), and javolution.text.Text.valueOf().
void javolution.text.Text.printStatistics | ( | PrintStream | out | ) |
Prints the current statistics on this text tree structure.
out | the stream to use for output (e.g. System.out ) |
Definition at line 827 of file Text.java.
References javolution.text.Text.getDepth(), javolution.text.Text.getNbrOfBranches(), javolution.text.Text.getNbrOfLeaves(), and javolution.text.Text.length().
Replaces the specified characters in this text with the specified replacement sequence.
charSet | the set of characters to be replaced. |
replacement | the replacement sequence. |
Definition at line 524 of file Text.java.
References javolution.text.Text.concat(), javolution.text.Text.indexOfAny(), javolution.text.Text.replace(), javolution.text.Text.subtext(), and javolution.text.Text.valueOf().
Text javolution.text.Text.replace | ( | java.lang.CharSequence | target, |
java.lang.CharSequence | replacement | ||
) |
Replaces each character sequence of this text that matches the specified target sequence with the specified replacement sequence.
target | the character sequence to be replaced. |
replacement | the replacement sequence. |
Definition at line 507 of file Text.java.
References javolution.text.Text.concat(), javolution.text.Text.indexOf(), javolution.text.Text.replace(), javolution.text.Text.subtext(), and javolution.text.Text.valueOf().
Referenced by javolution.text.Text.replace().
|
private |
Definition at line 436 of file Text.java.
References javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, and javolution.text.Text.newComposite().
Referenced by javolution.text.Text.concat().
boolean javolution.text.Text.startsWith | ( | java.lang.CharSequence | prefix | ) |
Indicates if this text starts with the specified prefix.
prefix | the prefix. |
true
if the character sequence represented by the argument is a prefix of the character sequence represented by this text; false
otherwise. Definition at line 645 of file Text.java.
Referenced by javolution.text.Text.endsWith().
boolean javolution.text.Text.startsWith | ( | java.lang.CharSequence | prefix, |
int | index | ||
) |
Indicates if this text starts with the specified prefix at the specified index.
prefix | the prefix. |
index | the index of the prefix location in this string. |
this.substring(index).startsWith(prefix)
Definition at line 669 of file Text.java.
References javolution.text.Text.length().
java.lang.CharSequence javolution.text.Text.subSequence | ( | int | start, |
int | end | ||
) |
Returns subtext(start, end).
start | the index of the first character inclusive. |
end | the index of the last character exclusive. |
this.subtext(start, end)
IndexOutOfBoundsException | if (start < 0) || (end < 0) || (start > end) || (end > this.length()) |
Definition at line 540 of file Text.java.
References javolution.text.Text.subtext().
Text javolution.text.Text.subtext | ( | int | start | ) |
Returns a portion of this text.
start | the index of the first character inclusive. |
IndexOutOfBoundsException | if (start < 0) || (start > this.length()) |
Definition at line 466 of file Text.java.
References javolution.text.Text.length().
Referenced by javolution.text.Text.delete(), javolution.text.Text.insert(), javolution.text.Text.replace(), javolution.text.Text.subSequence(), javolution.text.Text.subtext(), javolution.text.Text.trim(), javolution.text.Text.trimEnd(), and javolution.text.Text.trimStart().
Text javolution.text.Text.subtext | ( | int | start, |
int | end | ||
) |
Returns a portion of this text.
start | the index of the first character inclusive. |
end | the index of the last character exclusive. |
IndexOutOfBoundsException | if (start < 0) || (end < 0) || (start > end) || (end > this.length()) |
Definition at line 985 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.concat(), javolution.text.Text.EMPTY, javolution.text.Text.length(), javolution.text.Text.newPrimitive(), and javolution.text.Text.subtext().
Text javolution.text.Text.toLowerCase | ( | ) |
Converts the characters of this text to lower case.
Definition at line 863 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.toLowerCase().
Referenced by javolution.text.Text.toLowerCase().
String javolution.text.Text.toString | ( | ) |
Returns the String
representation of this text.
java.lang.String
for this text. Definition at line 1045 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, and javolution.text.Text.getChars().
Text javolution.text.Text.toText | ( | ) |
Text javolution.text.Text.toUpperCase | ( | ) |
Converts the characters of this text to upper case.
Definition at line 879 of file Text.java.
References javolution.text.Text._count, javolution.text.Text._data, javolution.text.Text._head, javolution.text.Text._tail, javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.toUpperCase().
Referenced by javolution.text.Text.toUpperCase().
Text javolution.text.Text.trim | ( | ) |
Returns a copy of this text, with leading and trailing whitespace omitted.
Definition at line 689 of file Text.java.
References javolution.text.Text.charAt(), javolution.text.Text.length(), and javolution.text.Text.subtext().
Text javolution.text.Text.trimEnd | ( | ) |
Returns a copy of this text, with trailing whitespace omitted.
Definition at line 1141 of file Text.java.
References javolution.text.Text.charAt(), javolution.text.Text.length(), and javolution.text.Text.subtext().
Text javolution.text.Text.trimStart | ( | ) |
Returns a copy of this text, with leading whitespace omitted.
Definition at line 1125 of file Text.java.
References javolution.text.Text.charAt(), javolution.text.Text.length(), and javolution.text.Text.subtext().
Text javolution.text.Text.value | ( | ) |
|
static |
Returns the text representation of the boolean
argument.
b | a boolean . |
true
, the text "true"
is returned; otherwise, the text "false"
is returned. Definition at line 226 of file Text.java.
References javolution.text.Text.FALSE, and javolution.text.Text.TRUE.
|
static |
Returns the text instance corresponding to the specified character.
c | a character. |
1
containing 'c'
. Definition at line 240 of file Text.java.
References javolution.text.Text._data, and javolution.text.Text.newPrimitive().
|
static |
Returns the text that contains a specific length sequence of the character specified.
c | the character to fill this text with. |
length | the length of the text returned. |
IndexOutOfBoundsException | if (length < 0) |
Definition at line 1078 of file Text.java.
References javolution.text.Text._data, javolution.text.Text.BLOCK_SIZE, javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.valueOf().
|
static |
Returns the text that contains the characters from the specified array.
chars | the array source of the characters. |
Definition at line 168 of file Text.java.
References javolution.text.Text.valueOf().
|
static |
Returns the text that contains the characters from the specified subarray of characters.
chars | the source of the characters. |
offset | the index of the first character in the data soure. |
length | the length of the text returned. |
IndexOutOfBoundsException | if (offset < 0) || (length < 0) || ((offset + length) > chars.length) |
Definition at line 183 of file Text.java.
References javolution.text.Text._data, javolution.text.Text.BLOCK_MASK, javolution.text.Text.BLOCK_SIZE, javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.valueOf().
|
static |
Returns the textual representation of the specified double
argument.
d | the double to format. |
Definition at line 315 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the textual representation of the specified double
argument formatted as specified.
d | the double to format. |
digits | the number of significative digits (excludes exponent) or -1 to mimic the standard library (16 or 17 digits). |
scientific | true to forces the use of the scientific notation (e.g. 1.23E3 ); false otherwise. |
showZero | true if trailing fractional zeros are represented; false otherwise. |
IllegalArgumentException | if (digits > 19) ) |
Definition at line 335 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the textual representation of the specified float
instance.
f | the float to format. |
Definition at line 303 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the decimal representation of the specified int
argument.
i | the int to format. |
Definition at line 253 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the radix representation of the specified int
argument.
i | the int to format. |
radix | the radix (e.g. 16 for hexadecimal). |
Definition at line 266 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the decimal representation of the specified long
argument.
l | the long to format. |
Definition at line 278 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the radix representation of the specified long
argument.
l | the long to format. |
radix | the radix (e.g. 16 for hexadecimal). |
Definition at line 291 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
|
static |
Returns the text representing the specified object.
obj | the object to represent as text. |
Definition at line 140 of file Text.java.
References javolution.text.TextBuilder.append(), and javolution.text.TextBuilder.toText().
Referenced by javolution.text.Text.padLeft(), javolution.text.Text.padRight(), javolution.text.Text.plus(), javolution.text.Text.replace(), javolution.text.TextBuilder.subSequence(), javolution.text.TextBuilder.toText(), javolution.text.Text.valueOf(), and javolution.io.AppendableWriter.write().
|
staticprivate |
Definition at line 144 of file Text.java.
References javolution.text.Text.valueOf().
|
staticprivate |
Definition at line 148 of file Text.java.
References javolution.text.Text._data, javolution.text.Text.BLOCK_MASK, javolution.text.Text.BLOCK_SIZE, javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.valueOf().
|
staticpackage |
Converts a text builder to a text instance (optimization for TextBuilder.toText()).
start | the index of the first character inclusive. |
end | the index of the last character exclusive. |
Definition at line 205 of file Text.java.
References javolution.text.Text._data, javolution.text.Text.BLOCK_MASK, javolution.text.Text.BLOCK_SIZE, javolution.text.TextBuilder.getChars(), javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), and javolution.text.Text.valueOf().
|
private |
Holds the total number of characters.
Definition at line 95 of file Text.java.
Referenced by javolution.text.Text.append(), javolution.text.Text.charAt(), javolution.text.Text.concat(), javolution.text.Text.contentEquals(), javolution.text.Text.contentEqualsIgnoreCase(), javolution.text.Text.copy(), javolution.text.Text.equals(), javolution.text.Text.getChars(), javolution.text.Text.indexOf(), javolution.text.Text.lastIndexOf(), javolution.text.Text.length(), javolution.text.Text.newComposite(), javolution.text.Text.newPrimitive(), javolution.text.Text.subtext(), javolution.text.Text.Text(), javolution.text.Text.toLowerCase(), javolution.text.Text.toString(), and javolution.text.Text.toUpperCase().
|
private |
Holds the raw data (primitive) or null
(composite).
Definition at line 90 of file Text.java.
Referenced by javolution.text.Text.append(), javolution.text.Text.charAt(), javolution.text.Text.concat(), javolution.text.Text.copy(), javolution.text.Text.getChars(), javolution.text.Text.getDepth(), javolution.text.Text.getNbrOfBranches(), javolution.text.Text.getNbrOfLeaves(), javolution.text.Text.indexOf(), javolution.text.Text.lastIndexOf(), javolution.text.Text.leftRotation(), javolution.text.Text.rightRotation(), javolution.text.Text.subtext(), javolution.text.Text.Text(), javolution.text.Text.toLowerCase(), javolution.text.Text.toString(), javolution.text.Text.toUpperCase(), and javolution.text.Text.valueOf().
|
private |
Holds the head block of character (composite).
Definition at line 100 of file Text.java.
Referenced by javolution.text.Text.append(), javolution.text.Text.charAt(), javolution.text.Text.concat(), javolution.text.Text.copy(), javolution.text.Text.getChars(), javolution.text.Text.getDepth(), javolution.text.Text.getNbrOfBranches(), javolution.text.Text.getNbrOfLeaves(), javolution.text.Text.indexOf(), javolution.text.Text.lastIndexOf(), javolution.text.Text.leftRotation(), javolution.text.Text.newComposite(), javolution.text.Text.rightRotation(), javolution.text.Text.subtext(), javolution.text.Text.Text(), javolution.text.Text.toLowerCase(), and javolution.text.Text.toUpperCase().
|
private |
Holds the tail block of character (composite).
Definition at line 105 of file Text.java.
Referenced by javolution.text.Text.append(), javolution.text.Text.charAt(), javolution.text.Text.concat(), javolution.text.Text.copy(), javolution.text.Text.getChars(), javolution.text.Text.getDepth(), javolution.text.Text.getNbrOfBranches(), javolution.text.Text.getNbrOfLeaves(), javolution.text.Text.indexOf(), javolution.text.Text.lastIndexOf(), javolution.text.Text.leftRotation(), javolution.text.Text.newComposite(), javolution.text.Text.rightRotation(), javolution.text.Text.subtext(), javolution.text.Text.Text(), javolution.text.Text.toLowerCase(), and javolution.text.Text.toUpperCase().
|
staticprivate |
Holds the mask used to ensure a block boundary cesures.
Definition at line 74 of file Text.java.
Referenced by javolution.text.Text.Text(), and javolution.text.Text.valueOf().
|
staticprivate |
Holds the default size for primitive blocks of characters.
Definition at line 69 of file Text.java.
Referenced by javolution.text.Text.append(), javolution.text.Text.concat(), javolution.text.Text.Text(), and javolution.text.Text.valueOf().
Holds an empty character sequence.
Definition at line 85 of file Text.java.
Referenced by javolution.text.Text.subtext().
Definition at line 232 of file Text.java.
Referenced by javolution.text.Text.valueOf().
Holds the texts interned in immortal memory.
Definition at line 79 of file Text.java.
Referenced by javolution.text.Text.intern().
|
staticprivate |
Definition at line 230 of file Text.java.
Referenced by javolution.text.Text.valueOf().