public class LinkedPosition extends Position
Position
on a document that knows which document it is
registered with and has a sequence number for tab stops.
Clients may extend this class.
Constructor and Description |
---|
LinkedPosition(IDocument document,
int offset,
int length)
Creates a new instance.
|
LinkedPosition(IDocument document,
int offset,
int length,
int sequence)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getContent()
Returns the content of this position on the referenced document.
|
IDocument |
getDocument() |
int |
getSequenceNumber()
Returns the sequence number of this position.
|
int |
hashCode() |
boolean |
includes(DocumentEvent event)
Returns whether this position includes
event . |
protected boolean |
includes(IDocument doc,
int off,
int len)
Returns whether this position includes the range given by
offset and length . |
boolean |
includes(int pOffset)
Overrides
Position.includes(int) so every offset is considered
included that lies in between the first and last offset of this position,
and offsets that are right at the end of the position. |
boolean |
includes(LinkedPosition position)
Returns whether this position includes
position . |
boolean |
overlapsWith(LinkedPosition position)
Returns whether this position overlaps with
position . |
void |
setSequenceNumber(int sequence)
Sets the sequence number of this position.
|
public LinkedPosition(IDocument document, int offset, int length, int sequence)
document
- the documentoffset
- the offset of the positionlength
- the length of the positionsequence
- the iteration sequence rankpublic LinkedPosition(IDocument document, int offset, int length)
LinkedPosition(document, offset, length, LinkedPositionGroup.NO_STOP)
document
- the documentoffset
- the offset of the positionlength
- the length of the positionpublic IDocument getDocument()
public boolean overlapsWith(LinkedPosition position)
position
.position
- the position to check.true
if this position overlaps with
position
,false
otherwisepublic boolean includes(DocumentEvent event)
event
.event
- the event to check.true
if this position includes event
,
false
otherwisepublic boolean includes(LinkedPosition position)
position
.position
- the position to check.true
if this position includes
position
,false
otherwisepublic boolean includes(int pOffset)
Position.includes(int)
so every offset is considered
included that lies in between the first and last offset of this position,
and offsets that are right at the end of the position.protected boolean includes(IDocument doc, int off, int len)
offset
and length
. A range is included by
a LinkedPosition
if includes(offset)
returns true for every offset in the range, including the borders of the
range.doc
- the document that the given range refers to, may be null
off
- the offset of the range, referring to document
len
- the length of the rangetrue
if doc
is the same document as
this position refers to, and if the entire range is included in
this positionpublic String getContent() throws BadLocationException
BadLocationException
- if the position is not validpublic int getSequenceNumber()
public void setSequenceNumber(int sequence)
sequence
- the new sequence number
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.