BufferSet (jEdit API Documentation)
Date: 2017-03-18

org.gjt.sp.jedit.bufferset

## Class BufferSet

- java.lang.Object
- - org.gjt.sp.jedit.bufferset.BufferSet

-     public class BufferSet
      extends java.lang.Object

  An ordered list of buffers, normally attached to an EditPane and viewed in a BufferSwitcher.
  Since:
    jEdit 4.3pre15

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `BufferSet.NameSorter`
    `static class` | `BufferSet.PathSorter`
    `static class` | `BufferSet.Scope` Possible scopes for BufferSets.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferSet(BufferSet source)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBuffer(Buffer buffer)` Internal use only, use `BufferSetManager.addBuffer(org.gjt.sp.jedit.View, org.gjt.sp.jedit.Buffer)` or `BufferSetManager.addBuffer(org.gjt.sp.jedit.EditPane, org.gjt.sp.jedit.Buffer)`
    `void` | `addBufferAt(Buffer buffer, int position)` Internal use only, use `BufferSetManager.addBuffer(org.gjt.sp.jedit.View, org.gjt.sp.jedit.Buffer)` or `BufferSetManager.addBuffer(org.gjt.sp.jedit.EditPane, org.gjt.sp.jedit.Buffer)`
    `void` | `addBufferSetListener(BufferSetListener listener)` Add a BufferSetListener.
    `Buffer[]` | `getAllBuffers()` Returns an array of all buffers in this bufferSet.
    `void` | `getAllBuffers(BufferSetListener listener)`
    `Buffer` | `getBuffer(int index)` Returns the Buffer at the given index.
    `Buffer` | `getNextBuffer(int index)`
    `Buffer` | `getPreviousBuffer(int index)`
    `java.util.Comparator<Buffer>` | `getSorter()`
    `int` | `indexOf(Buffer buffer)`
    `void` | `removeBufferSetListener(BufferSetListener listener)` Remove a BufferSetListener.
    `int` | `size()`
    `void` | `sort()` Sort the bufferSet (useful if a buffer has been renamed for example
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BufferSet

          public BufferSet(BufferSet source)

  - ### Method Detail

    - #### addBuffer

          public void addBuffer(Buffer buffer)

      Internal use only, use `BufferSetManager.addBuffer(org.gjt.sp.jedit.View, org.gjt.sp.jedit.Buffer)` or `BufferSetManager.addBuffer(org.gjt.sp.jedit.EditPane, org.gjt.sp.jedit.Buffer)`
      Parameters:
        `buffer` - the buffer to be added

    - #### addBufferAt

          public void addBufferAt(Buffer buffer,
                                  int position)

      Internal use only, use `BufferSetManager.addBuffer(org.gjt.sp.jedit.View, org.gjt.sp.jedit.Buffer)` or `BufferSetManager.addBuffer(org.gjt.sp.jedit.EditPane, org.gjt.sp.jedit.Buffer)`
      Parameters:
        `buffer` - the buffer to be added
        `position` - the position where it must be added or -1 if we don't care

    - #### getBuffer

          public Buffer getBuffer(int index)

      Returns the Buffer at the given index.
      Parameters:
        `index` - the index. The index must exists
      Returns:
        the buffer at the index.

    - #### getSorter

          @Nullable
          public java.util.Comparator<Buffer> getSorter()

      Returns:
        the Comparator used for this bufferset can be null if there is no sorting
      Since:
        jEdit 5.2

    - #### getPreviousBuffer

          public Buffer getPreviousBuffer(int index)

    - #### getNextBuffer

          public Buffer getNextBuffer(int index)

    - #### indexOf

          public int indexOf(Buffer buffer)

    - #### size

          public int size()

    - #### getAllBuffers

          public void getAllBuffers(BufferSetListener listener)

    - #### getAllBuffers

          public Buffer[] getAllBuffers()

      Returns an array of all buffers in this bufferSet.
      Returns:
        an array of all Buffers

    - #### addBufferSetListener

          public void addBufferSetListener(BufferSetListener listener)

      Add a BufferSetListener.
      Parameters:
        `listener` - the new BufferSetListener

    - #### removeBufferSetListener

          public void removeBufferSetListener(BufferSetListener listener)

      Remove a BufferSetListener. If there are no listeners anymore, remove all buffers from the bufferSet.
      Parameters:
        `listener` - the removed BufferSetListener

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### sort

          public void sort()

      Sort the bufferSet (useful if a buffer has been renamed for example
      Since:
        jEdit 4.4pre1