org.mars_sim.msp.core.structure.construction
Class ConstructionSite

java.lang.Object
  extended by org.mars_sim.msp.core.structure.construction.ConstructionSite
All Implemented Interfaces:
java.io.Serializable

public class ConstructionSite
extends java.lang.Object
implements java.io.Serializable

A building construction site.

See Also:
Serialized Form

Field Summary
static java.lang.String ADD_CONSTRUCTION_STAGE_EVENT
           
static java.lang.String CREATE_BUILDING_EVENT
           
static java.lang.String END_UNDERGOING_CONSTRUCTION_EVENT
           
static java.lang.String START_UNDERGOING_CONSTRUCTION_EVENT
           
 
Method Summary
 void addConstructionListener(ConstructionListener newListener)
          Adds a listener
 void addNewStage(ConstructionStage stage)
          Adds a new construction stage to the site.
 Building createBuilding(BuildingManager manager)
          Creates a new building from the construction site.
 java.lang.String getBuildingName()
          Gets the building name the site will construct.
 ConstructionStage getCurrentConstructionStage()
          Gets the current construction stage at the site.
 java.lang.String getNextStageType()
          Gets the next construction stage type.
 boolean hasStage(ConstructionStageInfo stage)
          Checks if this site contains a given stage.
 boolean hasUnfinishedStage()
          Checks if the site's current stage is unfinished.
 boolean isAllConstructionComplete()
          Checks if all construction is complete at the site.
 boolean isUndergoingConstruction()
          Checks if site is currently undergoing construction.
 void removeConstructionListener(ConstructionListener oldListener)
          Removes a listener
 void setUndergoingConstruction(boolean undergoingConstruction)
          Sets if site is currently undergoing construction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_UNDERGOING_CONSTRUCTION_EVENT

public static final java.lang.String START_UNDERGOING_CONSTRUCTION_EVENT
See Also:
Constant Field Values

END_UNDERGOING_CONSTRUCTION_EVENT

public static final java.lang.String END_UNDERGOING_CONSTRUCTION_EVENT
See Also:
Constant Field Values

ADD_CONSTRUCTION_STAGE_EVENT

public static final java.lang.String ADD_CONSTRUCTION_STAGE_EVENT
See Also:
Constant Field Values

CREATE_BUILDING_EVENT

public static final java.lang.String CREATE_BUILDING_EVENT
See Also:
Constant Field Values
Method Detail

isAllConstructionComplete

public boolean isAllConstructionComplete()
Checks if all construction is complete at the site.

Returns:
true if construction is complete.

isUndergoingConstruction

public boolean isUndergoingConstruction()
Checks if site is currently undergoing construction.

Returns:
true if undergoing construction.

setUndergoingConstruction

public void setUndergoingConstruction(boolean undergoingConstruction)
Sets if site is currently undergoing construction.

Parameters:
undergoingConstruction - true if undergoing construction.

getCurrentConstructionStage

public ConstructionStage getCurrentConstructionStage()
Gets the current construction stage at the site.

Returns:
construction stage.

getNextStageType

public java.lang.String getNextStageType()
Gets the next construction stage type.

Returns:
next construction stage type or null if none.

addNewStage

public void addNewStage(ConstructionStage stage)
                 throws java.lang.Exception
Adds a new construction stage to the site.

Parameters:
stage - the new construction stage.
Throws:
java.lang.Exception - if error adding construction stage.

createBuilding

public Building createBuilding(BuildingManager manager)
                        throws java.lang.Exception
Creates a new building from the construction site.

Parameters:
manager - the settlement's building manager.
Returns:
newly constructed building.
Throws:
java.lang.Exception - if error constructing building.

getBuildingName

public java.lang.String getBuildingName()
Gets the building name the site will construct.

Returns:
building name or null if undetermined.

hasUnfinishedStage

public boolean hasUnfinishedStage()
Checks if the site's current stage is unfinished.

Returns:
true if stage unfinished.

hasStage

public boolean hasStage(ConstructionStageInfo stage)
Checks if this site contains a given stage.

Parameters:
stage - the stage info.
Returns:
true if contains stage.

addConstructionListener

public final void addConstructionListener(ConstructionListener newListener)
Adds a listener

Parameters:
newListener - the listener to add.

removeConstructionListener

public final void removeConstructionListener(ConstructionListener oldListener)
Removes a listener

Parameters:
oldListener - the listener to remove.