Package org.bitsquad.warzone.order
Class Order
java.lang.Object
org.bitsquad.warzone.order.Order
- Direct Known Subclasses:
AdvanceOrder
,AirliftOrder
,BlockadeOrder
,BombOrder
,DeployOrder
,NegotiateOrder
Represents an order placed by a player
This class defines the order placed with the ID of the player, the source and
target countries, the number of army units involved in the order
and the type of the action as per game-play actions.
It acts as an intermediate to the GameOrder Interface by adding necessary functionality.
All other Orders extend this class, it acts as the Command Interface for the Command Pattern
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOrder
(BasePlayer p_player, int p_sourceCountryId, int p_targetCountryId, int p_noOfArmyUnits) Parametrized Constructor Order -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
int
Getter method for number of army units involvedGetter for Playerint
Getter for source country Idint
Getter method for target country Idabstract boolean
isValid()
Checks if a particular method is valid or notvoid
setNoOfArmyUnits
(int p_noOfArmyUnits) Setter method for number of army unitsvoid
setSourceCountryId
(int p_sourceCountryId) Setter for source country Idvoid
setTargetCountryId
(int p_targetCountryId) Setter method for target country IdtoString()
toString method
-
Field Details
-
d_playerInstance
-
-
Constructor Details
-
Order
public Order(BasePlayer p_player, int p_sourceCountryId, int p_targetCountryId, int p_noOfArmyUnits) Parametrized Constructor Order- Parameters:
p_player
- Instance of the playerp_sourceCountryId
- Source Country IDp_targetCountryId
- Target Country IDp_noOfArmyUnits
- No of Army Units
-
-
Method Details
-
toString
toString method -
getPlayer
Getter for Player- Returns:
- Returns the player instance
-
setSourceCountryId
public void setSourceCountryId(int p_sourceCountryId) Setter for source country Id- Parameters:
p_sourceCountryId
- Setting the source country Id
-
getSourceCountryId
public int getSourceCountryId()Getter for source country Id- Returns:
- Returns the source country Id
-
setTargetCountryId
public void setTargetCountryId(int p_targetCountryId) Setter method for target country Id- Parameters:
p_targetCountryId
- Setting the target country Id
-
getTargetCountryId
public int getTargetCountryId()Getter method for target country Id- Returns:
- Returns the target country Id
-
setNoOfArmyUnits
public void setNoOfArmyUnits(int p_noOfArmyUnits) Setter method for number of army units- Parameters:
p_noOfArmyUnits
- Setting the number of army units
-
getNoOfArmyUnits
public int getNoOfArmyUnits()Getter method for number of army units involved- Returns:
- Returns the number of army units involved
-
isValid
public abstract boolean isValid()Checks if a particular method is valid or not- Returns:
- boolean
-
execute
void execute()
-