当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
GapObjectArray (Editor Library) - NetBeans API Javadoc (Current Development Version)
org.netbeans.editor
Class GapObjectArray
java.lang.Object
org.netbeans.editor.GapObjectArray
- All Implemented Interfaces:
- ObjectArray, ObjectArray.CopyItems
public class GapObjectArray
- extends Object
- implements ObjectArray, ObjectArray.CopyItems
Implementation of ObjectArray
that
contains a gap which helps to speed up inserts/removals
close to the gap.
Note that this implementation is not synchronized. If
multiple threads access an instance of this class concurrently, and at
least one of the threads inserts/removes items, the whole access must be
synchronized externally.
Method Summary |
void |
compact()
|
void |
copyItems(int srcStartIndex,
int srcEndIndex,
Object[] dest,
int destIndex)
Copy the items in the given index range from the object array into destination array. |
Object |
getItem(int index)
Get the item at the given index. |
int |
getItemCount()
|
void |
insertAll(int index,
Object[] items)
|
void |
insertAll(int index,
Object[] items,
int off,
int len)
|
void |
insertItem(int index,
Object item)
|
protected void |
movedAboveGapUpdate(Object[] array,
int index,
int count)
|
protected void |
movedBelowGapUpdate(Object[] array,
int index,
int count)
|
void |
remove(int index,
int count)
|
void |
remove(int index,
int count,
GapObjectArray.RemoveUpdater removeUpdater)
|
void |
replace(int index,
int removeCount,
Object[] newItems)
|
String |
toStringDetail()
|
protected void |
unoptimizedRemove(int index,
int count,
GapObjectArray.RemoveUpdater removeUpdater)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GapObjectArray
public GapObjectArray()
GapObjectArray
public GapObjectArray(Object[] array,
int length)
- Construct new gap array of objects.
- Parameters:
array
- use this array as an initial array for processing.
The array will be modified by subsequent changes. If the array
contents should be preserved the array must be cloned first
before processing.length
- length of the valid part of the array that contains
the objects to be managed. The area must start at the index 0.
getItemCount
public int getItemCount()
- Specified by:
getItemCount
in interface ObjectArray
- Returns:
- >=0 Number of items in the object array.
getItem
public Object getItem(int index)
- Description copied from interface:
ObjectArray
- Get the item at the given index.
- Specified by:
getItem
in interface ObjectArray
- Parameters:
index
- >=0 and <ObjectArray.getItemCount()
index at which the item
should be obtained.
- Returns:
- the item at the requested index.
copyItems
public void copyItems(int srcStartIndex,
int srcEndIndex,
Object[] dest,
int destIndex)
- Description copied from interface:
ObjectArray.CopyItems
- Copy the items in the given index range from the object array into destination array.
- Specified by:
copyItems
in interface ObjectArray.CopyItems
- Parameters:
srcStartIndex
- index of the first item in the object array to get.srcEndIndex
- end index in the object array of the items to get.dest
- destination array of objects. The length of the array
must be at least destIndex + (srcEndIndex - srcStartIndex)
.destIndex
- first destination index at which the items are being stored.
replace
public void replace(int index,
int removeCount,
Object[] newItems)
insertItem
public void insertItem(int index,
Object item)
insertAll
public void insertAll(int index,
Object[] items)
insertAll
public void insertAll(int index,
Object[] items,
int off,
int len)
remove
public void remove(int index,
int count)
remove
public void remove(int index,
int count,
GapObjectArray.RemoveUpdater removeUpdater)
unoptimizedRemove
protected void unoptimizedRemove(int index,
int count,
GapObjectArray.RemoveUpdater removeUpdater)
compact
public void compact()
movedAboveGapUpdate
protected void movedAboveGapUpdate(Object[] array,
int index,
int count)
movedBelowGapUpdate
protected void movedBelowGapUpdate(Object[] array,
int index,
int count)
toStringDetail
public String toStringDetail()