Class ObjectsArray
- java.lang.Object
-
- com.metsci.glimpse.util.primitives.ObjectsArray
-
- All Implemented Interfaces:
Objects,ObjectsModifiable
public class ObjectsArray extends Object implements ObjectsModifiable
- Author:
- hogye
-
-
Constructor Summary
Constructors Constructor Description ObjectsArray()ObjectsArray(int n)ObjectsArray(Objects xs)Clones the sequence arg.ObjectsArray(Object[] a)For efficiency, does not clone the array arg.ObjectsArray(Object[] a, int n)For efficiency, does not clone the array arg.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(Objects vs)voidappend(Objects vs, int from, int to)voidappend(Object v)voidappend(Object[] vs)voidappend(Object[] vs, int from, int to)voidclear()voidcompact()ObjectsArraycopy()Object[]copyOf()Object[]copyOf(int i, int c)voidcopyTo(int i, Object[] dest, int iDest, int c)voidensureCapacity(int minCapacity)Objectfirst()voidinsert(int i, Objects vs)voidinsert(int i, Objects vs, int from, int to)voidinsert(int i, Object v)voidinsert(int i, Object[] vs)voidinsert(int i, Object[] vs, int from, int to)booleanisEmpty()Objectlast()intn()Length of the sequencestatic Object[]newArray(int oldCapacity, int minNewCapacity)Creates a new array whose capacity is at least minNewCapacity, and at least 1.618 * oldCapacity, up to Integer.MAX_VALUE.voidprepend(Objects vs)voidprepend(Objects vs, int from, int to)voidprepend(Object v)voidprepend(Object[] vs)voidprepend(Object[] vs, int from, int to)voidprepForAppend(int c)Makes room in this array for new values to be appended.voidprepForInsert(int i, int c)Makes room in this array for new values to be inserted.voidprepForPrepend(int c)Makes room in this array for new values to be prepended.voidremove(Object v)Removes a single copy of the specified value.voidremoveIndex(int index)Remove value at index.voidremoveRange(int from, int to)Removes values starting at index from (inclusive) to index to (exclusive).voidset(int i, Object v)voidset(int i, Object[] vs)voidset(int i, Object[] vs, int from, int to)Objectv(int i)Value at index i
-
-
-
Field Detail
-
a
public Object[] a
-
n
public int n
-
-
Constructor Detail
-
ObjectsArray
public ObjectsArray(Object[] a)
For efficiency, does not clone the array arg.
-
ObjectsArray
public ObjectsArray(int n)
-
ObjectsArray
public ObjectsArray()
-
ObjectsArray
public ObjectsArray(Object[] a, int n)
For efficiency, does not clone the array arg.
-
ObjectsArray
public ObjectsArray(Objects xs)
Clones the sequence arg.
-
-
Method Detail
-
n
public int n()
Description copied from interface:ObjectsLength of the sequence
-
copyTo
public void copyTo(int i, Object[] dest, int iDest, int c)
-
copy
public ObjectsArray copy()
- Specified by:
copyin interfaceObjects- Specified by:
copyin interfaceObjectsModifiable
-
set
public void set(int i, Object v)- Specified by:
setin interfaceObjectsModifiable
-
set
public void set(int i, Object[] vs)- Specified by:
setin interfaceObjectsModifiable
-
set
public void set(int i, Object[] vs, int from, int to)- Specified by:
setin interfaceObjectsModifiable
-
insert
public void insert(int i, Object v)- Specified by:
insertin interfaceObjectsModifiable
-
insert
public void insert(int i, Objects vs)- Specified by:
insertin interfaceObjectsModifiable
-
insert
public void insert(int i, Objects vs, int from, int to)- Specified by:
insertin interfaceObjectsModifiable
-
insert
public void insert(int i, Object[] vs)- Specified by:
insertin interfaceObjectsModifiable
-
insert
public void insert(int i, Object[] vs, int from, int to)- Specified by:
insertin interfaceObjectsModifiable
-
prepForInsert
public void prepForInsert(int i, int c)Makes room in this array for new values to be inserted. When this call returns, the values inthis.aon[i,i+c)are undefined. Writing meaningful values to these indices is up to the caller.- Parameters:
i- The index at which new values will be insertedc- The count of new values that will be inserted
-
prepend
public void prepend(Object v)
- Specified by:
prependin interfaceObjectsModifiable
-
prepend
public void prepend(Objects vs)
- Specified by:
prependin interfaceObjectsModifiable
-
prepend
public void prepend(Objects vs, int from, int to)
- Specified by:
prependin interfaceObjectsModifiable
-
prepend
public void prepend(Object[] vs)
- Specified by:
prependin interfaceObjectsModifiable
-
prepend
public void prepend(Object[] vs, int from, int to)
- Specified by:
prependin interfaceObjectsModifiable
-
prepForPrepend
public void prepForPrepend(int c)
Makes room in this array for new values to be prepended. When this call returns, the values inthis.aon[0,c)are undefined. Writing meaningful values to these indices is up to the caller.- Parameters:
c- The count of new values that will be inserted
-
append
public void append(Object v)
- Specified by:
appendin interfaceObjectsModifiable
-
append
public void append(Objects vs)
- Specified by:
appendin interfaceObjectsModifiable
-
append
public void append(Objects vs, int from, int to)
- Specified by:
appendin interfaceObjectsModifiable
-
append
public void append(Object[] vs)
- Specified by:
appendin interfaceObjectsModifiable
-
append
public void append(Object[] vs, int from, int to)
- Specified by:
appendin interfaceObjectsModifiable
-
prepForAppend
public void prepForAppend(int c)
Makes room in this array for new values to be appended. When this call returns, the values inthis.aon[this.n-c,this.n)are undefined. Writing meaningful values to these indices is up to the caller.- Parameters:
c- The count of new values that will be appended
-
remove
public void remove(Object v)
Description copied from interface:ObjectsModifiableRemoves a single copy of the specified value. If multiple copies are present, there is no guarantee which one will be removed.- Specified by:
removein interfaceObjectsModifiable
-
removeRange
public void removeRange(int from, int to)Description copied from interface:ObjectsModifiableRemoves values starting at index from (inclusive) to index to (exclusive). All other values with indices greater than or equal to index to have their index in the array decreased by to-from and the size of the array is decreased by to-from.- Specified by:
removeRangein interfaceObjectsModifiable
-
removeIndex
public void removeIndex(int index)
Description copied from interface:ObjectsModifiableRemove value at index. All other values with indices greater than index have their index in the array decreased by one and the size of the array is decreased by one.- Specified by:
removeIndexin interfaceObjectsModifiable
-
clear
public void clear()
- Specified by:
clearin interfaceObjectsModifiable
-
ensureCapacity
public void ensureCapacity(int minCapacity)
- Specified by:
ensureCapacityin interfaceObjectsModifiable
-
compact
public void compact()
- Specified by:
compactin interfaceObjectsModifiable
-
newArray
public static Object[] newArray(int oldCapacity, int minNewCapacity)
Creates a new array whose capacity is at least minNewCapacity, and at least 1.618 * oldCapacity, up to Integer.MAX_VALUE.
-
-