com.metsci.glimpse.util.primitives
Class IntsArray

java.lang.Object
  extended by com.metsci.glimpse.util.primitives.IntsArray
All Implemented Interfaces:
Ints, IntsModifiable

public class IntsArray
extends java.lang.Object
implements IntsModifiable

Author:
hogye

Field Summary
 int[] a
           
 int n
           
 
Constructor Summary
IntsArray()
           
IntsArray(int n)
           
IntsArray(int[] a)
          For efficiency, does not clone the array arg.
IntsArray(int[] a, int n)
          For efficiency, does not clone the array arg.
IntsArray(Ints xs)
          Clones the sequence arg.
 
Method Summary
 void append(int v)
           
 void append(int[] vs)
           
 void append(int[] vs, int from, int to)
           
 void append(java.nio.IntBuffer vs)
           
 void append(java.nio.IntBuffer vs, int c)
           
 void append(Ints vs)
           
 void append(Ints vs, int from, int to)
           
 void compact()
           
 int[] copyOf()
           
 int[] copyOf(int i, int c)
           
 void copyTo(int i, int[] dest, int iDest, int c)
           
 void ensureCapacity(int minCapacity)
           
 int first()
           
 void insert(int i, int v)
           
 void insert(int i, int[] vs)
           
 void insert(int i, int[] vs, int from, int to)
           
 void insert(int i, java.nio.IntBuffer vs)
           
 void insert(int i, java.nio.IntBuffer vs, int c)
           
 void insert(int i, Ints vs)
           
 void insert(int i, Ints vs, int from, int to)
           
 boolean isEmpty()
           
 int last()
           
 int n()
          Length of the sequence
static int[] 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(int v)
           
 void prepend(int[] vs)
           
 void prepend(int[] vs, int from, int to)
           
 void prepend(java.nio.IntBuffer vs)
           
 void prepend(java.nio.IntBuffer vs, int c)
           
 void prepend(Ints vs)
           
 void prepend(Ints 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(int v)
          Removes a single copy of the specified value.
 void set(int i, int v)
           
 int 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 int[] a

n

public int n
Constructor Detail

IntsArray

public IntsArray(int[] a)
For efficiency, does not clone the array arg.


IntsArray

public IntsArray(int n)

IntsArray

public IntsArray()

IntsArray

public IntsArray(int[] a,
                 int n)
For efficiency, does not clone the array arg.


IntsArray

public IntsArray(Ints xs)
Clones the sequence arg.

Method Detail

v

public int v(int i)
Description copied from interface: Ints
Value at index i

Specified by:
v in interface Ints

n

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

Specified by:
n in interface Ints

copyTo

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

copyOf

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

copyOf

public int[] copyOf()
Specified by:
copyOf in interface Ints

isEmpty

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

first

public int first()
Specified by:
first in interface Ints

last

public int last()
Specified by:
last in interface Ints

set

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

insert

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

insert

public void insert(int i,
                   Ints vs)
Specified by:
insert in interface IntsModifiable

insert

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

insert

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

insert

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

insert

public void insert(int i,
                   java.nio.IntBuffer vs)
Specified by:
insert in interface IntsModifiable

insert

public void insert(int i,
                   java.nio.IntBuffer vs,
                   int c)
Specified by:
insert in interface IntsModifiable

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(int v)
Specified by:
prepend in interface IntsModifiable

prepend

public void prepend(Ints vs)
Specified by:
prepend in interface IntsModifiable

prepend

public void prepend(Ints vs,
                    int from,
                    int to)
Specified by:
prepend in interface IntsModifiable

prepend

public void prepend(int[] vs)
Specified by:
prepend in interface IntsModifiable

prepend

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

prepend

public void prepend(java.nio.IntBuffer vs)
Specified by:
prepend in interface IntsModifiable

prepend

public void prepend(java.nio.IntBuffer vs,
                    int c)
Specified by:
prepend in interface IntsModifiable

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(int v)
Specified by:
append in interface IntsModifiable

append

public void append(Ints vs)
Specified by:
append in interface IntsModifiable

append

public void append(Ints vs,
                   int from,
                   int to)
Specified by:
append in interface IntsModifiable

append

public void append(int[] vs)
Specified by:
append in interface IntsModifiable

append

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

append

public void append(java.nio.IntBuffer vs)
Specified by:
append in interface IntsModifiable

append

public void append(java.nio.IntBuffer vs,
                   int c)
Specified by:
append in interface IntsModifiable

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(int v)
Description copied from interface: IntsModifiable
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 IntsModifiable

ensureCapacity

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

compact

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

newArray

public static int[] 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.