Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.editor
Class TextRange

java.lang.Object
  extended by oracle.javatools.editor.TextRange

All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
TextTabber.TabTextRange

public class TextRange
extends java.lang.Object
implements java.lang.Comparable

A representation of a contiguous range of characters in a TextBuffer. The TextRange uses OffsetMarks to track changes in the buffer so the range continues to cover the expected text as edits are made to the buffer. It is for this reason that dispose() must be called on the range when it is no longer needed, otherwise the OffsetMarks will remain (leaked) in the TextBuffer. The smallest range is one character long, having the same start and end offsets. The behaviour of the TextRange after dispose() has been called is undefined


Constructor Summary
TextRange(TextBuffer buffer, int startOffset, int endOffset)
          Create a text range for a section of the text buffer.

 

Method Summary
 int compareTo(java.lang.Object o)
           
 boolean contains(int offset)
           
 void dispose()
          Free up resources used to track this range in the buffer.
 int getEndOffset()
           
 int getLength()
           
 int getStartOffset()
           
 java.lang.String getText()
           
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

TextRange

public TextRange(TextBuffer buffer,
                 int startOffset,
                 int endOffset)
Create a text range for a section of the text buffer. Call dispose() when this range is no longer needed.
Parameters:
buffer -
startOffset - the first offset to be included in the range
endOffset - the last offset to be included in the range

Method Detail

dispose

public void dispose()
Free up resources used to track this range in the buffer. After dispose() has been called the behaviour of this object is undefined.

compareTo

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

getStartOffset

public int getStartOffset()
Returns:
the first offset included in this range

getEndOffset

public int getEndOffset()
Returns:
the last offset included in this range

getLength

public int getLength()

contains

public boolean contains(int offset)
Parameters:
offset -
Returns:
true if the TextRange contains the given offset

getText

public java.lang.String getText()
                         throws java.lang.IndexOutOfBoundsException
Returns:
the text of this TextRange
Throws:
java.lang.IndexOutOfBoundsException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a user displayable representation of the text, not necessarily the exact contents of the TextRange. Use getText() to retrieve the actual range text.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.