LongListpublic final class LongList extends Object This list is used in order to construct the OID during the getnext.
The constructed oid is checked by the checker AcmChecker. |
Fields Summary |
---|
public static int | DEFAULT_CAPACITY | public static int | DEFAULT_INCREMENT | private final int | DELTA | private int | size | public long[] | listThe list content. Any access to this variable must be protected
by a synchronized block on the LongList object.
Only read-only action should be performed on this object. |
Constructors Summary |
---|
LongList()
this(DEFAULT_CAPACITY,DEFAULT_INCREMENT);
| LongList(int initialCapacity)
this(initialCapacity,DEFAULT_INCREMENT);
| LongList(int initialCapacity, int delta)
size = 0;
DELTA = delta;
list = allocate(initialCapacity);
|
Methods Summary |
---|
public final boolean | add(long o)Same behaviour than add(long o) in {@link java.util.List}.
Any access to this method should be protected in a synchronized
block on the LongList object.
if (size >= list.length)
resize();
list[size++]=o;
return true;
| public final void | add(int index, long o)Same behaviour than add(int index, long o) in
{@link java.util.List}.
Any access to this method should be protected in a synchronized
block on the LongList object.
if (index > size) throw new IndexOutOfBoundsException();
if (index >= list.length) resize();
if (index == size) {
list[size++]=o;
return;
}
java.lang.System.arraycopy(list,index,list,index+1,size-index);
list[index]=o;
size++;
| public final void | add(int at, long[] src, int from, int count)Adds count elements to the list.
if (count <= 0) return;
if (at > size) throw new IndexOutOfBoundsException();
ensure(size+count);
if (at < size) {
java.lang.System.arraycopy(list,at,list,at+count,size-at);
}
java.lang.System.arraycopy(src,from,list,at,count);
size+=count;
| private final long[] | allocate(int length)Allocate a new array of object of specified length.
return new long[length];
| private final void | ensure(int length)Resize the list. Insure that the new length will be at
least equal to length.
if (list.length < length) {
final int min = list.length+DELTA;
length=(length<min)?min:length;
final long[] newlist = allocate(length);
java.lang.System.arraycopy(list,0,newlist,0,size);
list = newlist;
}
| public final long | remove(int from, int count)Any access to this method should be protected in a synchronized
block on the LongList object.
if (count < 1 || from < 0) return -1;
if (from+count > size) return -1;
final long o = list[from];
final int oldsize = size;
size = size - count;
if (from == size) return o;
java.lang.System.arraycopy(list,from+count,list,from,
size-from);
return o;
| public final long | remove(int index)Same behaviour than remove(int index) in {@link java.util.List}.
Any access to this method should be protected in a synchronized
block on the LongList object.
if (index >= size) return -1;
final long o = list[index];
list[index]=0;
if (index == --size) return o;
java.lang.System.arraycopy(list,index+1,list,index,
size-index);
return o;
| private final void | resize()Resize the list. Increase its capacity by DELTA elements.
Any call to this method must be protected by a synchronized
block on this LongList.
final long[] newlist = allocate(list.length + DELTA);
java.lang.System.arraycopy(list,0,newlist,0,size);
list = newlist;
| public final int | size()Same behaviour than size() in {@link java.util.List}. return size;
| public final long[] | toArray(long[] a)Same behaviour than the toArray(long[] a) method in
{@link java.util.List}.
Any access to this method should be protected in a synchronized
block on the LongList object.
java.lang.System.arraycopy(list,0,a,0,size);
return a;
| public final long[] | toArray()Same behaviour than the toArray() method in
{@link java.util.List}.
Any access to this method should be protected in a synchronized
block on the LongList object.
return toArray(new long[size]);
|
|