gnu.lists

Class CharBuffer

Implemented Interfaces:
CharSeq, CharSequence, java.util.List, Consumable, java.util.List, Sequence
Known Direct Subclasses:
BufferContent

public class CharBuffer
extends StableVector
implements CharSeq

Editable character sequence using a a buffer-gap implementstion and self-adjusting position. Can implement (the text part of) an Emacs buffer, or a javax.swing.text.AbstractDocument.Content

Field Summary

Fields inherited from class gnu.lists.StableVector

FREE_POSITION, free, positions

Fields inherited from class gnu.lists.GapVector

base, gapEnd, gapStart

Fields inherited from interface gnu.lists.Sequence

ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, FLOAT_VALUE, GROUP_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE, eofValue

Constructor Summary

CharBuffer(FString str)
CharBuffer(int initialSize)

Method Summary

char
charAt(int index)
void
consume(int start, int count, Consumer dest)
void
delete(int where, int count)
void
fill(char value)
Set all the elements to a given character.
void
fill(int fromIndex, int toIndex, char value)
char[]
getArray()
void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Copy characters into a destination buffer.
void
insert(int where, String str, boolean beforeMarkers)
int
length()
void
setCharAt(int index, char value)
CharSequence
subSequence(int start, int end)
String
toString()
void
writeTo(int start, int count, java.io.Writer dest)
void
writeTo(java.io.Writer dest)

Methods inherited from class gnu.lists.StableVector

addPos, adjustPositions, allocPositionIndex, chainFreelist, consumePosRange, copyPos, createPos, endPos, fillPosRange, gapReserve, hasNext, isAfterPos, nextIndex, nextPos, releasePos, removePosRange, shiftGap, startPos, unchainFreelist

Methods inherited from class gnu.lists.GapVector

add, addPos, consumePosRange, createPos, fill, fillPosRange, gapReserve, gapReserve, get, getNextKind, hasNext, isAfterPos, nextIndex, removePosRange, set, shiftGap, size

Methods inherited from class gnu.lists.AbstractSequence

add, add, addAll, addAll, addPos, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, hashCode, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported

Constructor Details

CharBuffer

public CharBuffer(FString str)

CharBuffer

public CharBuffer(int initialSize)

Method Details

charAt

public char charAt(int index)
Specified by:
charAt in interface CharSeq

consume

public void consume(int start,
                    int count,
                    Consumer dest)
Specified by:
consume in interface CharSeq

delete

public void delete(int where,
                   int count)

fill

public final void fill(char value)
Set all the elements to a given character.
Specified by:
fill in interface CharSeq

fill

public void fill(int fromIndex,
                 int toIndex,
                 char value)
Specified by:
fill in interface CharSeq

getArray

public char[] getArray()

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Copy characters into a destination buffer. Same interface as java.lang.String's getChars.
Specified by:
getChars in interface CharSeq

insert

public void insert(int where,
                   String str,
                   boolean beforeMarkers)

length

public int length()
Specified by:
length in interface CharSeq

setCharAt

public void setCharAt(int index,
                      char value)
Specified by:
setCharAt in interface CharSeq

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSeq

toString

public String toString()
Specified by:
toString in interface CharSeq
Overrides:
toString in interface AbstractSequence

writeTo

public void writeTo(int start,
                    int count,
                    java.io.Writer dest)
            throws java.io.IOException
Specified by:
writeTo in interface CharSeq

writeTo

public void writeTo(java.io.Writer dest)
            throws java.io.IOException
Specified by:
writeTo in interface CharSeq