gnu.lists
Class FString

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.lists.SimpleVector
          extended by gnu.lists.FString
All Implemented Interfaces:
Array, CharSeq, Consumable, Sequence, java.io.Externalizable, java.io.Serializable, java.lang.CharSequence, java.lang.Comparable, java.lang.Iterable, java.util.Collection, java.util.List

public class FString
extends SimpleVector
implements CharSeq, java.io.Externalizable, Consumable, java.lang.Comparable

Simple adjustable-length vector whose elements are 32-bit floats. Used for the Scheme string type.

See Also:
Serialized Form

Field Summary
 char[] data
           
protected static char[] empty
           
 
Fields inherited from class gnu.lists.SimpleVector
size
 
Fields inherited from interface gnu.lists.Sequence
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, eofValue, 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
 
Constructor Summary
FString()
           
FString(char[] values)
          Create an FString from a char[].
FString(char[] buffer, int offset, int length)
           
FString(CharSeq seq)
           
FString(CharSeq seq, int offset, int length)
           
FString(int num)
           
FString(int num, char value)
           
FString(Sequence seq)
           
FString(java.lang.String str)
           
FString(java.lang.StringBuffer buffer)
           
FString(java.lang.StringBuffer buffer, int offset, int length)
           
 
Method Summary
 boolean addAll(FString s)
          Append all the characters of another FString.
 void addAllStrings(java.lang.Object[] args, int startIndex)
          Append arguments to this FString.
 FString append(char c)
           
 FString append(java.lang.CharSequence csq)
           
 FString append(java.lang.CharSequence csq, int start, int end)
           
 char charAt(int index)
           
 char charAtBuffer(int index)
           
protected  void clearBuffer(int start, int count)
           
 int compareTo(java.lang.Object obj)
           
 void consume(Consumer out)
           
 boolean consumeNext(int ipos, Consumer out)
          Copy an element specified by a position pair to a Consumer.
 void consumePosRange(int iposStart, int iposEnd, Consumer out)
           
 FString copy(int start, int end)
           
 boolean equals(java.lang.Object obj)
           
 void fill(char ch)
          Set all the elements to a given character.
 void fill(int fromIndex, int toIndex, char value)
           
 java.lang.Object get(int index)
          See java.util.List.
protected  java.lang.Object getBuffer()
           
 java.lang.Object getBuffer(int index)
           
 int getBufferLength()
          Get the allocated length of the data buffer.
 void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
          Copy characters into a destination buffer.
 void getChars(int srcBegin, int srcEnd, java.lang.StringBuffer dst)
           
 void getChars(java.lang.StringBuffer dst)
           
 int getElementKind()
           
 int hashCode()
           
 int length()
          Get length of string, in characters.
 void readExternal(java.io.ObjectInput in)
           
 void replace(int where, char[] chars, int start, int count)
           
 void replace(int where, java.lang.String string)
           
 java.lang.Object setBuffer(int index, java.lang.Object value)
           
 void setBufferLength(int length)
           
 void setCharAt(int index, char ch)
           
 void setCharAtBuffer(int index, char ch)
           
 void shift(int srcStart, int dstStart, int count)
           
 java.lang.CharSequence subSequence(int start, int end)
           
 java.lang.String substring(int start, int end)
           
 char[] toCharArray()
          Return a char[] contain the characters of this string.
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 void writeTo(java.lang.Appendable dest)
           
 void writeTo(int start, int count, java.lang.Appendable dest)
          Append a specified subsequence to an Appendable.
 
Methods inherited from class gnu.lists.SimpleVector
add, add, addAll, addPos, clear, compareToInt, compareToLong, consume, createPos, fill, fill, fillPosRange, getNextKind, getPosNext, getRowMajor, getTag, intAt, intAtBuffer, isAfterPos, longAt, longAtBuffer, nextIndex, nextPos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, setSize, size, transpose
 
Methods inherited from class gnu.lists.AbstractSequence
addAll, baseUriOfPos, compare, compare, compare, contains, containsAll, copyPos, createRelativePos, elements, endPos, equals, firstAttributePos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextTypeName, getNextTypeObject, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, releasePos, set, setPosNext, setPosPrevious, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gnu.lists.CharSeq
consume
 
Methods inherited from interface gnu.lists.Sequence
elements, fill, isEmpty, size
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 
Methods inherited from interface gnu.lists.Array
get, getEffectiveIndex, getLowBound, getSize, isEmpty, rank, set
 

Field Detail

data

public char[] data

empty

protected static char[] empty
Constructor Detail

FString

public FString()

FString

public FString(int num)

FString

