Class BooleansArray
- java.lang.Object
-
- com.metsci.glimpse.util.primitives.BooleansArray
-
- All Implemented Interfaces:
Booleans,BooleansModifiable
public class BooleansArray extends Object implements BooleansModifiable
- Author:
- hogye
-
-
Constructor Summary
Constructors Constructor Description BooleansArray()BooleansArray(boolean[] a)For efficiency, does not clone the array arg.BooleansArray(boolean[] a, int n)For efficiency, does not clone the array arg.BooleansArray(int n)BooleansArray(Booleans xs)Clones the sequence arg.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(boolean v)voidappend(boolean[] vs)voidappend(boolean[] vs, int from, int to)voidappend(Booleans vs)voidappend(Booleans vs, int from, int to)voidclear()voidcompact()BooleansArraycopy()boolean[]copyOf()boolean[]copyOf(int i, int c)voidcopyTo(int i, boolean[] dest, int iDest, int c)voidensureCapacity(int minCapacity)booleanfirst()voidinsert(int i, boolean v)voidinsert(int i, boolean[] vs)voidinsert(int i, boolean[] vs, int from, int to)voidinsert(int i, Booleans vs)voidinsert(int i, Booleans vs, int from, int to)booleanisEmpty()booleanlast()intn()Length of the sequencestatic boolean[]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(boolean v)voidprepend(boolean[] vs)voidprepend(boolean[] vs, int from, int to)voidprepend(Booleans vs)voidprepend(Booleans 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(boolean 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, boolean v)voidset(int i, boolean[] vs)voidset(int i, boolean[] vs, int from, int to)booleanv(int i)Value at index i
-
-
-
Constructor Detail
-
BooleansArray
public BooleansArray(boolean[] a)
For efficiency, does not clone the array arg.
-
BooleansArray
public BooleansArray(int n)
-
BooleansArray
public BooleansArray()
-
BooleansArray
public BooleansArray(boolean[] a, int n)For efficiency, does not clone the array arg.
-
BooleansArray
public BooleansArray(Booleans xs)
Clones the sequence arg.
-
-
Method Detail
-
v
public boolean v(int i)
Description copied from interface:BooleansValue at index i
-
n
public int n()
Description copied from interface:BooleansLength of the sequence
-
copyTo
public void copyTo(int i, boolean[] dest, int iDest, int c)
-
copy
public BooleansArray copy()
- Specified by:
copyin interfaceBooleans- Specified by:
copyin interfaceBooleansModifiable
-
set
public void set(int i, boolean v)- Specified by:
setin interfaceBooleansModifiable
-
set
public void set(int i, boolean[] vs)- Specified by:
setin interfaceBooleansModifiable
-
set
public void set(int i, boolean[] vs, int from, int to)- Specified by:
setin interfaceBooleansModifiable
-
insert
public void insert(int i, boolean v)- Specified by:
insertin interfaceBooleansModifiable
-
insert
public void insert(int i, Booleans vs)- Specified by:
insertin interfaceBooleansModifiable
-
insert
public void insert(int i, Booleans vs, int from, int to)- Specified by:
insertin interfaceBooleansModifiable
-
insert
public void insert(int i, boolean[] vs)- Specified by:
insertin interfaceBooleansModifiable
-
insert
public void insert(int i, boolean[] vs, int from, int to)- Specified by:
insertin interfaceBooleansModifiable
-
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(boolean v)
- Specified by:
prependin interfaceBooleansModifiable
-
prepend
public void prepend(Booleans vs)
- Specified by:
prependin interfaceBooleansModifiable
-
prepend
public void prepend(Booleans vs, int from, int to)
- Specified by:
prependin interfaceBooleansModifiable
-
prepend
public void prepend(boolean[] vs)
- Specified by:
prependin interfaceBooleansModifiable
-
prepend
public void prepend(boolean[] vs, int from, int to)- Specified by:
prependin interfaceBooleansModifiable
-
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(boolean v)
- Specified by:
appendin interfaceBooleansModifiable
-
append
public void append(Booleans vs)
- Specified by:
appendin interfaceBooleansModifiable
-
append
public void append(Booleans vs, int from, int to)
- Specified by:
appendin interfaceBooleansModifiable
-
append
public void append(boolean[] vs)
- Specified by:
appendin interfaceBooleansModifiable
-
append
public void append(boolean[] vs, int from, int to)- Specified by:
appendin interfaceBooleansModifiable
-
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(boolean v)
Description copied from interface:BooleansModifiableRemoves a single copy of the specified value. If multiple copies are present, there is no guarantee which one will be removed.- Specified by:
removein interfaceBooleansModifiable
-
removeRange
public void removeRange(int from, int to)Description copied from interface:BooleansModifiableRemoves 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 interfaceBooleansModifiable
-
removeIndex
public void removeIndex(int index)
Description copied from interface:BooleansModifiableRemove 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 interfaceBooleansModifiable
-
clear
public void clear()
- Specified by:
clearin interfaceBooleansModifiable
-
ensureCapacity
public void ensureCapacity(int minCapacity)
- Specified by:
ensureCapacityin interfaceBooleansModifiable
-
compact
public void compact()
- Specified by:
compactin interfaceBooleansModifiable
-
newArray
public static boolean[] 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.
-
-