Class FlowStatistics<T>

java.lang.Object
com.amalgamasimulation.discreterate.flowstatistic.FlowStatistics<T>
Type Parameters:
T - the type of the flow element.

public class FlowStatistics<T> extends Object
Represents statistical data related to flow profiles for a collection of flow elements.
Author:
Alexander Morozov
  • Constructor Details

    • FlowStatistics

      public FlowStatistics(List<Bunker<T>> bunkers)
      Constructs a FlowStatistics instance that calculates the collective statistics for the provided list of bunkers, i.e. all specified bunkers are considered as a single bunker.
      Parameters:
      bunkers - a list of Bunker instances representing flow elements to be tracked for rate changes.
    • FlowStatistics

      public FlowStatistics(List<Bunker<T>> bunkers, Predicate<T> inflowMaterialFilter, Predicate<T> outflowMaterialFilter)
      Constructs a FlowStatistics instance that calculates the collective statistics for the provided list of bunkers, with filtered material flows. The statistics are calculated considering all specified bunkers as a single bunker, but only including materials that pass the provided filters.
      Parameters:
      bunkers - a list of Bunker instances representing flow elements to be tracked for rate changes
      inflowMaterialFilter - a predicate that determines which materials should be included in inflow statistics (returns true to include)
      outflowMaterialFilter - a predicate that determines which materials should be included in outflow statistics (returns true to include)
  • Method Details

    • inflowProfile

      public FlowProfile<T> inflowProfile()
      Returns the FlowProfile that contains inflow statistics for the tracked flow elements.
      Returns:
      the FlowProfile instance representing the inflow statistics for the tracked flow elements
    • outflowProfile

      public FlowProfile<T> outflowProfile()
      Returns the FlowProfile that contains outflow statistics for the tracked flow elements.
      Returns:
      the FlowProfile instance representing the outflow statistics for the tracked flow elements
    • stockProfile

      public FlowProfile<T> stockProfile()
      Returns the FlowProfile that contains stock statistics for the tracked flow elements. FlowProfile contains the initial amount of material located in tracked flow elements before the creation of FlowStatistics.

      FlowStatistics does not take into account manual placement of materials in tracked flow elements using the Bunker.addContents(Accumulator) and Bunker.replaceContents(Accumulator) methods.

      Returns:
      the FlowProfile instance representing the stock statistics for the tracked flow elements
    • inflowWithin

      public Accumulator<T> inflowWithin(Interval interval)
      Calculates the incoming flow of the tracked flow elements within the specified time Interval.
      Parameters:
      interval - the Interval defining the time span for which to calculate the flow
      Returns:
      an Accumulator containing the flow values within the specified time interval
    • inflowWithin

      public double inflowWithin(T element, Interval interval)
      Calculates the incoming flow for a specified element within the given time Interval.
      Parameters:
      element - the element for which to calculate the flow
      interval - the Interval defining the time span for which to calculate the flow
      Returns:
      the flow value for the specified element within the specified time Interval
    • outflowWithin

      public Accumulator<T> outflowWithin(Interval interval)
      Calculates the outgoing flow of the tracked flow elements within the specified time Interval.
      Parameters:
      interval - the Interval defining the time span for which to calculate the flow
      Returns:
      an Accumulator containing the flow values within the specified time interval
    • outflowWithin

      public double outflowWithin(T element, Interval interval)
      Calculates the outgoing flow for a specified element within the given time Interval.
      Parameters:
      element - the element for which to calculate the flow
      interval - the Interval defining the time span for which to calculate the flow
      Returns:
      the flow value for the specified element within the specified time Interval