Class CountArrayFunction

All Implemented Interfaces:
EventListener, DoubleSource, IntSource, UpdatableSource

public class CountArrayFunction extends AbstractArrayFunction implements DoubleSource, IntSource
This class computes the number of values in an array taken from a data source. The mean function return always an int value, so it implements the IntSource interface and the standard DoubleSource one.
  • Field Details

    • count

      protected int count
  • Constructor Details

    • CountArrayFunction

      public CountArrayFunction(@NonNull @NonNull IntArraySource source)
      Creates a count function on an integer array source.
      Parameters:
      source - The data source.
      Throws:
      NullPointerException - when source is null.
    • CountArrayFunction

      public CountArrayFunction(@NonNull @NonNull LongArraySource source)
      Creates a count function on a long array source.
      Parameters:
      source - The data source.
      Throws:
      NullPointerException - when source is null.
    • CountArrayFunction

      public CountArrayFunction(@NonNull @NonNull DoubleArraySource source)
      Creates a count function on a double array source.
      Parameters:
      source - The data source.
      Throws:
      NullPointerException - when source is null.
  • Method Details

    • apply

      public void apply(double @NonNull [] data)
      Applies the function to the given array of double values.
      Overrides:
      apply in class AbstractArrayFunction
      Parameters:
      data - A source array of values.
    • apply

      public void apply(int @NonNull [] data)
      Applies the function to the given array of integer values.
      Overrides:
      apply in class AbstractArrayFunction
      Parameters:
      data - A source array of values.
    • apply

      public void apply(long @NonNull [] data)
      Applies the function to the given array of long values.
      Overrides:
      apply in class AbstractArrayFunction
      Parameters:
      data - A source array of values.
    • getDoubleValue

      public double getDoubleValue(@NonNull @NonNull Enum<?> variableID)
      Returns the double value corresponding to the given variableID
      Specified by:
      getDoubleValue in interface DoubleSource
      Parameters:
      variableID - A unique identifier for a variable.
      Returns:
      The current double value of the required variable.
    • getIntValue

      public int getIntValue(@NonNull @NonNull Enum<?> id)
      Returns the integer value corresponding to the given variableID
      Specified by:
      getIntValue in interface IntSource
      Parameters:
      id - A unique identifier for a variable.
      Returns:
      The current integer value of the required variable.