|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ahmadsoft.ropes.impl.AbstractRope
public abstract class AbstractRope
Abstract base class for ropes that implements many of the common operations.
Field Summary |
---|
Fields inherited from interface org.ahmadsoft.ropes.Rope |
---|
BUILDER |
Constructor Summary | |
---|---|
AbstractRope()
|
Method Summary | |
---|---|
Rope |
append(char c)
Returns a new rope created by appending the specified character to this rope. |
Rope |
append(java.lang.CharSequence suffix)
Returns a new rope created by appending the specified character sequence to this rope. |
Rope |
append(java.lang.CharSequence csq,
int start,
int end)
Returns a new rope created by appending the specified character range to this rope. |
int |
compareTo(java.lang.CharSequence sequence)
|
Rope |
delete(int start,
int end)
Creats a new rope by delete the specified character substring. |
abstract byte |
depth()
|
boolean |
equals(java.lang.Object other)
|
int |
hashCode()
|
int |
indexOf(char ch)
Returns the index within this rope of the first occurrence of the specified character. |
int |
indexOf(char ch,
int fromIndex)
Returns the index within this rope of the first occurrence of the specified character, beginning at the specified index. |
int |
indexOf(java.lang.CharSequence sequence)
Returns the index within this rope of the first occurrence of the specified string. |
int |
indexOf(java.lang.CharSequence sequence,
int fromIndex)
Returns the index within this rope of the first occurrence of the specified string, beginning at the specified index. |
Rope |
insert(int dstOffset,
java.lang.CharSequence s)
Creates a new rope by inserting the specified CharSequence
into this rope. |
java.util.Iterator<java.lang.Character> |
iterator()
|
Rope |
ltrim()
Trims all whitespace as well as characters less than 0x20 from the beginning of this string. |
java.util.regex.Matcher |
matcher(java.util.regex.Pattern pattern)
Creates a matcher that will match this rope against the specified pattern. |
boolean |
matches(java.util.regex.Pattern regex)
Returns true if this rope matches the specified
Pattern , or false otherwise. |
boolean |
matches(java.lang.String regex)
Returns true if this rope matches the specified
regular expression, or false otherwise. |
Rope |
rebalance()
Rebalances the current rope, returning the rebalanced rope. |
java.util.Iterator<java.lang.Character> |
reverseIterator()
Returns a reverse iterator positioned to start at the end of this rope. |
Rope |
rtrim()
Trims all whitespace as well as characters less than 0x20 from
the end of this string. |
java.lang.String |
toString()
|
Rope |
trim()
Trims all whitespace as well as characters less than 0x20 from
the beginnning and end of this string. |
java.lang.Object |
writeReplace()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.ahmadsoft.ropes.Rope |
---|
iterator, reverse, reverseIterator, subSequence, write, write |
Methods inherited from interface java.lang.CharSequence |
---|
charAt, length |
Constructor Detail |
---|
public AbstractRope()
Method Detail |
---|
public Rope append(char c)
Rope
append
in interface Rope
c
- the specified character.
public Rope append(java.lang.CharSequence suffix)
Rope
append
in interface Rope
suffix
- the specified suffix.
public Rope append(java.lang.CharSequence csq, int start, int end)
Rope
append
in interface Rope
csq
- the specified character.start
- the start index, inclusive.end
- the end index, non-inclusive.
public int compareTo(java.lang.CharSequence sequence)
compareTo
in interface java.lang.Comparable<java.lang.CharSequence>
public Rope delete(int start, int end)
Rope
start
and extends to
the character at index end - 1
or to the end of the
sequence if no such character exists. If
start
is equal to end
, no changes are made.
delete
in interface Rope
start
- The beginning index, inclusive.end
- The ending index, exclusive.
public abstract byte depth()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int indexOf(char ch)
Rope
ch
occurs
in the character sequence represented by this Rope
object, then the index of the first such occurrence is returned --
that is, the smallest value k such that:
this.charAt(k) == ch
is true
. If no such character occurs in this string, then
-1
is returned.
indexOf
in interface Rope
ch
- a character.
-1
if the character
does not occur.public int indexOf(char ch, int fromIndex)
Rope
ch
occurs in the character sequence
represented by this Rope
object, then the index of the
first such occurrence is returned—that is, the smallest value k
such that:
this.charAt(k) == ch
is true
. If no such character occurs in this string, then
-1
is returned.
indexOf
in interface Rope
ch
- a character.fromIndex
- the index to start searching from.
public int indexOf(java.lang.CharSequence sequence)
Rope
this.startsWith(str, k)If no such k exists, then -1 is returned.
indexOf
in interface Rope
sequence
- the string to find.
public int indexOf(java.lang.CharSequence sequence, int fromIndex)
Rope
k >= fromIndex && this.startsWith(str, k)If no such k exists, then -1 is returned.
indexOf
in interface Rope
sequence
- the string to find.fromIndex
- the index to start searching from.
public Rope insert(int dstOffset, java.lang.CharSequence s)
Rope
CharSequence
into this rope.
The characters of the CharSequence
argument are inserted,
in order, into this rope at the indicated offset.
If s
is null
, then the four characters
"null"
are inserted into this sequence.
insert
in interface Rope
dstOffset
- the offset.s
- the sequence to be inserted
public java.util.Iterator<java.lang.Character> iterator()
iterator
in interface java.lang.Iterable<java.lang.Character>
public Rope ltrim()
Rope
ltrim
in interface Rope
public java.util.regex.Matcher matcher(java.util.regex.Pattern pattern)
Rope
Matcher m = pattern.matcher(this);The difference may be asymptotically better in many cases.
matcher
in interface Rope
pattern
- the pattern to match this rope against.
public boolean matches(java.util.regex.Pattern regex)
Rope
true
if this rope matches the specified
Pattern
, or false
otherwise.
matches
in interface Rope
regex
- the specified regular expression.
true
if this rope matches the specified
Pattern
, or false
otherwise.Pattern
public boolean matches(java.lang.String regex)
Rope
true
if this rope matches the specified
regular expression, or false
otherwise.
matches
in interface Rope
regex
- the specified regular expression.
true
if this rope matches the specified
regular expression, or false
otherwise.Pattern
public Rope rebalance()
Rope
rebalance
in interface Rope
public java.util.Iterator<java.lang.Character> reverseIterator()
Rope
reverseIterator
in interface Rope
Rope.reverseIterator(int)
public Rope rtrim()
Rope
0x20
from
the end of this string.
rtrim
in interface Rope
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public Rope trim()
Rope
0x20
from
the beginnning and end of this string.
trim
in interface Rope
public java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |