| Modifier and Type | Class and Description |
|---|---|
class |
GapBranchElement.Edit |
class |
GapBranchElement.LastIndex
Extension of
GapBranchElement
that overrides GapBranchElement.LastIndex.getElementIndex(int)
which remembers the last returned element index. |
| Modifier and Type | Field and Description |
|---|---|
protected static Element[] |
EMPTY_ELEMENT_ARRAY |
| Constructor and Description |
|---|
GapBranchElement() |
| Modifier and Type | Method and Description |
|---|---|
void |
copyElements(int srcBegin,
int srcEnd,
Element[] dst,
int dstBegin) |
Element |
getElement(int index) |
int |
getElementCount() |
int |
getElementIndex(int offset)
Gets the child element index closest to the given offset.
|
boolean |
isLeaf() |
protected void |
replace(int index,
int removeCount,
Element[] addedElems) |
String |
toString()
Get info about
DocMarks. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAttributes, getDocument, getEndOffset, getName, getParentElement, getStartOffsetprotected static final Element[] EMPTY_ELEMENT_ARRAY
public int getElementCount()
getElementCount in interface Elementpublic Element getElement(int index)
getElement in interface Elementpublic void copyElements(int srcBegin,
int srcEnd,
Element[] dst,
int dstBegin)
public int getElementIndex(int offset)
-1 if the
Element is a leaf, otherwise returns
the index of the Element that best represents
the given location. Returns 0 if the location
is less than the start offset. Returns
getElementCount() - 1 if the location is
greater than or equal to the end offset.
This implementation is in sync with the original
Element.getElementIndex() specification
but it differs
from AbstractDocument.BranchElement.getElementIndex()
which returns 0 in case it does not have any children.
This implementation returns -1 in that case because in fact
the element act as a leaf element in such case.
Nonetheless there should be no difference in functionality
if this implementation is used for line elements
because there is always at least one line element even
for empty doc because of the extra '\n' after the end
of the AbstractDocument-based implementations.
getElementIndex in interface Elementoffset - the specified offset >= 0protected void replace(int index,
int removeCount,
Element[] addedElems)
Built on May 16 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.