org.opensourcephysics.media.core
Class DoubleArray

java.lang.Object
  extended by org.opensourcephysics.media.core.DoubleArray

public class DoubleArray
extends java.lang.Object

This manages an array of doubles.

Version:
1.0
Author:
Douglas Brown

Constructor Summary
DoubleArray(int initialLength, double initialValue)
          Constructs a DoubleArray object.
 
Method Summary
 boolean fill(double value)
          Fills elements of the the array with the specified value.
 double get(int n)
          Gets the specified array element.
 boolean set(int n, double value)
          Sets the specified array element.
 void setLength(int newLength)
          Sets the length of the array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleArray

public DoubleArray(int initialLength,
                   double initialValue)
Constructs a DoubleArray object.

Parameters:
initialLength - the initial length of the array
initialValue - the initial value of all array elements
Method Detail

get

public double get(int n)
Gets the specified array element.

Parameters:
n - the array index
Returns:
the value at the specified index

set

public boolean set(int n,
                   double value)
Sets the specified array element.

Parameters:
n - the array index
value - the new value of the element
Returns:
true if element was changed

setLength

public void setLength(int newLength)
Sets the length of the array.

Parameters:
newLength - the new length of the array

fill

public boolean fill(double value)
Fills elements of the the array with the specified value.

Parameters:
value - the value
Returns:
true if at least one element was changed