Class EventEngineState
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.event.EventEngineState
-
public class EventEngineState extends java.lang.Object
State for the event engine holing serializable information used by the EventEngine. Created by andi on 29.03.17.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<ICity,java.time.LocalDateTime>
lastFire
private java.util.Map<ICity,java.time.LocalDateTime>
lastPlague
private java.util.Map<java.lang.String,EEventState>
marriageState
-
Constructor Summary
Constructors Constructor Description EventEngineState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFire(ICity city, java.time.LocalDateTime date)
Add or override the date of the last fire in the cityvoid
addPlague(ICity city, java.time.LocalDateTime date)
Add or override the date of the last plague in the cityjava.util.Optional<java.time.LocalDateTime>
getLastFire(ICity city)
Retrieve the Date of the last fire.java.util.Optional<java.time.LocalDateTime>
getLastPlague(ICity city)
Retrieve the Date of the last plague.java.util.Optional<EEventState>
getMarriageState(IPlayer player)
Retrieve the current marriage state of the player.void
resetMarriedState(IPlayer player)
Remove the player form the marriage state map.void
setMarriageState(IPlayer player, EEventState state)
Set or update the marriage state of a player.
-
-
-
Field Detail
-
lastFire
private java.util.Map<ICity,java.time.LocalDateTime> lastFire
-
lastPlague
private java.util.Map<ICity,java.time.LocalDateTime> lastPlague
-
marriageState
private java.util.Map<java.lang.String,EEventState> marriageState
-
-
Method Detail
-
addFire
public void addFire(ICity city, java.time.LocalDateTime date)
Add or override the date of the last fire in the city- Parameters:
city
- where the fire happeneddate
- when the fire happened
-
getLastFire
public java.util.Optional<java.time.LocalDateTime> getLastFire(ICity city)
Retrieve the Date of the last fire. There might not have been a fire yet.- Parameters:
city
- which should be checked- Returns:
- date of the last fire or empty
-
addPlague
public void addPlague(ICity city, java.time.LocalDateTime date)
Add or override the date of the last plague in the city- Parameters:
city
- where the plague happeneddate
- when the plague happened
-
getLastPlague
public java.util.Optional<java.time.LocalDateTime> getLastPlague(ICity city)
Retrieve the Date of the last plague. There might not have been a plague yet.- Parameters:
city
- which should be checked- Returns:
- date of the last plague or empty
-
setMarriageState
public void setMarriageState(IPlayer player, EEventState state)
Set or update the marriage state of a player.- Parameters:
player
- to be updatedstate
- marriage state
-
getMarriageState
public java.util.Optional<EEventState> getMarriageState(IPlayer player)
Retrieve the current marriage state of the player.- Parameters:
player
- to be checked.- Returns:
- marriage state or empty
-
resetMarriedState
public void resetMarriedState(IPlayer player)
Remove the player form the marriage state map.- Parameters:
player
- that gets married.
-
-