com.metsci.glimpse.util.primitives
Class BooleansArray

java.lang.Object
  extended by com.metsci.glimpse.util.primitives.BooleansArray
All Implemented Interfaces:
Booleans, BooleansModifiable

public class BooleansArray
extends java.lang.Object
implements BooleansModifiable

Author:
hogye

Field Summary
 boolean[] a
           
 int n
           
 
Constructor Summary
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(Booleans xs)
          Clones the sequence arg.
BooleansArray(int n)
           
 
Method Summary
 void append(boolean v)
           
 void append(boolean[] vs)
           
 void append(boolean[] vs, int from, int to)
           
 void append(Booleans vs)
           
 void append(Booleans vs, int from, int to)
           
 void compact()
           
 boolean[] copyOf()
           
 boolean[] copyOf(int i, int c)
           
 void copyTo(int i, boolean[] dest, int iDest, int c)
           
 void ensureCapacity(int minCapacity)
           
 boolean first()
           
 void insert(int i, boolean v)
           
 void insert(int i, boolean[] vs)
           
 void insert(int i, boolean[] vs, int from, int to)
           
 void insert(int i, Booleans vs)
           
 void insert(int i, Booleans vs, int from, int to)
           
 boolean isEmpty()
           
 boolean last()
           
 int n()
          Length of the sequence
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.
 void prepend(boolean v)
           
 void prepend(boolean[] vs)
           
 void prepend(boolean[] vs, int from, int to)
           
 void prepend(Booleans vs)
           
 void prepend(Booleans vs, int from, int to)
           
 void prepForAppend(int c)
          Makes room in this array for new values to be appended.
 void prepForInsert(int i, int c)
          Makes room in this array for new values to be inserted.
 void prepForPrepend(int c)
          Makes room in this array for new values to be prepended.
 void remove(boolean v)
          Removes a single copy of the specified value.
 void set(int i, boolean v)
           
 boolean v(int i)
          Value at index i
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

public boolean[] a

n

public int n
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: Booleans
Value at index i

Specified by:
v in interface Booleans

n

public int n()
Description copied from interface: Booleans
Length of the sequence

Specified by:
n in interface Booleans

copyTo

public void copyTo(int i,
                   boolean[] dest,
                   int iDest,
                   int c)
Specified by:
copyTo in interface Booleans

copyOf

public boolean[] copyOf(int i,
                        int c)
Specified by:
copyOf in interface Booleans

copyOf

public boolean[] copyOf()
Specified by:
copyOf in interface Booleans

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Booleans

first

public boolean first()
Specified by:
first in interface Booleans

last

public boolean last()
Specified by:
last in interface Booleans

set

public void set(int i,
                boolean v)
Specified by:
set in interface BooleansModifiable

insert

public void insert(int i,
                   boolean v)
Specified by:
insert in interface BooleansModifiable

insert

public void insert(int i,
                   Booleans vs)
Specified by:
insert in interface BooleansModifiable

insert

public void insert(int i,
                   Booleans vs,
                   int from,
                   int to)
Specified by:
insert in interface BooleansModifiable

insert

public void insert(int i,
                   boolean[] vs)
Specified by:
insert in interface BooleansModifiable

insert

public void insert(int i,
                   boolean[] vs,
                   int from,
                   int to)
Specified by:
insert in interface BooleansModifiable

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 in this.a on [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 inserted
c - The count of new values that will be inserted

prepend

public void prepend(boolean v)
Specified by:
prepend in interface BooleansModifiable

prepend

public void prepend(Booleans vs)
Specified by:
prepend in interface BooleansModifiable

prepend

public void prepend(Booleans vs,
                    int from,
                    int to)
Specified by:
prepend in interface BooleansModifiable

prepend

public void prepend(boolean[] vs)
Specified by:
prepend in interface BooleansModifiable

prepend

public void prepend(boolean[] vs,
                    int from,
                    int to)
Specified by:
prepend in interface BooleansModifiable

prepForPrepend

public void prepForPrepend(int c)
Makes room in this array for new values to be prepended. When this call returns, the values in this.a on [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:
append in interface BooleansModifiable

append

public void append(Booleans vs)
Specified by:
append in interface BooleansModifiable

append

public void append(Booleans vs,
                   int from,
                   int to)
Specified by:
append in interface BooleansModifiable

append

public void append(boolean[] vs)
Specified by:
append in interface BooleansModifiable

append

public void append(boolean[] vs,
                   int from,
                   int to)
Specified by:
append in interface BooleansModifiable

prepForAppend

public void prepForAppend(int c)
Makes room in this array for new values to be appended. When this call returns, the values in this.a on [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: BooleansModifiable
Removes a single copy of the specified value. If multiple copies are present, there is no guarantee which one will be removed.

Specified by:
remove in interface BooleansModifiable

ensureCapacity

public void ensureCapacity(int minCapacity)
Specified by:
ensureCapacity in interface BooleansModifiable

compact

public void compact()
Specified by:
compact in interface BooleansModifiable

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.



Copyright © 2012 Metron, Inc.. All Rights Reserved.