Class build

java.lang.Object
name.moore.kevin.ze.game.build

public class build extends Object
A build ticket that describes a task in the manufacturing process.

A 'build' is a unit of construction or repair work to be done, a single job ticket. This class tracks the build progressToCompleted and status and is the element of a buildQueue. It doesnt do logic or processing, it just holds data that is manipulated in the manufacturingState.

Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • hashcounter

      private static long hashcounter
    • UID

      private String UID
      A unique ID given to this build ticket.
    • type

      private build.TYPE type
      What type of construction are we doing, one of the TYPE enum.
    • progress

      private build.PROGRESS progress
      What state is this build in? Controlled by the containing buildQueue.
    • specId

      private final com.simsilica.es.EntityId specId
      Specification Entity - the blueprint of the thing we are building.

      Entity of spec with appliesto, manufacture, (maybe null) container, Name components.

    • builtEntity

      private com.simsilica.es.EntityId builtEntity
      Built EntityId - the actual final built entity.

      Set when the ticket is marked as COMPLETED, until then EntityId.NULL_ID.

    • installinto

      private com.simsilica.es.EntityId installinto
      The entity we will be installing into - this can only be on INSTALL tickets.
    • manufacture

      private manufacture manufacture
    • daysElapsed

      private Integer daysElapsed
      How many days construction has been completed so far.

      Increments as the builder processes the build. Once this equals the daysEstimate value we are completed and set the progress field to COMPLETED

      See Also:
      progress
    • daysEstimate

      private Integer daysEstimate
      Based on the item's spec, current estimate of how many days it should take to construct the item.

      This may change as, for instance, damage occurs to the builder. It is calculated by the manufacturingState.

      See Also:
      setDaysEstimate(java.lang.Integer)
    • prerequisites

      List<build> prerequisites
      All these tickets must be COMPLETED before we can progressToCompleted this ticket.
  • Constructor Details

    • build

      public build(build.TYPE type, com.simsilica.es.EntityId specid)
      Parameters:
      type -
      specid -
  • Method Details

    • getUID

      public String getUID()
      each build created can have a uniqueID generated to act as a ticket number.
      Returns:
    • getManufacture

      public manufacture getManufacture()
    • getSpecId

      public com.simsilica.es.EntityId getSpecId()
      Returns:
    • getType

      public build.TYPE getType()
      Returns:
    • getProgress

      public build.PROGRESS getProgress()
      Returns:
    • getDaysElapsed

      public Integer getDaysElapsed()
      Returns:
    • getDaysEstimate

      public Integer getDaysEstimate()
      Returns:
      current best estimate.
    • addPrerequisite

      public boolean addPrerequisite(build b)
      Add a build that must be completed before this one can be.
      Parameters:
      b -
      Returns:
    • getPrerequisites

      public List<build> getPrerequisites()
      All the tickets that are prerequisites for this ticket.
      Returns:
    • getBuiltEntity

      public com.simsilica.es.EntityId getBuiltEntity()
      Returns:
    • progressToCompleted

      public build progressToCompleted()
      Progress this build by one day if possible. Only a ticket at INPROGRESS can be progressed and all prerequisites COMPLETED. May change state:
      • INPROGRESS ->COMPLETED.
      Returns:
      ticket if COMPLETED, or null
    • setBuiltentity

      public void setBuiltentity(com.simsilica.es.EntityId built_eid)
      Set by manufacturing process.
      Parameters:
      built_eid -
    • setDaysEstimate

      public void setDaysEstimate(Integer daysEstimate)
      Set the best estimate for the TOTAL number of days to build this.

      Based on the spec and other factors such as damage to the builder, this needs calculating by the caller. It may be recalculated at anytime during the construction.

      Parameters:
      daysEstimate -
    • setDead

      public void setDead()
      Kill of the ticket losing any work in progress or booked. ->DEAD
    • startTicket

      public void startTicket()
      Move ticket from BLOCKED -> INPROGRESS
    • restartTicket

      public void restartTicket()
      Causes the ticket to reprocess it's prerequisites, so this is needed if new prerequisites are added during processing.
    • assignedTicket

      public build assignedTicket(manufacture mc)
      Move ticket from REQUEST -> BLOCKED. Calculated the daystobuild from the manufacture component.
      Parameters:
      mc -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object