Class MovingAverageTraceFunction

java.lang.Object
microsim.statistics.functions.AbstractFunction
microsim.statistics.functions.MovingAverageTraceFunction
All Implemented Interfaces:
EventListener, IDoubleSource, IUpdatableSource

public class MovingAverageTraceFunction extends AbstractFunction implements IDoubleSource
This class computes the average of the last values collected from a data source. The number of values used to compute the average value is specified in the constructor. The mean function return always double values, so it implements only the IDoubleSource interface.

Title: JAS

Description: Java Agent-based Simulation library

Copyright (C) 2002 Michele Sonnessa

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Author:
Michele Sonnessa, Ross Richardson
  • Field Details

    • TYPE_DBL

      protected static final int TYPE_DBL
      See Also:
    • TYPE_FLT

      protected static final int TYPE_FLT
      See Also:
    • TYPE_INT

      protected static final int TYPE_INT
      See Also:
    • TYPE_LNG

      protected static final int TYPE_LNG
      See Also:
    • dblSource

      protected IDoubleSource dblSource
    • fltSource

      protected IFloatSource fltSource
    • intSource

      protected IIntSource intSource
    • lngSource

      protected ILongSource lngSource
    • type

      protected int type
    • valueID

      protected Enum<?> valueID
    • len

      protected int len
    • values

      protected double[] values
    • average

      protected double average
    • valueCount

      protected int valueCount
  • Constructor Details

    • MovingAverageTraceFunction

      public MovingAverageTraceFunction(IDoubleSource source, Enum<?> valueID, int windowSize)
      Create a basic statistic probe on a IDoubleSource object.
      Parameters:
      source - The IDoubleSource object.
      valueID - The value identifier defined by source object.
    • MovingAverageTraceFunction

      public MovingAverageTraceFunction(IFloatSource source, Enum<?> valueID, int windowSize)
      Create a basic statistic probe on a IFloatSource object.
      Parameters:
      source - The IFloatSource object.
      valueID - The value identifier defined by source object.
    • MovingAverageTraceFunction

      public MovingAverageTraceFunction(ILongSource source, Enum<?> valueID, int windowSize)
      Create a basic statistic probe on a ILongSource object.
      Parameters:
      source - The ILongSource object.
      valueID - The value identifier defined by source object.
    • MovingAverageTraceFunction

      public MovingAverageTraceFunction(IIntSource source, Enum<?> valueID, int windowSize)
      Create a basic statistic probe on a IIntSource object.
      Parameters:
      source - The IIntSource object.
      valueID - The value identifier defined by source object.
  • Method Details