Class FloatArray

java.lang.Object
org.sunflow.util.FloatArray

public final class FloatArray extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    FloatArray(int capacity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(float f)
    Append a float to the end of the array.
    final float
    get(int index)
    Read value from the array.
    final int
    Returns the number of elements added to the array.
    final void
    set(int index, float value)
    Write a value to the specified index.
    final float[]
    Return a copy of the array, trimmed to fit the size of its contents exactly.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FloatArray

      public FloatArray()
    • FloatArray

      public FloatArray(int capacity)
  • Method Details

    • add

      public final void add(float f)
      Append a float to the end of the array.
      Parameters:
      f -
    • set

      public final void set(int index, float value)
      Write a value to the specified index. Assumes the array is already big enough.
      Parameters:
      index -
      value -
    • get

      public final float get(int index)
      Read value from the array.
      Parameters:
      index - index into the array
      Returns:
      value at the specified index
    • getSize

      public final int getSize()
      Returns the number of elements added to the array.
      Returns:
      current size of the array
    • trim

      public final float[] trim()
      Return a copy of the array, trimmed to fit the size of its contents exactly.
      Returns:
      a new array of exactly the right length