|
org.netbeans.modules.editor.util/1 1.26 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.lib.editor.util.swing.PositionRegion
public class PositionRegion
A pair of positions delimiting a text region in a swing document.
At all times it should be satisfied that
getStartOffset() <= getEndOffset().
| Constructor Summary | |
|---|---|
PositionRegion(Document doc,
int startOffset,
int endOffset)
Construct new position region based on the knowledge of the document and starting and ending offset. |
|
PositionRegion(Position startPosition,
Position endPosition)
Construct new position region. |
|
| Method Summary | |
|---|---|
static Position |
createFixedPosition(int offset)
Create a fixed position instance that just wraps a given integer offset. |
static Comparator<PositionRegion> |
getComparator()
Get comparator for position regions comparing start offsets of the two given regions. |
int |
getEndOffset()
Get ending offset of this region. |
Position |
getEndPosition()
Get ending position of this region. |
int |
getLength()
Get length of this region. |
int |
getStartOffset()
Get starting offset of this region. |
Position |
getStartPosition()
Get starting position of this region. |
String |
getString(Document doc)
Get text enclosed by this position region as a String. |
CharSequence |
getText(Document doc)
Get text enclosed by this position region as a character sequence. |
static boolean |
isRegionsSorted(List<? extends PositionRegion> positionRegionList)
Check whether a list of position regions is sorted according the start offsets of the regions. |
String |
toString()
Debug info about this region. |
String |
toString(Document doc)
Debug info about this region that includes line and column info. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PositionRegion(Position startPosition,
Position endPosition)
startPosition - non-null start position of the region <= end position.endPosition - non-null end position of the region >= start position.
public PositionRegion(Document doc,
int startOffset,
int endOffset)
throws BadLocationException
BadLocationException| Method Detail |
|---|
public static final Comparator<PositionRegion> getComparator()
public static Position createFixedPosition(int offset)
offset - >=0 offset at which the position should be created.public static boolean isRegionsSorted(List<? extends PositionRegion> positionRegionList)
positionRegionList - list of the regions to be compared.
public final int getStartOffset()
public final Position getStartPosition()
public final int getEndOffset()
public final Position getEndPosition()
public final int getLength()
getEndOffset() - getStartOffset().public CharSequence getText(Document doc)
doc - non-null document to which this position region belongs.
IndexOutOfBoundsException - if the bounds are wrong
(likely positions were created for another document).
public String getString(Document doc)
throws BadLocationException
doc - non-null document to which this position region belongs.
BadLocationException - if the bounds are wrong
(likely positions were created for another document).public String toString(Document doc)
doc - non-null document to which this position region belongs.
public String toString()
toString in class Object
|
org.netbeans.modules.editor.util/1 1.26 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||