Package net.sf.freecol.server.model
Class NativeDemandSession
- java.lang.Object
-
- net.sf.freecol.server.model.Session
-
- net.sf.freecol.server.model.TimedSession
-
- net.sf.freecol.server.model.NativeDemandSession
-
public class NativeDemandSession extends TimedSession
A type of session to handle trading with a native settlement.
-
-
Constructor Summary
Constructors Constructor Description NativeDemandSession(Unit unit, Colony colony, GoodsType goodsType, int amount, long timeout)Creates a newNativeDemandSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancomplete(boolean result)Complete this task with the given result.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(boolean result, ChangeSet cs)Primitive level to finishing the session with the given result.private ServerPlayergetColonyOwner()private ServerGamegetGame()Get the game.private ServerPlayergetUnitOwner()java.lang.StringtoString()-
Methods inherited from class net.sf.freecol.server.model.TimedSession
cancel
-
Methods inherited from class net.sf.freecol.server.model.Session
clearAll, completeAll, findSession, getKey, lookup, lookup, lookup, makeSessionKey, makeSessionKey, register
-
-
-
-
Constructor Detail
-
NativeDemandSession
public NativeDemandSession(Unit unit, Colony colony, GoodsType goodsType, int amount, long timeout)
Creates a newNativeDemandSession.- Parameters:
unit- TheUnitmaking the demand.colony- TheColonywhere the demand is made.goodsType- TheGoodsTypeto demand.amount- The amount of goods.timeout- The amount of time to wait for a response.
-
-
Method Detail
-
getColonyOwner
private ServerPlayer getColonyOwner()
-
getUnitOwner
private ServerPlayer getUnitOwner()
-
getGame
private ServerGame getGame()
Get the game.- Returns:
- The
ServerGame.
-
completeInternal
private void completeInternal(boolean result, ChangeSet cs)Primitive level to finishing the session with the given result.- Parameters:
result- The result of the demand.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
protected boolean complete(boolean result)
Complete this task with the given result. By default this will be called (with value == false) when the timer expires.- Specified by:
completein classTimedSession- Parameters:
result- The result to complete the session with.- Returns:
- The result of the session.
-
complete
public boolean complete(ChangeSet cs)
All 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.- Overrides:
completein classTimedSession- Parameters:
cs- AChangeSetto update with changes that occur when completing this session.- Returns:
- True if the session was already complete.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-