evolution.constructions
Class Construction

Direct Known Subclasses:
CoalMine, SimpleConstruction

public abstract class Construction
implements Evolver

Abstract class of constructions.


Constructor Summary
 protected Construction()
          Create a new construction.
 Construction(List squares)
          Create a new construction.

Method Summary
 protected abstract void_evolve(double percentage)
          Additional things which should be done when this construction's evolve method is called.
 voidconstruct(double inc)
          Construct some percents of this construction.
 protected voiddoChecks(double percentage)
          The checks which are made in evolve.
 voidevolve(double percentage)
          The evolution for the construction when Evolution ticks time.
 doublegetConstructionState()
          The percentage of construction.
 InfoListgetInfo()
          An InfoList with the properties of this building.
 StringgetName()
          Returns the name of the construction.
 doublegetPriority()
          Returns the priority of this construction.
 protected MapgetProducesResources()
          Returns a map of the names of resources that are produced by this action.
 intgetSize()
          Returns the size of the construction.
 ListgetSquares()
          The squares where this construction is build on.
 StringgetState()
           
 protected MapgetUsesLandResources()
          Returns a map of the names of landresources that are used by this action.
 protected MapgetUsesResources()
          Returns a map of the names of resources that are used by this action.
 booleanhasEnoughResources(double percentage)
          Checks whether this construction had enough worldresources to be performed.
 booleanisBeingBuild()
          Is this construction being build?
 booleanisProduction()
          Is this construction in production state?
 booleanisWorking()
          Is this construction working?
 doublemaxEnergyProduction(Map maxProduction, Map leftOver)
          Return the maximum energy production of this evolver.
 protected voidmodifyLandResources(List squares, Map resources, double mul)
          Modify the land resources for this construction.
 protected voidmodifyResources(Map resources, double mul)
          Modify the world resources for this construction.
 booleanproducesEnergy()
          Does this evolver produce energy?
 ListproducesResourcesNames()
          A list with the names of the resources produced by this construction.
 protected voidsetSquares(List squares)
          Set the squares where this construction is standing.
 protected voidsetWorking(boolean w)
          Change the working state of this construction.
 protected voidsignalStateChange()
          Signal a SquareChangedEvt on every square of this construction.

Constructor Detail

Construction

protected Construction()
Create a new construction.

Construction

public Construction(List squares)
Create a new construction.
Method Detail

_evolve

protected abstract void _evolve(double percentage)
Additional things which should be done when this construction's evolve method is called. Template method.

construct

public void construct(double inc)
Construct some percents of this construction.
Parameters:
inc - The percentage to construct.

doChecks

protected void doChecks(double percentage)
throws evolution.resources.NotEnoughResourcesException
The checks which are made in evolve. This is a template method.

evolve

public void evolve(double percentage)
The evolution for the construction when Evolution ticks time.
Parameters:
percentage - The percentage of production.

getConstructionState

public double getConstructionState()
The percentage of construction.

getInfo

public InfoList getInfo()
An InfoList with the properties of this building.

getName

public String getName()
Returns the name of the construction.

getPriority

public double getPriority()
Returns the priority of this construction.

getProducesResources

protected Map getProducesResources()
Returns a map of the names of resources that are produced by this action.

getSize

public int getSize()
Returns the size of the construction.

getSquares

public List getSquares()
The squares where this construction is build on.

getState

public String getState()

getUsesLandResources

protected Map getUsesLandResources()
Returns a map of the names of landresources that are used by this action.

getUsesResources

protected Map getUsesResources()
Returns a map of the names of resources that are used by this action.

hasEnoughResources

public boolean hasEnoughResources(double percentage)
Checks whether this construction had enough worldresources to be performed.

isBeingBuild

public boolean isBeingBuild()
Is this construction being build?

isProduction

public boolean isProduction()
Is this construction in production state?

isWorking

public boolean isWorking()
Is this construction working?

maxEnergyProduction

public double maxEnergyProduction(Map maxProduction, Map leftOver)
Return the maximum energy production of this evolver.
Parameters:
maxProduction - A (String, Double) map wich holds the maximal production of worldresources.
leftOver - A (String, Double) map wich holds the actual status of worldresources in calculating the maximum energy production.

modifyLandResources

protected void modifyLandResources(List squares, Map resources, double mul)
throws evolution.lands.NotEnoughLandResourcesException
Modify the land resources for this construction.
Parameters:
resources - A Map of (String, Double) resources to modify.
mul - A multiplier for the values in the map.

modifyResources

protected void modifyResources(Map resources, double mul)
throws evolution.resources.NotEnoughResourcesException
Modify the world resources for this construction.
Parameters:
resources - A Map of (String, Double) resources to modify.
mul - A multiplier for the values in the map.

producesEnergy

public boolean producesEnergy()
Does this evolver produce energy?

producesResourcesNames

public List producesResourcesNames()
A list with the names of the resources produced by this construction.

setSquares

protected void setSquares(List squares)
Set the squares where this construction is standing.

setWorking

protected void setWorking(boolean w)
Change the working state of this construction.

signalStateChange

protected void signalStateChange()
Signal a SquareChangedEvt on every square of this construction.

Association Links

to Class java.util.List

The list of squares this construction is build on.

a gvijf production