Package rma.util

Class FloatArray

java.lang.Object
rma.util.FloatArray
All Implemented Interfaces:
AsciiSerializable, FieldAccessor, Serializable, Cloneable

public class FloatArray extends Object implements Cloneable, Serializable, AsciiSerializable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.
    protected int
    The number of valid components in the vector.
    protected float[]
    The array buffer into which the components of the vector are stored.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty FloatArray.
    FloatArray(float[] array)
    Constructs a new FloatArray with the capacity set to the argument array length then copies the argument array data into the element data array.
    FloatArray(int initialCapacity)
    Constructs an empty FloatArray with the specified initial capacity.
    FloatArray(int initialCapacity, int capacityIncrement)
    Constructs an empty FloatArray with the specified initial capacity and capacity increment.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(float obj)
    Adds the specified component to the end of this vector, increasing its size by one.
    boolean
    Appends all of the elements in the specified FloatArray to the end of this FloatArray, in the order that they are returned by the specified FloatArray's Iterator.
    final void
    addElement(float obj)
    Adds the specified component to the end of this vector, increasing its size by one.
    final int
    Returns the current capacity of this vector.
    void
    Removes all components from this vector and sets its size to zero.
    Returns a clone of this vector.
    final boolean
    contains(float elem)
    Tests if the specified float is a component in this vector.
    final void
    copyInto(float[] anArray)
    Copies the components of this FloatArray into the specified array.
    final float
    elementAt(int index)
    Returns the component at the specified index.
    float
    Returns the total value of all the elements
    final void
    ensureCapacity(int minCapacity)
    Increases the capacity of this FloatArray, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
    boolean
     
    final float
    Returns the first component of this vector.
    float
    get(int index)
    Returns the component at the specified index.
    Gets the FieldObject attribute of the DoubleArray object
    float
     
    float
     
    final int
    indexOf(float elem)
    Searches for the first occurence of the given argument, testing for equality using ==.
    final int
    indexOf(float elem, int index)
    Searches for the first occurence of the given argument, beginning the search at index , and testing for equality using ==.
    final void
    insertElementAt(float obj, int index)
    Inserts the specified float as a component in this vector at the specified index .
    final boolean
    Tests if this vector has no components.
    final float
    Returns the last component of the vector.
    final int
    lastIndexOf(float elem)
    Returns the index of the last occurrence of the specified float in this vector.
    final int
    lastIndexOf(float elem, int index)
    Searches backwards for the specified float, starting from the specified index, and returns an index to it.
    boolean
    remove(float obj)
    Removes the first occurrence of the argument from this vector.
    final void
    Removes all components from this vector and sets its size to zero.
    final boolean
    removeElement(float obj)
    Removes the first occurrence of the argument from this vector.
    final void
    removeElementAt(int index)
    Deletes the component at the float index.
    final void
    setElementAt(float obj, int index)
    Sets the float at the specified index of this vector to be the specified float.
    boolean
    Sets the FieldObject attribute of the DoubleArray object
    final void
    setSize(int newSize)
    Sets the size of this vector.
    final void
    setSize(int newSize, float defaultValue)
    Sets the size of this vector.
    final int
    Returns the number of components in this vector.
    float[]
    Returns an array containing all of the elements in this list in the correct order.
    Returns a string representation of this array.
    final void
    Trims the capacity of this FloatArray to be the FloatArray's current size.

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • _elementData

      protected float[] _elementData
      The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer.
    • _elementCount

      protected int _elementCount
      The number of valid components in the vector.
    • _capacityIncrement

      protected int _capacityIncrement
      The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. If the capacity increment is 0 , the capacity of the vector is doubled each time it needs to grow.
  • Constructor Details

    • FloatArray

      public FloatArray(int initialCapacity, int capacityIncrement)
      Constructs an empty FloatArray with the specified initial capacity and capacity increment.
      Parameters:
      initialCapacity - the initial capacity of the vector.
      capacityIncrement - the amount by which the capacity is increased when the vector overflows.
    • FloatArray

      public FloatArray(int initialCapacity)
      Constructs an empty FloatArray with the specified initial capacity.
      Parameters:
      initialCapacity - the initial capacity of the vector.
    • FloatArray

      public FloatArray()
      Constructs an empty FloatArray.
    • FloatArray

      public FloatArray(float[] array)
      Constructs a new FloatArray with the capacity set to the argument array length then copies the argument array data into the element data array.
      Parameters:
      array -
  • Method Details

    • copyInto

      public final void copyInto(float[] anArray)
      Copies the components of this FloatArray into the specified array. The array must be big enough to hold all the ints in this FloatArray.
      Parameters:
      anArray - the array into which the components get copied.
    • trimToSize

      public final void trimToSize()
      Trims the capacity of this FloatArray to be the FloatArray's current size. An application can use this operation to minimize the storage of a FloatArray.
    • ensureCapacity

      public final void ensureCapacity(int minCapacity)
      Increases the capacity of this FloatArray, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
      Parameters:
      minCapacity - the desired minimum capacity.
    • setSize

      public final void setSize(int newSize)
      Sets the size of this vector. If the new size is greater than the current size, new RMAConst.UNDEF_FLOAT items are added to the end of the vector. If the new size is less than the current size, all components at index newSize and greater are discarded.
      Parameters:
      newSize - the new size of this vector.
    • setSize

      public final void setSize(int newSize, float defaultValue)
      Sets the size of this vector. If the new size is greater than the current size, new defaultValue items are added to the end of the vector. If the new size is less than the current size, all components at index newSize and greater are discarded.
      Parameters:
      newSize - the new size of this vector.
      defaultValue - value to fill new array elements with
    • capacity

      public final int capacity()
      Returns the current capacity of this vector.
      Returns:
      the current capacity of this vector.
      Since:
      JDK1.0
    • size

      public final int size()
      Returns the number of components in this vector.
      Returns:
      the number of components in this vector.
      Since:
      JDK1.0
    • isEmpty

      public final boolean isEmpty()
      Tests if this vector has no components.
      Returns:
      true if this vector has no components; false otherwise.
      Since:
      JDK1.0
    • contains

      public final boolean contains(float elem)
      Tests if the specified float is a component in this vector.
      Parameters:
      elem - an int.
      Returns:
      true if the specified float is a component in this vector; false otherwise.
    • indexOf

      public final int indexOf(float elem)
      Searches for the first occurence of the given argument, testing for equality using ==.
      Parameters:
      elem - a float.
      Returns:
      the index of the first occurrence of the argument in this vector; returns -1 if the float is not found.
    • indexOf

      public final int indexOf(float elem, int index)
      Searches for the first occurence of the given argument, beginning the search at index , and testing for equality using ==.
      Parameters:
      elem - a float.
      index - the index to start searching from.
      Returns:
      the index of the first occurrence of the float argument in this vector at position index or later in the vector; returns -1 if the int is not found.
    • lastIndexOf

      public final int lastIndexOf(float elem)
      Returns the index of the last occurrence of the specified float in this vector.
      Parameters:
      elem - the desired component.
      Returns:
      the index of the last occurrence of the specified float in this vector; returns -1 if the float is not found.
    • lastIndexOf

      public final int lastIndexOf(float elem, int index)
      Searches backwards for the specified float, starting from the specified index, and returns an index to it.
      Parameters:
      elem - the desired component.
      index - the index to start searching from.
      Returns:
      the index of the last occurrence of the specified float in this vector at position less than index in the vector; -1 if the float is not found.
    • get

      public float get(int index)
      Returns the component at the specified index. wrapper for elementAt(int);
      Parameters:
      index - Description
      Returns:
      Description
    • elementAt

      public final float elementAt(int index)
      Returns the component at the specified index.
      Parameters:
      index - an index into this vector.
      Returns:
      the component at the specified index.
    • firstElement

      public final float firstElement()
      Returns the first component of this vector.
      Returns:
      the first component of this vector.
    • lastElement

      public final float lastElement()
      Returns the last component of the vector.
      Returns:
      the last component of the vector, i.e., the component at index size() - 1 .
    • setElementAt

      public final void setElementAt(float obj, int index)
      Sets the float at the specified index of this vector to be the specified float. The previous float at that position is discarded.

      The index must be a value greater than or equal to 0 and less than the current size of the vector.

      Parameters:
      obj - what the float is to be set to.
      index - the specified index.
      See Also:
    • removeElementAt

      public final void removeElementAt(int index)
      Deletes the component at the float index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously.

      The index must be a value greater than or equal to 0 and less than the current size of the vector.

      Parameters:
      index - the index of the float to remove.
      See Also:
    • insertElementAt

      public final void insertElementAt(float obj, int index)
      Inserts the specified float as a component in this vector at the specified index . Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

      The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector.

      Parameters:
      obj - the float to insert.
      index - where to insert the new component.
      See Also:
    • add

      public void add(float obj)
      Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity. wrapper for addElement(float);
      Parameters:
      obj - the float to be added
    • addAll

      public boolean addAll(FloatArray dv)
      Appends all of the elements in the specified FloatArray to the end of this FloatArray, in the order that they are returned by the specified FloatArray's Iterator. The behavior of this operation is undefined if the specified FloatArray is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified FloatArray is this FloatArray, and this FloatArray is nonempty.)
      Parameters:
      dv - the elements to be inserted into this list.
      Returns:
      true if this list changed as a result of the call.
      Throws:
      NullPointerException - if the specified FloatArray is null.
    • addElement

      public final void addElement(float obj)
      Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.
      Parameters:
      obj - the float to be added.
    • toArray

      public float[] toArray()
      Returns an array containing all of the elements in this list in the correct order.
      Returns:
      an array containing all of the elements in this list in the correct order.
    • remove

      public boolean remove(float obj)
      Removes the first occurrence of the argument from this vector. If the float is found in this vector, each component in the vector with an index greater or equal to the float's index is shifted downward to have an index one smaller than the value it had previously. wrapper for removeElement(float)
      Parameters:
      obj - the float to remove
      Returns:
      true if the argument was a component of this vector; false otherwise.
    • removeElement

      public final boolean removeElement(float obj)
      Removes the first occurrence of the argument from this vector. If the float is found in this vector, each component in the vector with an index greater or equal to the int's index is shifted downward to have an index one smaller than the value it had previously.
      Parameters:
      obj - the float to be removed.
      Returns:
      true if the argument was a component of this vector; false otherwise.
    • clear

      public void clear()
      Removes all components from this vector and sets its size to zero. wrapper for removeAllElements();
    • removeAllElements

      public final void removeAllElements()
      Removes all components from this vector and sets its size to zero.
    • clone

      public Object clone()
      Returns a clone of this vector.
      Overrides:
      clone in class Object
      Returns:
      a clone of this vector.
    • getMax

      public float getMax()
      Returns:
      the max value of the elements
    • getMin

      public float getMin()
      Returns:
      the min value of the elements
    • elementTotal

      public float elementTotal()
      Returns the total value of all the elements
    • toString

      public String toString()
      Returns a string representation of this array.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this array.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getFieldObject

      public Object getFieldObject(Field fld)
      Gets the FieldObject attribute of the DoubleArray object
      Specified by:
      getFieldObject in interface FieldAccessor
      Parameters:
      fld - Description
      Returns:
      The FieldObject value
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Sets the FieldObject attribute of the DoubleArray object
      Specified by:
      setFieldObject in interface FieldAccessor
      Parameters:
      fld - The new FieldObject value
      fobj - The new FieldObject value
      Returns:
      Description