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

org.gjt.sp.jedit.textarea

## Class Selection

- java.lang.Object
- - org.gjt.sp.jedit.textarea.Selection

- All Implemented Interfaces:
    java.lang.Cloneable
  Direct Known Subclasses:
    Selection.Range, Selection.Rect

      public abstract class Selection
      extends java.lang.Object
      implements java.lang.Cloneable

  An abstract class that holds data on a region of selected text. As an abstract class, it cannot be used directly, but instead serves as a parent class for two specific types of selection structures:
  - `Selection.Range` - represents an ordinary range of selected text.
  - `Selection.Rect` - represents a rectangular selection.
  Since:
    jEdit 3.2pre1

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Selection.Range` An ordinary range selection.
    `static class` | `Selection.Rect` A rectangular selection.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Selection()`
    `protected` | `Selection(int start, int end)`
    `protected` | `Selection(Selection sel)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `int` | `getEnd()` Returns the end offset of this selection.
    `abstract int` | `getEnd(JEditBuffer buffer, int line)` Returns the end of the portion of the selection falling on the specified line.
    `int` | `getEndLine()` Returns the ending line number of this selection.
    `int` | `getStart()` Returns the start offset of this selection.
    `abstract int` | `getStart(JEditBuffer buffer, int line)` Returns the beginning of the portion of the selection falling on the specified line.
    `int` | `getStartLine()` Returns the starting line number of this selection.
    `boolean` | `overlaps(Selection s)` Returns if this selection and the specified selection overlap.
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### Selection

          protected Selection()

    - #### Selection

          protected Selection(Selection sel)

    - #### Selection

          protected Selection(int start,
                              int end)

  - ### Method Detail

    - #### getStart

          public int getStart()

      Returns the start offset of this selection.

    - #### getEnd

          public int getEnd()

      Returns the end offset of this selection.

    - #### getStart

          public abstract int getStart(JEditBuffer buffer,
                                       int line)

      Returns the beginning of the portion of the selection falling on the specified line. Used to manipulate selection text on a line-by-line basis.
      Parameters:
        `buffer` - The buffer
        `line` - The line number
      Since:
        jEdit 4.1pre1

    - #### getEnd

          public abstract int getEnd(JEditBuffer buffer,
                                     int line)

      Returns the end of the portion of the selection falling on the specified line. Used to manipulate selection text on a line-by-line basis.
      Parameters:
        `buffer` - The buffer
        `line` - The line number
      Since:
        jEdit 4.1pre1

    - #### getStartLine

          public int getStartLine()

      Returns the starting line number of this selection.

    - #### getEndLine

          public int getEndLine()

      Returns the ending line number of this selection.

    - #### overlaps

          public boolean overlaps(Selection s)

      Returns if this selection and the specified selection overlap.
      Parameters:
        `s` - The other selection
      Since:
        jEdit 4.1pre1

    - #### toString

          public java.lang.String toString()

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

    - #### clone

          public java.lang.Object clone()

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