evolution
Class Human


public class Human
implements Evolver

Class of humans.


Field Summary
 protected booleanenergyBufferChanged
          Did we change the energy buffer during evolve? Used to fire a SquareChangedEvt so the energy buffer will be drawn correct.
 protected final static intmaxEnergyBuffer
          Maximum energy buffer value (100%).
 protected final static intminEnergyBuffer
          Minimum energy buffer value (0%).

Constructor Summary
Human(SquareOfLand sq)
          Create a new human.

Method Summary
 voiddecreaseEnergyBuffer(double value)
          Decreases the energybuffer of this human with the given value.
 voiddie()
          Let this human die.
 booleanenergyBufferEmpty()
          Checks whether the energybuffer of this human is empty
 booleanenergyBufferFull()
          Checks whether the energybuffer of this human is full (100%)
 voidevolve(double value)
          The evolution for the human when Evolution ticks time.
 protected voidevolve(Action action)
          Evolve by doing the given action.
 protected voidfindSquare(Action action)
          Find some squares to do the given action on.
 ActiongetAction()
          Get the action for this human.
 doublegetEnergyBuffer()
          Returns the energybuffer of this human
 StringgetEnergyBufferState()
          Get the energy buffer state.
 InfoListgetInfo()
          Create an infolist with information about this human.
 doublegetPriority()
          Returns the priority of this evolver.
 SquareOfLandgetSquareOfLand()
          Get the square of land this human stands on.
 StringgetState()
          Get the state of this human.
 longgetTimeToLive()
          Get the time to live.
 intgetVisionRange()
          Return the vision range for this human.
 protected voidincreaseEnergyBuffer()
          Increases the energybuffer of this human.
 booleanisPerforming()
          Is the human capable of performing its assigned task?
 doublemaxEnergyProduction(Map m1, Map m2)
          How much energy will this evolver produce in this step.
 booleanproducesEnergy()
          Does this evolver produce energy?
 voidsetAction(String actionName)
          Let this human perform the given action from now on.
 protected voidsetAction(Action a)
          Set the action for this human.
 protected voidsetEnergyBuffer(double value)
          Set the energybuffer of this human
 protected voidsetPerforming(boolean performing)
          Mark the human as capable or incapable of performing its assigned action.
 voidsetSquareOfLand(SquareOfLand square)
          Set the square of land this human stands on.
 voidsetTimeToLive(long time)
          Set the time to live.
 voidsetVisionRange(int range)
          Set the vision range for this human.
 protected voidtransformLand(SquareOfLand sq)
          If the current action also transforms land, then do that.

Field Detail

energyBufferChanged

protected boolean energyBufferChanged
Did we change the energy buffer during evolve? Used to fire a SquareChangedEvt so the energy buffer will be drawn correct.

maxEnergyBuffer

protected final static int maxEnergyBuffer
Maximum energy buffer value (100%).

minEnergyBuffer

protected final static int minEnergyBuffer
Minimum energy buffer value (0%).
Constructor Detail

Human

public Human(SquareOfLand sq)
throws evolution.lands.IllegalPlacementException
Create a new human.
Method Detail

decreaseEnergyBuffer

public void decreaseEnergyBuffer(double value)
throws EmptyEnergyBufferException
Decreases the energybuffer of this human with the given value.

die

public void die()
Let this human die.

energyBufferEmpty

public boolean energyBufferEmpty()
Checks whether the energybuffer of this human is empty

energyBufferFull

public boolean energyBufferFull()
Checks whether the energybuffer of this human is full (100%)

evolve

public void evolve(double value)
The evolution for the human when Evolution ticks time.

evolve

protected void evolve(Action action)
Evolve by doing the given action.

findSquare

protected void findSquare(Action action)
Find some squares to do the given action on.

getAction

public Action getAction()
Get the action for this human.

getEnergyBuffer

public double getEnergyBuffer()
Returns the energybuffer of this human

getEnergyBufferState

public String getEnergyBufferState()
Get the energy buffer state. Returns "E" + the percentage the buffer is filled. Possible return values: E0 .. E90.

getInfo

public InfoList getInfo()
Create an infolist with information about this human.

getPriority

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

getSquareOfLand

public SquareOfLand getSquareOfLand()
Get the square of land this human stands on.

getState

public String getState()
Get the state of this human. Returns null if the human has no associated action. Returns the action name, if he's performing the action and "Not" + the action name if he's unable to perform the action.

getTimeToLive

public long getTimeToLive()
Get the time to live.

getVisionRange

public int getVisionRange()
Return the vision range for this human.

increaseEnergyBuffer

protected void increaseEnergyBuffer()
throws evolution.resources.NotEnoughResourcesException
Increases the energybuffer of this human.

isPerforming

public boolean isPerforming()
Is the human capable of performing its assigned task?

maxEnergyProduction

public double maxEnergyProduction(Map m1, Map m2)
How much energy will this evolver produce in this step.

producesEnergy

public boolean producesEnergy()
Does this evolver produce energy?

setAction

public void setAction(String actionName)
Let this human perform the given action from now on. Precondition: the action must be a valid action name.

setAction

protected void setAction(Action a)
Set the action for this human.

setEnergyBuffer

protected void setEnergyBuffer(double value)
throws EmptyEnergyBufferException
Set the energybuffer of this human
Throws:
EmptyEnergyBufferException - If the energybuffer of this human is empty.

setPerforming

protected void setPerforming(boolean performing)
Mark the human as capable or incapable of performing its assigned action.

setSquareOfLand

public void setSquareOfLand(SquareOfLand square)
Set the square of land this human stands on. This is not supposed to be used, except by SquareOfLand.

setTimeToLive

public void setTimeToLive(long time)
Set the time to live.

setVisionRange

public void setVisionRange(int range)
throws InvalidVisionRangeException
Set the vision range for this human.
Throws:
InvalidVisionRangeException - If the vision range is negative.

transformLand

protected void transformLand(SquareOfLand sq)
If the current action also transforms land, then do that.

Association Links

to Class evolution.actions.Action

The action this human is currently assigned.

Supplier Cardinality 1

to Class evolution.lands.SquareOfLand

The square this human is standing on.

a gvijf production