java.lang.Object
com.assemblyrobot.simulator.core.clock.TickAdvanceListener
com.assemblyrobot.simulator.system.components.Station
Direct Known Subclasses:
AssemblyStation, ErrorCheckStation, FixStation

public abstract class Station
extends TickAdvanceListener
Abstract super class for all station classes. Contains methods to control a Material's flow in a Station
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  Station.Metrics  
  • Constructor Summary

    Constructors
    Constructor Description
    Station​(StageController stageController, java.lang.String id)  
  • Method Summary

    Modifier and Type Method Description
    void addToStationQueue​(@NonNull Material material, @NonNull StageID stageId)
    Adds the Material to the Station's queue materialQueue.
    protected boolean canPull()
    Checks if a Material can be pulled from the materialQueue.
    protected abstract long getProcessingTime()
    Gets the processing duration of the Station from a corresponding generator.
    int getQueueLength()
    Returns the length of the queue for this station.
    boolean isBusy()
    Checks if Station is currently processing another Material.
    protected void onTickAdvance​(long ticksAdvanced)
    Determines the status of the Material and coordinates its processing accordingly.
    protected void onTickReset()
    Callback method for when the clock tick was reset to 0.
    protected void processMaterial()
    Starts the processing of the Material.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Station

      public Station​(StageController stageController, java.lang.String id)
  • Method Details

    • getProcessingTime

      protected abstract long getProcessingTime()
      Gets the processing duration of the Station from a corresponding generator.
      Returns:
      Long
    • addToStationQueue

      public void addToStationQueue​(@NonNull @NonNull Material material, @NonNull @NonNull StageID stageId)
      Adds the Material to the Station's queue materialQueue. Also collects related data.
      Parameters:
      material - Material to add to the materialQueue
      stageId - ID of the Stage the Material is currently in
    • processMaterial

      protected void processMaterial()
      Starts the processing of the Material. Also collects related data.
    • isBusy

      public boolean isBusy()
      Checks if Station is currently processing another Material.
      Returns:
      Boolean
    • canPull

      protected boolean canPull()
      Checks if a Material can be pulled from the materialQueue.
      Returns:
      Boolean
    • onTickAdvance

      protected void onTickAdvance​(long ticksAdvanced)
      Determines the status of the Material and coordinates its processing accordingly. Also collects related data.
      Specified by:
      onTickAdvance in class TickAdvanceListener
      Parameters:
      ticksAdvanced - The amount of ticks that the clock has moved forward by.
    • getQueueLength

      public int getQueueLength()
      Returns the length of the queue for this station.
      Returns:
      Integer
    • onTickReset

      protected void onTickReset()
      Description copied from class: TickAdvanceListener
      Callback method for when the clock tick was reset to 0.
      Specified by:
      onTickReset in class TickAdvanceListener