public FString(int num,
               char value)

FString

public FString(char[] values)
Create an FString from a char[]. Note that this contructor does *not* copy the argument.


FString

public FString(java.lang.String str)

FString

public FString(java.lang.StringBuffer buffer)

FString

public FString(java.lang.StringBuffer buffer,
               int offset,
               int length)

FString

public FString(char[] buffer,
               int offset,
               int length)

FString

public FString(Sequence seq)

FString

public FString(CharSeq seq)

FString

public FString(CharSeq seq,
               int offset,
               int length)
Method Detail

length

public int length()
Description copied from interface: CharSeq
Get length of string, in characters. Synonym for size(), for compatibility with String and StringBuffer.

Specified by:
length in interface CharSeq
Specified by:
length in interface java.lang.CharSequence

getBufferLength

public int getBufferLength()
Get the allocated length of the data buffer.

Specified by:
getBufferLength in class SimpleVector

setBufferLength

public void setBufferLength(int length)
Specified by:
setBufferLength in class SimpleVector

getBuffer

protected java.lang.Object getBuffer()
Specified by:
getBuffer in class SimpleVector

getBuffer

public final java.lang.Object getBuffer(int index)
Specified by:
getBuffer in class SimpleVector

setBuffer

public final java.lang.Object setBuffer(int index,
                                        java.lang.Object value)
Specified by:
setBuffer in class SimpleVector

get

public final java.lang.Object get(int index)
Description copied from class: AbstractSequence
See java.util.List.

Specified by:
get in interface Sequence
Specified by:
get in interface java.util.List
Overrides:
get in class SimpleVector

charAt

public final char charAt(int index)
Specified by:
charAt in interface CharSeq
Specified by:
charAt in interface java.lang.CharSequence

charAtBuffer

public final char charAtBuffer(int index)

getChars

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

Specified by:
getChars in interface CharSeq

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     java.lang.StringBuffer dst)

getChars

public void getChars(java.lang.StringBuffer dst)

toCharArray

public char[] toCharArray()
Return a char[] contain the characters of this string. It is unspecified if the result is a copy or shares with this FString.


shift

public void shift(int srcStart,
                  int dstStart,
                  int count)
Overrides:
shift in class SimpleVector

copy

public FString copy(int start,
                    int end)

addAll

public boolean addAll(FString s)
Append all the characters of another FString.


addAllStrings

public void addAllStrings(java.lang.Object[] args,
                          int startIndex)
Append arguments to this FString. Used to implement Scheme's string-append and string-append/shared.

Parameters:
args - an array of FString value
startIndex - index of first string in args to use

toString

public java.lang.String toString()
Specified by:
toString in interface CharSeq
Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class AbstractSequence

substring

public java.lang.String substring(int start,
                                  int end)

subSequence

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

setCharAt

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

setCharAtBuffer

public void setCharAtBuffer(int index,
                            char ch)

fill

public final void fill(char ch)
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

clearBuffer

protected void clearBuffer(int start,
                           int count)
Specified by:
clearBuffer in class SimpleVector

replace

public void replace(int where,
                    char[] chars,
                    int start,
                    int count)

replace

public void replace(int where,
                    java.lang.String string)

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class AbstractSequence

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.List
Overrides:
equals in class AbstractSequence

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable

getElementKind

public int getElementKind()
Overrides:
getElementKind in class SimpleVector

consume

public void consume(Consumer out)
Specified by:
consume in interface Consumable
Overrides:
consume in class AbstractSequence

consumeNext

public boolean consumeNext(int ipos,
                           Consumer out)
Description copied from class: AbstractSequence
Copy an element specified by a position pair to a Consumer.

Overrides:
consumeNext in class SimpleVector
Returns:
if hasNext(ipos).

consumePosRange

public void consumePosRange(int iposStart,
                            int iposEnd,
                            Consumer out)
Overrides:
consumePosRange in class SimpleVector

append

public FString append(char c)
Overrides:
append in class AbstractSequence

append

public FString append(java.lang.CharSequence csq)
Overrides:
append in class AbstractSequence

append

public FString append(java.lang.CharSequence csq,
                      int start,
                      int end)
Overrides:
append in class AbstractSequence

writeTo

public void writeTo(int start,
                    int count,
                    java.lang.Appendable dest)
             throws java.io.IOException
Description copied from interface: CharSeq
Append a specified subsequence to an Appendable. An allowable implementation is: dest.append(this, start, start+count). Hence implementors of Appendable should avoid calling writeTo - though they can call getChars.

Specified by:
writeTo in interface CharSeq
Throws:
java.io.IOException

writeTo

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

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException