Class build
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>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStatus of this ticket.static classThese are the type of activity to be performed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.simsilica.es.EntityIdBuilt EntityId - the actual final built entity.private IntegerHow many days construction has been completed so far.private IntegerBased on the item's spec, current estimate of how many days it should take to construct the item.private static longprivate com.simsilica.es.EntityIdThe entity we will be installing into - this can only be on INSTALL tickets.private static org.slf4j.Loggerprivate manufactureAll these tickets must be COMPLETED before we can progressToCompleted this ticket.private build.PROGRESSWhat state is this build in? Controlled by the containing buildQueue.private com.simsilica.es.EntityIdSpecification Entity - the blueprint of the thing we are building.private build.TYPEWhat type of construction are we doing, one of the TYPE enum.private StringA unique ID given to this build ticket. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPrerequisite(build b)Add a build that must be completed before this one can be.Move ticket from REQUEST -> BLOCKED.com.simsilica.es.EntityIdAll the tickets that are prerequisites for this ticket.com.simsilica.es.EntityIdgetType()getUID()each build created can have a uniqueID generated to act as a ticket number.Progress this build by one day if possible.voidCauses the ticket to reprocess it's prerequisites, so this is needed if new prerequisites are added during processing.voidsetBuiltentity(com.simsilica.es.EntityId built_eid)Set by manufacturing process.voidsetDaysEstimate(Integer daysEstimate)Set the best estimate for the TOTAL number of days to build this.voidsetDead()Kill of the ticket losing any work in progress or booked.voidMove ticket from BLOCKED -> INPROGRESStoString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
hashcounter
private static long hashcounter -
UID
A unique ID given to this build ticket. -
type
What type of construction are we doing, one of the TYPE enum. -
progress
What state is this build in? Controlled by the containing buildQueue. -
specId
private final com.simsilica.es.EntityId specIdSpecification 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 builtEntityBuilt 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 installintoThe entity we will be installing into - this can only be on INSTALL tickets. -
manufacture
-
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
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
All these tickets must be COMPLETED before we can progressToCompleted this ticket.
-
-
Constructor Details
-
build
- Parameters:
type-specid-
-
-
Method Details
-
getUID
each build created can have a uniqueID generated to act as a ticket number.- Returns:
-
getManufacture
-
getSpecId
public com.simsilica.es.EntityId getSpecId()- Returns:
-
getType
- Returns:
-
getProgress
- Returns:
-
getDaysElapsed
- Returns:
-
getDaysEstimate
- Returns:
- current best estimate.
-
addPrerequisite
Add a build that must be completed before this one can be.- Parameters:
b-- Returns:
-
getPrerequisites
All the tickets that are prerequisites for this ticket.- Returns:
-
getBuiltEntity
public com.simsilica.es.EntityId getBuiltEntity()- Returns:
-
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
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
Move ticket from REQUEST -> BLOCKED. Calculated the daystobuild from the manufacture component.- Parameters:
mc-- Returns:
-
toString
-