Class BaseTavernPerson
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.people.impl.BaseTavernPerson
-
- All Implemented Interfaces:
IPerson
,ITavernPerson
- Direct Known Subclasses:
BasePatrolState
,BaseTravelerState
,BuyerState
,ConcurrentState
,InformantState
,PirateHunterState
,SmugglerState
,TavernPirateState
,ThieveState
,TraderState
,TransportTraderState
,TreasureMapOwnerState
,WarehouseTenant
public class BaseTavernPerson extends java.lang.Object implements ITavernPerson
Base class for people frequenting the tavern.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 20, 2013
-
-
Field Summary
Fields Modifier and Type Field Description private java.time.LocalDateTime
arrivalDate
Arrival date of the person in the tavern.private ICity
city
private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
protected Date
date
private javafx.beans.property.BooleanProperty
isPresent
Indicating if the person is currently presentprivate java.util.Random
rnd
private TavernProperties
tavernProperties
-
Constructor Summary
Constructors Constructor Description BaseTavernPerson()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
arrive()
Person arrives in the tavern.int
getMaxDaysAbsent()
Maximum number of days not present in the tavern.int
getMaxDaysPresent()
Retrieve the max number of days present in the tavern.int
getNumberOfDaysSinceArrival()
Compute the days of absence since the last arrival, if the person is not present.private void
initArival()
boolean
isPresent()
Flag indicating if the person is present in the tavern.javafx.beans.property.BooleanProperty
isPresentProperty()
Property defining the presence/absence state.void
leave()
Person leaves the tavern-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.sahits.game.openpatrician.model.people.ITavernPerson
getArrivalDate, setCity
-
-
-
-
Field Detail
-
arrivalDate
private java.time.LocalDateTime arrivalDate
Arrival date of the person in the tavern. Is null as long asisPresent
is false for the first time
-
isPresent
private javafx.beans.property.BooleanProperty isPresent
Indicating if the person is currently present
-
date
@Autowired protected Date date
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
city
private ICity city
-
rnd
@Autowired private java.util.Random rnd
-
tavernProperties
@Autowired private TavernProperties tavernProperties
-
-
Method Detail
-
initArival
@PostConstruct private void initArival()
-
isPresent
public boolean isPresent()
Description copied from interface:ITavernPerson
Flag indicating if the person is present in the tavern.- Specified by:
isPresent
in interfaceITavernPerson
- Returns:
- true if the person is present.
-
isPresentProperty
public javafx.beans.property.BooleanProperty isPresentProperty()
Description copied from interface:ITavernPerson
Property defining the presence/absence state.- Specified by:
isPresentProperty
in interfaceITavernPerson
- Returns:
- boolean proerty indicating the presence in the tavern.
-
arrive
public final void arrive()
Person arrives in the tavern.- Specified by:
arrive
in interfaceITavernPerson
-
leave
public final void leave()
Person leaves the tavern- Specified by:
leave
in interfaceITavernPerson
-
getNumberOfDaysSinceArrival
public int getNumberOfDaysSinceArrival()
Description copied from interface:ITavernPerson
Compute the days of absence since the last arrival, if the person is not present.- Specified by:
getNumberOfDaysSinceArrival
in interfaceITavernPerson
- Returns:
- number of days the person is in the tavern
-
getMaxDaysAbsent
public int getMaxDaysAbsent()
Description copied from interface:ITavernPerson
Maximum number of days not present in the tavern.- Specified by:
getMaxDaysAbsent
in interfaceITavernPerson
- Returns:
- max number of absent days.
-
getMaxDaysPresent
public int getMaxDaysPresent()
Description copied from interface:ITavernPerson
Retrieve the max number of days present in the tavern.- Specified by:
getMaxDaysPresent
in interfaceITavernPerson
- Returns:
- max number of present days in the tavern
-
-