Package gnu.lists

Class CharBuffer

  • All Implemented Interfaces:
    BoundedHashable, Array<Char>, AVector<Char>, CharSeq, Consumable, Sequence<Char>, java.io.Externalizable, java.io.Serializable, java.lang.Appendable, java.lang.CharSequence, java.lang.Comparable, java.lang.Iterable<Char>, java.util.Collection<Char>, java.util.List<Char>, java.util.RandomAccess

    public class CharBuffer
    extends FString
    Editable character sequence using a buffer-gap implementation and self-adjusting position. Can implement (the text part of) an Emacs buffer, or a javax.swing.text.AbstractDocument.Content
    See Also:
    Serialized Form
    • Constructor Detail

      • CharBuffer

        public CharBuffer​(FString str)
      • CharBuffer

        public CharBuffer​(int initialSize)
      • CharBuffer

        protected CharBuffer()
    • Method Detail

      • getArray

        public char[] getArray()
      • isAfterPos

        public boolean isAfterPos​(int ipos)
        Description copied from class: AbstractSequence
        Tests whether the position has the "isAfter" property. I.e. if something is inserted at the position, will the iterator end up being after the new data?
        Overrides:
        isAfterPos in class SimpleVector<Char>
      • nextPos

        public int nextPos​(int ipos)
        Description copied from class: AbstractSequence
        Return the next position following the argument. The new position has the isAfter property. The argument is implicitly released (as in releasePos). Returns 0 if we are already at end of file.
        Overrides:
        nextPos in class AbstractSequence<Char>
      • copyPos

        public int copyPos​(int ipos)
        Description copied from class: AbstractSequence
        Make a copy of a position int. For simple positions returns the argument. However, if the positions are magic cookies that are actively managed by the sequence (as opposed to for example a simple index), then making a copy may need to increment a reference count, or maybe allocate a new position cookie. In any case, the new position is initialized to the same offset (and isAfter property) as the original.
        Overrides:
        copyPos in class AbstractSequence<Char>
        Parameters:
        ipos - the position being copied.
        Returns:
        the new position
      • nextIndex

        public int nextIndex​(int ipos)
        Description copied from class: AbstractSequence
        Get the offset from the beginning corresponding to a position cookie.
        Overrides:
        nextIndex in class FString
      • releasePos

        public void releasePos​(int ipos)
        Description copied from class: AbstractSequence
        Reclaim any resources used by the given position int.
        Overrides:
        releasePos in class AbstractSequence<Char>
        Parameters:
        ipos - the Pos being free'd.
      • createPos

        public int createPos​(int index,
                             boolean isAfter)
        Description copied from class: AbstractSequence
        Generate a position at a given index. The result is a position cookie that must be free'd with releasePos.
        Overrides:
        createPos in class FString
        Parameters:
        index - offset from beginning of desired position
        isAfter - should the position have the isAfter property
      • insert

        public void insert​(int where,
                           int ch,
                           boolean beforeMarkers)
        Overrides:
        insert in class FString
      • insert

        public void insert​(int where,
                           java.lang.String str,
                           boolean beforeMarkers)
        Overrides:
        insert in class FString
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface CharSeq
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class FString
      • 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
        Overrides:
        writeTo in class FString
        Throws:
        java.io.IOException
      • writeTo

        public void writeTo​(java.lang.Appendable dest)
                     throws java.io.IOException
        Specified by:
        writeTo in interface CharSeq
        Overrides:
        writeTo in class FString
        Throws:
        java.io.IOException
      • dump

        public void dump()