Class FlowEnvironment<T>

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

public final class FlowEnvironment<T> extends Object
A FlowEnvironment represents a system where material can be stored within or transported between flow elements.

Flow environment acts as a container for FlowElements and for connections between them. All flow elements connected to each other must belong to the same instance of FlowEnvironment.

Several flow environments can coexist.

Author:
Alexander Morozov
  • Constructor Details

    • FlowEnvironment

      public FlowEnvironment(Engine engine)
      Creates a new flow environment instance.
      Parameters:
      engine - instance of Engine class for this flow environment
  • Method Details

    • getEngine

      public Engine getEngine()
      Returns the Engine which this flow environment belongs to
      Returns:
      Engine which this flow environment belongs to
    • init

      public void init()
      Initializes this FlowEnvironment. Initialization is necessary to start simulation of material flow.
    • isConnected

      public boolean isConnected(FlowElement<T> element1, FlowElement<T> element2)
      Checks whether a connection between element1 and element2 exists. The direction of a connection is arbitrary.
      Parameters:
      element1 - flow element
      element2 - flow element
      Returns:
      true if element1 and element2 are connected in either direction, false otherwise
      See Also:
    • getFlowConnection

      public FlowConnection<T> getFlowConnection(FlowElement<T> element1, FlowElement<T> element2)
      Returns the FlowConnection between element1 and element2, if such a connection exists. The connection may have any direction.
      Returns null if no connection exists.
      Parameters:
      element1 - a flow element
      element2 - a flow element
      Returns:
      an existing FlowConnection between element1 and element2, null otherwise