|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrails.game.action.PossibleAction
rails.game.action.PossibleORAction
rails.game.action.SetDividend
public class SetDividend
Action class that comprises the earnings setting and distribution steps. In the current versions, the earnings must always be calculated and entered by the user. In a later version, the earnings may have been calculated by the back-end; in that case, the user can only select the earnings distribution method.
Field Summary | |
---|---|
protected int |
actualRevenue
The revenue as set (or accepted, or just seen) by the user. |
static java.lang.String[] |
allocationNameKeys
Allocation name keys in the resource bundle |
protected int[] |
allowedRevenueAllocations
The revenue allocations that the user may select from. |
protected boolean |
mayUserSetRevenue
Is the user allowed to set the revenue? Currently, this will aways be true, except if the company has no trains (the revenue is then 0). |
static int |
NO_TRAIN
|
static int |
NUM_OPTIONS
|
static int |
PAYOUT
|
protected int |
presetRevenue
The revenue as proposed by the back-end. |
protected int |
requiredCash
Cash that should be minimally raised as revenue (for instance, to pay loan interest as in 1856). |
protected int |
revenueAllocation
The revenue destination selected by the user (if he has a choice at all). |
static long |
serialVersionUID
|
static int |
SPLIT
|
static int |
UNKNOWN
|
static int |
WITHHOLD
|
Fields inherited from class rails.game.action.PossibleORAction |
---|
company, companyName |
Fields inherited from class rails.game.action.PossibleAction |
---|
acted, gameManager, log, playerIndex, playerName |
Constructor Summary | |
---|---|
|
SetDividend(int presetRevenue,
boolean mayUserSetRevenue,
int[] allowedAllocations)
|
|
SetDividend(int presetRevenue,
boolean mayUserSetRevenue,
int[] allowedAllocations,
int requiredCash)
|
protected |
SetDividend(SetDividend action)
Clone an instance (used by clone) |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
boolean |
equalsAsAction(PossibleAction action)
Compare the chosen actions of two action objects. |
boolean |
equalsAsOption(PossibleAction action)
Compare the choice options of two action objects, without regard to whatever choice has been made, if any. |
int |
getActualRevenue()
|
static java.lang.String |
getAllocationNameKey(int allocationType)
|
int[] |
getAllowedAllocations()
|
int |
getPresetRevenue()
|
int |
getRequiredCash()
|
int |
getRevenueAllocation()
|
boolean |
isAllocationAllowed(int allocationType)
|
void |
setActualRevenue(int revenue)
|
void |
setRevenueAllocation(int allocation)
|
java.lang.String |
toString()
|
Methods inherited from class rails.game.action.PossibleORAction |
---|
getCompany, getCompanyName, setCompany |
Methods inherited from class rails.game.action.PossibleAction |
---|
getCompanyManager, getGameManager, getPlayerIndex, getPlayerName, hasActed, setActed, setPlayerName, toMenu |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int WITHHOLD
public static final int SPLIT
public static final int PAYOUT
public static final int NO_TRAIN
public static final int NUM_OPTIONS
public static final java.lang.String[] allocationNameKeys
protected int presetRevenue
protected boolean mayUserSetRevenue
protected int[] allowedRevenueAllocations
protected int requiredCash
protected int actualRevenue
protected int revenueAllocation
public static final long serialVersionUID
Constructor Detail |
---|
public SetDividend(int presetRevenue, boolean mayUserSetRevenue, int[] allowedAllocations)
public SetDividend(int presetRevenue, boolean mayUserSetRevenue, int[] allowedAllocations, int requiredCash)
protected SetDividend(SetDividend action)
Method Detail |
---|
public int getPresetRevenue()
public void setActualRevenue(int revenue)
public int getActualRevenue()
public int[] getAllowedAllocations()
public boolean isAllocationAllowed(int allocationType)
public int getRequiredCash()
public void setRevenueAllocation(int allocation)
public int getRevenueAllocation()
public static java.lang.String getAllocationNameKey(int allocationType)
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equalsAsOption(PossibleAction action)
PossibleAction
This method is used by the server (engine) to validate the incoming action that has actually been chosen in the client (GUI), but only for the purpose to check if the chosen option was really on offer, not to check if the chosen action is actually valid. These perspectives could give different results in cases where the PossibleAction does not fully restrict choices to valid values only (such as the blanket LayTile that does no restrict the hex to lay a tile on, or the SetDividend that will accept any revenue value).
equalsAsOption
in class PossibleAction
action
- Another PossibleAction to compare with.
public boolean equalsAsAction(PossibleAction action)
PossibleAction
This method is used by the server (engine) to check if two action objects represent the same actual action, as is done when reloading a saved file (i.e. loading a later stage of the same game).
equalsAsAction
in class PossibleAction
action
- Another PossibleAction to compare with.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |