Class AbstractArrayFunction

java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.functions.AbstractArrayFunction
All Implemented Interfaces:
EventListener, UpdatableSource
Direct Known Subclasses:
CountArrayFunction, MaxArrayFunction, MeanArrayFunction, MeanVarianceArrayFunction, MinArrayFunction, MovingAverageArrayFunction, PercentileArrayFunction, SumArrayFunction

public abstract class AbstractArrayFunction extends AbstractFunction
This class represents the skeleton for all the function which operate on array of native data type values. Each inheriting class automatically implements the UpdatableSource and the EventListener which are managed by the AbstractArrayFunction.
  • Field Details

  • Constructor Details

    • AbstractArrayFunction

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

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

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

    • applyFunction

      public void applyFunction()
      Forces the function to update itself. If the data source implements the UpdatableSource interface it is updated before reading data.
      Specified by:
      applyFunction in class AbstractFunction
    • apply

      public void apply(double[] data)
      Applies the function to the given array of double values.
      Parameters:
      data - A source array of values.
      Throws:
      UnsupportedOperationException - If the function is not able to work on double data type.
    • apply

      public void apply(int[] data)
      Applies the function to the given array of integer values.
      Parameters:
      data - A source array of values.
      Throws:
      UnsupportedOperationException - If the function is not able to work on double data type.
    • apply

      public void apply(long[] data)
      Applies the function to the given array of long values.
      Parameters:
      data - A source array of values.
      Throws:
      UnsupportedOperationException - If the function is not able to work on double data type.