com.metsci.glimpse.util.primitives
Class FloatsArray

java.lang.Object
  extended by com.metsci.glimpse.util.primitives.FloatsArray
All Implemented Interfaces:
Floats, FloatsModifiable

public class FloatsArray
extends java.lang.Object
implements FloatsModifiable

Author:
hogye

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

n

public int n
Constructor Detail

FloatsArray

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


FloatsArray

public FloatsArray(int n)

FloatsArray

public FloatsArray()

FloatsArray

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


FloatsArray

public FloatsArray(Floats xs)
Clones the sequence arg.

Method Detail

v

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

Specified by:
v in interface Floats

n

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

Specified by:
n in interface Floats

copyTo

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

copyOf

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

copyOf

public float[] copyOf()
Specified by:
copyOf in interface Floats

isEmpty

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

first

public float first()
Specified by:
first in interface Floats

last

public float last()
Specified by:
last in interface Floats

set

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

insert

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

insert

public void insert(int i,
                   Floats vs)
Specified by:
insert in interface FloatsModifiable

insert

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

insert

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

insert

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

insert

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

insert

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

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

prepend

public void prepend(Floats vs)
Specified by:
prepend in interface FloatsModifiable

prepend

public void prepend(Floats vs,
                    int from,
                    int to)
Specified by:
prepend in interface FloatsModifiable

prepend

public void prepend(float[] vs)
Specified by:
prepend in interface FloatsModifiable

prepend

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

prepend

public void prepend(java.nio.FloatBuffer vs)
Specified by:
prepend in interface FloatsModifiable

prepend

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

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

append

public void append(Floats vs)
Specified by:
append in interface FloatsModifiable

append

public void append(Floats vs,
                   int from,
                   int to)
Specified by:
append in interface FloatsModifiable

append

public void append(float[] vs)
Specified by:
append in interface FloatsModifiable

append

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

append

public void append(java.nio.FloatBuffer vs)
Specified by:
append in interface FloatsModifiable

append

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

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

ensureCapacity

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

compact

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

newArray

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