Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit.textarea
Class Selection  view Selection download Selection.java

java.lang.Object
  extended byorg.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:

Since:
jEdit 3.2pre1
Version:
$Id: Selection.java,v 1.20 2003/10/10 23:46:24 spestov Exp $

Nested Class Summary
static class Selection.Range
          An ordinary range selection.
static class Selection.Rect
          A rectangular selection.
 
Field Summary
(package private)  int end
           
(package private)  int endLine
           
(package private)  int start
           
(package private)  int startLine
           
 
Constructor Summary
(package private) Selection()
           
(package private) Selection(int start, int end)
           
(package private) Selection(Selection sel)
           
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
(package private) abstract  boolean contentInserted(org.gjt.sp.jedit.Buffer buffer, int startLine, int start, int numLines, int length)
           
(package private) abstract  boolean contentRemoved(org.gjt.sp.jedit.Buffer buffer, int startLine, int start, int numLines, int length)
           
 int getEnd()
          Returns the end offset of this selection.
abstract  int getEnd(org.gjt.sp.jedit.Buffer 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(org.gjt.sp.jedit.Buffer 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.
(package private) abstract  void getText(org.gjt.sp.jedit.Buffer buffer, java.lang.StringBuffer buf)
           
 boolean overlaps(Selection s)
          Returns if this selection and the specified selection overlap.
(package private) abstract  int setText(org.gjt.sp.jedit.Buffer buffer, java.lang.String text)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

int start

end

int end

startLine

int startLine

endLine

int endLine
Constructor Detail

Selection

Selection()

Selection

Selection(Selection sel)

Selection

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(org.gjt.sp.jedit.Buffer 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.

Since:
jEdit 4.1pre1

getEnd

public abstract int getEnd(org.gjt.sp.jedit.Buffer 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.

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.

Since:
jEdit 4.1pre1

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


getText

abstract void getText(org.gjt.sp.jedit.Buffer buffer,
                      java.lang.StringBuffer buf)

setText

abstract int setText(org.gjt.sp.jedit.Buffer buffer,
                     java.lang.String text)

contentInserted

abstract boolean contentInserted(org.gjt.sp.jedit.Buffer buffer,
                                 int startLine,
                                 int start,
                                 int numLines,
                                 int length)

contentRemoved

abstract boolean contentRemoved(org.gjt.sp.jedit.Buffer buffer,
                                int startLine,
                                int start,
                                int numLines,
                                int length)