Class DoubleArray

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

public class DoubleArray extends Object
This manages an array of doubles.
Version:
1.0
Author:
Douglas Brown
  • Constructor Summary

    Constructors
    Constructor
    Description
    DoubleArray(int initialLength, double initialValue)
    Constructs a DoubleArray object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    fill(double value)
    Fills elements of the array with the specified value.
    boolean
    fill(double value, int start, int end)
    Fills a subset of elements of 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 Details

    • 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 Details

    • 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 array with the specified value.
      Parameters:
      value - the value
      Returns:
      true if at least one element was changed
    • fill

      public boolean fill(double value, int start, int end)
      Fills a subset of elements of the array with the specified value.
      Parameters:
      value - the value
      start - the first index
      end - the last index
      Returns:
      true if at least one element was changed