com.metsci.glimpse.util.primitives
Class DoublesArray

java.lang.Object
  extended by com.metsci.glimpse.util.primitives.DoublesArray
All Implemented Interfaces:
Doubles, DoublesModifiable

public class DoublesArray
extends java.lang.Object
implements DoublesModifiable

Author:
hogye

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

n

public int n
Constructor Detail

DoublesArray

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


DoublesArray

public DoublesArray(int n)

DoublesArray

public DoublesArray()

DoublesArray

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


DoublesArray

public DoublesArray(Doubles xs)
Clones the sequence arg.

Method Detail

v

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

Specified by:
v in interface Doubles

n

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

Specified by:
n in interface Doubles

copyTo

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

copyOf

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

copyOf

public double[] copyOf()
Specified by:
copyOf in interface Doubles

isEmpty

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

first

public double first()
Specified by:
first in interface Doubles

last

public double last()
Specified by:
last in interface Doubles

set

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

insert

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

insert

public void insert(int i,
                   Doubles vs)
Specified by:
insert in interface DoublesModifiable

insert

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

insert

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

insert

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

insert

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

insert

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

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

prepend

public void prepend(Doubles vs)
Specified by:
prepend in interface DoublesModifiable

prepend

public void prepend(Doubles vs,
                    int from,
                    int to)
Specified by:
prepend in interface DoublesModifiable

prepend

public void prepend(double[] vs)
Specified by:
prepend in interface DoublesModifiable

prepend

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

prepend

public void prepend(java.nio.DoubleBuffer vs)
Specified by:
prepend in interface DoublesModifiable

prepend

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

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

append

public void append(Doubles vs)
Specified by:
append in interface DoublesModifiable

append

public void append(Doubles vs,
                   int from,
                   int to)
Specified by:
append in interface DoublesModifiable

append

public void append(double[] vs)
Specified by:
append in interface DoublesModifiable

append

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

append

public void append(java.nio.DoubleBuffer vs)
Specified by:
append in interface DoublesModifiable

append

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

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

ensureCapacity

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

compact

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

newArray

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