@Component @Lazy @DependentInitialisation(value=StartNewGameBean.class) public class CaptainsState extends Object
| Modifier and Type | Field and Description |
|---|---|
private List<CaptainTownMapping> |
captainMapping |
private List<ICaptain> |
captains |
private Date |
date |
private IMap |
map |
private int |
maxDaysPresent |
private Random |
rnd |
| Constructor and Description |
|---|
CaptainsState() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCaptain(ICity city,
org.joda.time.DateTime arrival,
ICaptain captain) |
void |
assignCaptainToCity(ICaptain captain,
ICity city,
org.joda.time.DateTime arrivalDate)
Assign the captain to a new town.
|
Optional<ICity> |
findCaptainsCurrentCity(ICaptain captain)
Find the current city of a captain.
|
List<ICaptain> |
getAllFreeCaptains()
Retrieve a list of all captains that are not assigned to a town.
|
org.joda.time.DateTime |
getArrivalDate(ICaptain captain)
Retrieve the arrival date of a captain in a town.
|
Optional<ICaptain> |
getCaptain(ICity city)
Return a captain for a town if there is one.
|
private ICity |
getRandomCity() |
void |
hireCaptain(ICaptain captain,
ICity city)
Remove the captain from the availables.
|
@Autowired private Random rnd
@Value(value="${tavern.captain.presence.max}")
private int maxDaysPresent
@Autowired private IMap map
@Autowired private Date date
private List<CaptainTownMapping> captainMapping
private ICity getRandomCity()
public void assignCaptainToCity(ICaptain captain, ICity city, org.joda.time.DateTime arrivalDate)
city - current town that the captain is leavingcaptain - which travels to a new town.public Optional<ICaptain> getCaptain(ICity city)
city - for which the captain is retrievedpublic org.joda.time.DateTime getArrivalDate(ICaptain captain)
captain - captain residing in a townpublic void hireCaptain(ICaptain captain, ICity city)
captain - that is hired.city - where the captain was hired.public List<ICaptain> getAllFreeCaptains()
Copyright © 2011-2017 Sahits GmbH. All Rights Reserved.