com.partnersoft.data
Class DynamicDoubleArray

java.lang.Object
  extended by com.partnersoft.data.DynamicArray
      extended by com.partnersoft.data.DynamicDoubleArray
Direct Known Subclasses:
FastXyCoordinateArray

public class DynamicDoubleArray
extends DynamicArray

A managed, dynamically allocated array of double.

Copyright 2001-2007 Partner Software, Inc.

Version:
$Id: DynamicDoubleArray.java 1366 2008-06-19 20:13:28Z paul $
Author:
Paul Reavis

Field Summary
 double[] array
           
 
Fields inherited from class com.partnersoft.data.DynamicArray
arrayObject, capacity, end, fastGrowthFactor, fastGrowthLimit, slowGrowthAmount, start
 
Constructor Summary
DynamicDoubleArray()
          Creates an empty double array, with size and capacity of 0.
DynamicDoubleArray(double... contents)
          Creates a double array with the given initial contents.
DynamicDoubleArray(DynamicFloatArray floats)
          Creates a double array, copying the contents of the given DynamicFloatArray.
DynamicDoubleArray(int capacity)
          Creates a double array of the given capacity.
DynamicDoubleArray(java.lang.String values)
          Creates a double array, parsing the given input string as a space-delimited list of values.
 
Method Summary
 void add(double what)
          Appends a single double to the end of this array.
 void append(double... stuff)
          Appends the given doubles to the end of this array.
 java.lang.String contentsToString()
          Returns the contents as a String.
 void newArray(int size)
          Allocates a new, empty array of the given size and assign it to the arrayObject property.
 double[] toDoubleArray()
           
 
Methods inherited from class com.partnersoft.data.DynamicArray
append, clear, copy, copy, copyExactly, copyFrom, copyTo, insert, isEmpty, makeRoomFor, makeRoomFor, pack, remove, size, subsection, tidy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

array

public double[] array
Constructor Detail

DynamicDoubleArray

public DynamicDoubleArray()
Creates an empty double array, with size and capacity of 0.


DynamicDoubleArray

public DynamicDoubleArray(int capacity)
Creates a double array of the given capacity.


DynamicDoubleArray

public DynamicDoubleArray(double... contents)
Creates a double array with the given initial contents.


DynamicDoubleArray

public DynamicDoubleArray(DynamicFloatArray floats)
Creates a double array, copying the contents of the given DynamicFloatArray.

Parameters:
floats - float array to copy.

DynamicDoubleArray

public DynamicDoubleArray(java.lang.String values)
Creates a double array, parsing the given input string as a space-delimited list of values.

Method Detail

add

public void add(double what)
Appends a single double to the end of this array.


append

public void append(double... stuff)
Appends the given doubles to the end of this array.


toDoubleArray

public double[] toDoubleArray()

contentsToString

public java.lang.String contentsToString()
Returns the contents as a String. toString() would have been a better name but is already taken.

Returns:

newArray

public void newArray(int size)
Description copied from class: DynamicArray
Allocates a new, empty array of the given size and assign it to the arrayObject property. It is assumed that subclasses will also set it to a variable of the correct class (e.g. char[]) for ease of access as well. Copying of existing contents is Dynamic by this superclass. Your code should look something like this:
 public abstract void newArray(int size) {
     arrayObject = array = new Foo[size];
 }
 

Specified by:
newArray in class DynamicArray