Class ConveyorRateRecord<T>

java.lang.Object
com.amalgamasimulation.discreterate.ConveyorRateRecord<T>
Type Parameters:
T - type (class or interface) whose instances represent materials

public final class ConveyorRateRecord<T> extends Object
ConveyorRateRecord represents a portion of material mix that travels along a Conveyor.

The important invariants that remain the same along the whole length of a portion of material mix represented by a ConveyorRateRecord are:

  1. Material mix proportions. At each point of the ConveyorRateRecord, the proportions of materials in the material mix of the record are the same.
  2. Flow rate. The material flow rate at each point of the ConveyorRateRecord is the same.
The most common usage scenario of a ConveyorRateRecord is animation of materials moving inside a Conveyor.

Instances of ConveyorRateRecord are not intended to be created or modified by a user. Instead, the current set of ConveyorRateRecords of a Conveyor can be obtained via its Conveyor.getRateRecords() method. It is safe to read data from a rate record in the simulation thread and in the animation thread using the IViewUpdaterService.

Author:
Alexander Morozov
  • Method Details

    • getRate

      public double getRate()
      Returns the current rate of this ConveyorRateRecord.

      Internally, the current rate calculation is based on the current speed of the ConveyorRateRecord's Conveyor. The material rate is the same along the whole length if the ConveyorRateRecord.

      Returns:
      rate of this ConveyorRateRecord
    • getBlockHeight

      public double getBlockHeight()
      Returns the height of a visual block representing this rate record.

      This method is primarily used for animation purposes.

      The returned value is equal to the rate at the maximum speed.

      Returns:
      height of a visual block representing this rate record
    • getPolyline

      public Polyline getPolyline()
      Returns a Polyline representing the location of this ConveyorRateRecord along its Conveyor's material path.
      Returns:
      Polyline representing the location of this ConveyorRateRecord along its Conveyor's material path
    • getAmount

      public double getAmount()
      Returns the total amount of all materials in the material mix portion described by this ConveyorRateRecord.
      Returns:
      total amount of all materials in the material mix portion described by this ConveyorRateRecord
    • getProportions

      public Accumulator<T> getProportions()
      Returns the Accumulator with material proportions of the material mix portion described by this ConveyorRateRecord.

      Each element of the returned Accumulator corresponds to a material inside the material mix portion of the rate record. The amount of each material in the Accumulator is the ratio of that material's amount in the material mix portion to the total amount of materials in the material mix portion. The sum of amounts in the Accumulator is equal to 1.

      Returns:
      Accumulator containing proportions of materials inside the ConveyorRateRecord
    • toString

      public String toString()
      Overrides:
      toString in class Object