Class FlowConnection<T>

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

public final class FlowConnection<T> extends Object
FlowConnection represents a directed connection between two FlowElements. When a connection is established between two flow elements, material can be sent from one to another.

The 'source' and 'destination' flow elements of a connection are set upon the creation of a connection instance and cannot be changed later.

Instances of this class are created by calling the FlowElement.connectToElement(FlowElement) method.

Author:
Alexander Morozov
  • Method Details

    • getRate

      public double getRate()
      Returns the current flow rate through this flow connection.
      Returns:
      current flow rate through this flow connection
    • getPassedMaterialsAmount

      public double getPassedMaterialsAmount()
      Returns the sum of quantities of all materials that have passed through the connection.
      Returns:
      sum of quantities of all materials that have passed through the connection
      See Also:
    • getPassedMaterialsDescriptor

      public Accumulator<T> getPassedMaterialsDescriptor()
      Returns an Accumulator that contains the quantities of each material that has passed through the connection.

      The returned Accumulator instance contains all such materials and their respective quantities. The sum of all quantities in the Accumulator is equal to the value returned by the getPassedMaterialsAmount() method.

      Returns:
      sum of all materials that have passed through the connection as an Accumulator instance
      See Also:
    • getNextElement

      public FlowElement<T> getNextElement()
      Returns the destination (receiver) FlowElement of this flow connection.
      Returns:
      destination flow element
      See Also:
    • getPrevElement

      public FlowElement<T> getPrevElement()
      Returns the source FlowElement of this flow connection.
      Returns:
      source flow element
      See Also:
    • getFlowProportions

      public Accumulator<T> getFlowProportions()
      Returns the current material proportions of the material flow of this flow connection.

      Each element of the returned Accumulator corresponds to a material in the current material flow of this connection. The amount of each material in the Accumulator is the ratio of that material's partial flow to the overall flow of this connection. The sum of amounts in the Accumulator is equal to 1.

      Returns:
      current material flow proportions