Package net.sf.freecol.server.model
Class MonarchSession
- java.lang.Object
-
- net.sf.freecol.server.model.Session
-
- net.sf.freecol.server.model.MonarchSession
-
public class MonarchSession extends Session
A type of session to handle monarch actions that require response.
-
-
Field Summary
Fields Modifier and Type Field Description private Monarch.MonarchActionactionThe action to be considered.private GoodsgoodsThe goods for the goods party.private static java.util.logging.Loggerloggerprivate java.util.List<AbstractUnit>mercenariesMercenaries on offer.private intpriceMercenary price.private ServerPlayerserverPlayerThe player whose monarch is active.private inttaxThe amount of tax to raise.
-
Constructor Summary
Constructors Constructor Description MonarchSession(ServerPlayer serverPlayer, Monarch.MonarchAction action, int tax, Goods goods)MonarchSession(ServerPlayer serverPlayer, Monarch.MonarchAction action, java.util.List<AbstractUnit> mercenaries, int price)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancomplete(boolean result, ChangeSet cs)Explicit completion of the session with a given result.booleancomplete(ChangeSet cs)All transaction types must implement a completion action.private voidcompleteInternal(java.lang.Boolean result, ChangeSet cs)Primitive level to finishing the session with the given result.Monarch.MonarchActiongetAction()GoodsgetGoods()java.util.List<AbstractUnit>getMercenaries()intgetPrice()intgetTax()-
Methods inherited from class net.sf.freecol.server.model.Session
clearAll, completeAll, findSession, getKey, lookup, lookup, lookup, makeSessionKey, makeSessionKey, register
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
serverPlayer
private final ServerPlayer serverPlayer
The player whose monarch is active.
-
action
private final Monarch.MonarchAction action
The action to be considered.
-
tax
private final int tax
The amount of tax to raise.
-
goods
private Goods goods
The goods for the goods party.
-
mercenaries
private java.util.List<AbstractUnit> mercenaries
Mercenaries on offer.
-
price
private final int price
Mercenary price.
-
-
Constructor Detail
-
MonarchSession
public MonarchSession(ServerPlayer serverPlayer, Monarch.MonarchAction action, int tax, Goods goods)
-
MonarchSession
public MonarchSession(ServerPlayer serverPlayer, Monarch.MonarchAction action, java.util.List<AbstractUnit> mercenaries, int price)
-
-
Method Detail
-
completeInternal
private void completeInternal(java.lang.Boolean result, ChangeSet cs)Primitive level to finishing the session with the given result.- Parameters:
result- The result of the session, null means ignored.cs- AChangeSetto update.
-
complete
public boolean complete(boolean result, ChangeSet cs)Explicit completion of the session with a given result. Called from the controller when the player returns a definite response.- Parameters:
result- Whether to accept or reject the demand.cs- AChangeSetto update.- Returns:
- Whether the session was already complete.
-
complete
public boolean complete(ChangeSet cs)
Description copied from class:SessionAll transaction types must implement a completion action. This is called by the controller at the end of turn to complete any sessions that have not yet completed, or if the controller gets the required response to complete the session.
-
getAction
public Monarch.MonarchAction getAction()
-
getTax
public int getTax()
-
getGoods
public Goods getGoods()
-
getMercenaries
public java.util.List<AbstractUnit> getMercenaries()
-
getPrice
public int getPrice()
-
-