public class StringSeq
extends java.lang.Object
implements java.lang.CharSequence
CharSequence
and provides comparable features like String
for commonly usage. The difference to java.lang.String is:
StringBuilder
or such adequate, it does not need an own buffer to hold the string though the StringBuilder's buffer
won't be changed by any other program part. It increases the speed for string operations especially
if there is a large String.
isUnmated
designates whether the char sequence is referred only by this class. This flag should be set and guaranteed
by the user's programming only.
Modifier and Type | Field and Description |
---|---|
protected java.lang.CharSequence |
cs |
protected boolean |
isUnmated
If this flag is set to true, the application declares the referred
cs as only referred from this. |
static int |
version
Version, history and license.
|
Constructor and Description |
---|
StringSeq() |
Modifier and Type | Method and Description |
---|---|
void |
change(java.lang.CharSequence src) |
java.lang.StringBuilder |
changeIt()
Returns a StringBuilder instance which allows the content to change.
|
char |
charAt(int index) |
int |
compareTo(int from1,
java.lang.CharSequence s2,
int from2,
int nrofChars) |
static StringSeq |
create(java.lang.CharSequence src)
An instance of this class can only build by this create method.
|
static StringSeq |
create(java.lang.CharSequence src,
boolean isUnmated)
An instance of this class can only build by this create method.
|
int |
indexOf(char cc,
int fromIndex) |
int |
indexOf(java.lang.CharSequence str,
int fromIndex) |
boolean |
isUnmated() |
int |
length() |
boolean |
startsWith(java.lang.CharSequence cmp) |
java.lang.CharSequence |
subSequence(int start,
int end)
A SubSequence is built as independent String in any case.
|
java.lang.String |
substring(int start)
Compatible to
String.substring(int, int) |
java.lang.String |
substring(int start,
int end)
Same as
subSequence(int, int) but it is compatible to String.substring(int, int) |
java.lang.String |
toString() |
public static final int version
protected java.lang.CharSequence cs
protected boolean isUnmated
cs
as only referred from this.
The CharSequence can be changed only with this instance.public static StringSeq create(java.lang.CharSequence src, boolean isUnmated)
src
- any CharSequence, usual a StringBuilder
.isUnmated
- it should be set to true if the src is not referred anywhere else.public static StringSeq create(java.lang.CharSequence src)
src
- any CharSequence, usual a StringBuilder
. It should be referenced never other.isUnmated
- it should be set to true if the src is not referred anywhere else.public boolean isUnmated()
public void change(java.lang.CharSequence src)
public int length()
length
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
CharSequence.subSequence(int, int)
public java.lang.String substring(int start, int end)
subSequence(int, int)
but it is compatible to String.substring(int, int)
start
- end
- public java.lang.String substring(int start)
String.substring(int, int)
start
- public char charAt(int index)
charAt
in interface java.lang.CharSequence
public int compareTo(int from1, java.lang.CharSequence s2, int from2, int nrofChars)
public boolean startsWith(java.lang.CharSequence cmp)
public int indexOf(char cc, int fromIndex)
public int indexOf(java.lang.CharSequence str, int fromIndex)
public java.lang.StringBuilder changeIt()
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object