Class AbstractWeightedArrayFunction

java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.weighted.functions.AbstractWeightedArrayFunction
All Implemented Interfaces:
EventListener, UpdatableSource
Direct Known Subclasses:
Weighted_MeanArrayFunction, Weighted_SumArrayFunction

public abstract class AbstractWeightedArrayFunction extends AbstractFunction
This class represents the skeleton for all the function which operate on array of native data type values, appropriately weighted by weights specified in a corresponding array of doubles. Each inheriting class automatically implements the UpdatableSource and the EventListener, which are managed by the AbstractWeightedArrayFunction.
  • Field Details

  • Constructor Details

    • AbstractWeightedArrayFunction

      public AbstractWeightedArrayFunction(@NonNull @NonNull WeightedDoubleArraySource source)
      Create a function on a double array source.
      Parameters:
      source - The data source.
    • AbstractWeightedArrayFunction

      public AbstractWeightedArrayFunction(@NonNull @NonNull WeightedIntArraySource source)
      Create a function on an integer array source.
      Parameters:
      source - The data source.
    • AbstractWeightedArrayFunction

      public AbstractWeightedArrayFunction(@NonNull @NonNull WeightedLongArraySource source)
      Create a function on a long array source.
      Parameters:
      source - The data source.
  • Method Details

    • applyFunction

      public void applyFunction()
      Force 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 @NonNull [] data, double @NonNull [] weights)
      Apply the function to the given array of double values.
      Parameters:
      data - A source array of values.
      weights - An array of weights.
      Throws:
      UnsupportedOperationException - If the function is not able to work on double data type.
    • apply

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

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