Class CelebrationTask
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.event.TimedTask
-
- ch.sahits.game.openpatrician.clientserverinterface.model.task.CelebrationTask
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
MarriageTask
public class CelebrationTask extends TimedTask
Timed task for a celebration- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on Dec 08, 2016
-
-
Field Summary
Fields Modifier and Type Field Description private CelebrationService
celebrationService
private ICity
city
private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private Date
date
private IPlayer
player
-
Constructor Summary
Constructors Constructor Description CelebrationTask(IPlayer player, ICity city)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private CelebrationState
calculateCelebrationState()
private CelebrationSuccess
calculateSuccess(double avgMissing)
protected CelebrationState
createCelebrationState(CelebrationSuccess success, int attendance)
void
run()
Calculate the required amount of required wares for the celebration, deduce it from the stored wares, decide on the success of the celebration and update the Reputation.java.lang.String
toString()
private void
updateReputation(CelebrationState state)
-
-
-
Field Detail
-
date
@Autowired private Date date
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
celebrationService
@Autowired private CelebrationService celebrationService
-
player
private final IPlayer player
-
city
private final ICity city
-
-
Method Detail
-
run
public void run()
Calculate the required amount of required wares for the celebration, deduce it from the stored wares, decide on the success of the celebration and update the Reputation.
-
updateReputation
private void updateReputation(CelebrationState state)
-
calculateCelebrationState
private CelebrationState calculateCelebrationState()
-
createCelebrationState
protected CelebrationState createCelebrationState(CelebrationSuccess success, int attendance)
-
calculateSuccess
private CelebrationSuccess calculateSuccess(double avgMissing)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-