Skip to content

Commit

Permalink
added javadoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PrashantPawar30 committed Oct 4, 2023
1 parent 7aa7b23 commit f1355ad
Show file tree
Hide file tree
Showing 16 changed files with 237 additions and 90 deletions.
37 changes: 29 additions & 8 deletions src/main/java/project/app/warzone/Commands/MapEditorCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public class MapEditorCommands {
public PlayerFeatures playerFeatures;
private final MapResouces mapResources;

/**
* Constructor for MapEditorCommands
*
* @param mapFeatures
* @param gameEngine
* @param playerFeatures
* @param mapResources
*/
public MapEditorCommands(MapFeatures mapFeatures, GameEngine gameEngine, PlayerFeatures playerFeatures, MapResouces mapResources){
this.mapFeatures = mapFeatures;
this.gameEngine = gameEngine;
Expand All @@ -39,8 +47,10 @@ public MapEditorCommands(MapFeatures mapFeatures, GameEngine gameEngine, PlayerF


/**
* @param p_filename
* @return String
* command for loading map for gameplay
*
* @param p_filename filename of the mao
* @return String returns message if the map is loaded
*/
@ShellMethod(key= "loadmap", value="Player can create or open an existing map")
public String loadMap(@ShellOption String p_filename){
Expand All @@ -58,7 +68,9 @@ public String loadMap(@ShellOption String p_filename){


/**
* @return String
* Display the game map
*
* @return String returns message about the map validation
*/
@ShellMethod(key= "showmap", value="Used to display map continents with terriotories and boundaries")
public String showmap(){
Expand All @@ -76,11 +88,13 @@ public String showmap(){
}


/**
* @param p_editcmd
* @param p_editremovecmd
* @return
*/
/**
* command for editing continent
*
* @param p_editremovecmd for remove command
* @param p_editcmd for edit command
* @return returns the message about status of command
*/
@ShellMethod(key= "editcontinent", prefix = "-", value="This is used to add or update continents")
public String editcontinent(@ShellOption(value="a",defaultValue=ShellOption.NULL)String p_editcmd, @ShellOption(value="r",defaultValue=ShellOption.NULL) String p_editremovecmd){
if(gameEngine.prevUserCommand==Commands.EDITMAP){
Expand Down Expand Up @@ -155,6 +169,13 @@ public String editcontinent(@ShellOption(value="a",defaultValue=ShellOption.NULL

}

/**
* command for editing country
*
* @param p_editcmd for edit country command
* @param p_editremovecmd for remove country command
* @return returns the message about status of command
*/
@ShellMethod(key= "editcountry", prefix = "-", value="This is used to add continents")
public String editcountry(@ShellOption(value="a",defaultValue=ShellOption.NULL)String p_editcmd, @ShellOption(value="r",defaultValue=ShellOption.NULL) String p_editremovecmd){
if(gameEngine.prevUserCommand==Commands.EDITMAP){
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/project/app/warzone/Commands/OrderCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
@ShellComponent
public class OrderCommands {

/**
* command for deploy army
*
* @param p_countryID storing country id
* @param p_armies storing numberofArmies
* @return returns the status
*/
@ShellMethod(key = "deploy", value = "This is used to deploy armies")
public String deployArmies(@ShellOption int p_countryID, @ShellOption int p_armies) {
return "You can deploy armies here";
Expand Down
29 changes: 17 additions & 12 deletions src/main/java/project/app/warzone/Commands/PlayerCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@
@ShellComponent
public class PlayerCommands {

public GameEngine gameEngine;
public PlayerFeatures playerFeatures;
public String prevUserCommand;

public GameEngine gameEngine; //used for gameEngine
public PlayerFeatures playerFeatures; //used for playerFeatures
public String prevUserCommand; //storing user previous command

/**
* Constructor for Playercommands
*
* @param gameEngine storing gameEngine
* @param playerFeatures storing playerFeatures
*/
public PlayerCommands(GameEngine gameEngine,PlayerFeatures playerFeatures){
this.gameEngine = gameEngine;
this.playerFeatures= playerFeatures;
}



/**
* @param @ShellOption
* @param defaultValue=ShellOption.NULL
* @param p_playerNameOne
* @param @ShellOption(value="r"
* @param defaultValue=ShellOption.NULL
* @param p_playerNameTwo
* @return String

/**
* command for add player
*
* @param p_playerNameOne storing player 1 name
* @param p_playerNameTwo storing player 2 name
* @return
*/
@ShellMethod(key= "gameplayer", prefix = "-", value="Player can create or remove a player")
public String gamePlayerAdd(@ShellOption(value="a",defaultValue=ShellOption.NULL, arity = 10 ) String p_playerNameOne,@ShellOption(value="r", defaultValue=ShellOption.NULL, arity=10) String p_playerNameTwo){
Expand Down
49 changes: 32 additions & 17 deletions src/main/java/project/app/warzone/Features/MapFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
import project.app.warzone.Model.Map;
import project.app.warzone.Model.Node;;

/**
* This class stores all the map-related functions in gameplay
*/
@Component
public class MapFeatures {


/**
* @param filename
* @return Map
* used for reading map
*
* @param filename used for storing file name
* @return Map returns gamemap
*/
public Map readMap(String filename){

Expand Down Expand Up @@ -113,7 +118,9 @@ public Map readMap(String filename){


/**
* @param gameMap
*used for displaying map
*
* @param gameMap used for storing game map
*/
public void printMap(Map gameMap){

Expand Down Expand Up @@ -150,10 +157,12 @@ public void printMap(Map gameMap){



/**
* @param p_allNodes
* @param l_visitedList
* @return Map<Node, Boolean>
/**
* used for validation
*
* @param p_allNodes storing list of all nodes
* @param l_visitedList storing list of visited nodes
* @return Map<Node, Boolean> storing map
*/
public java.util.Map<Node,Boolean> validateByNodes(List<Node> p_allNodes, java.util.Map<Node,Boolean> l_visitedList){

Expand All @@ -174,9 +183,11 @@ public java.util.Map<Node,Boolean> validateByNodes(List<Node> p_allNodes, java.u



/**
* @param gameEngine
* @return Boolean
/**
* used for validating entire graph
*
* @param gameEngine storing gameEngine
* @return Boolean returns the status of validating
*/
public Boolean validateEntireGraph(GameEngine gameEngine){

Expand Down Expand Up @@ -217,10 +228,12 @@ public Boolean validateEntireGraph(GameEngine gameEngine){


/**
* @param con
* @param l_listOfNodes
* @param l_visitedList
* @return boolean
* used for validating sub-graph
*
* @param con storing continent
* @param l_listOfNodes storing list of nodes
* @param l_visitedList storing list of visited nodes
* @return boolean returns the status of validating
*/
public boolean validateSubGraph(Continent con, List<Node> l_listOfNodes,java.util.Map<Node,Boolean> l_visitedList){

Expand All @@ -245,9 +258,11 @@ public boolean validateSubGraph(Continent con, List<Node> l_listOfNodes,java.uti


/**
* @param currentCountry
* @param l_visitedList
* @return Map<Node, Boolean>
* used for implementing DFS
*
* @param currentCountry storing current country
* @param l_visitedList storing list of visited list
* @return Map<Node, Boolean> returns status
*/
private java.util.Map<Node,Boolean> depthFirstSearch(Node currentCountry, java.util.Map<Node,Boolean> l_visitedList){

Expand Down
22 changes: 14 additions & 8 deletions src/main/java/project/app/warzone/Features/PlayerFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
import project.app.warzone.Model.Player;
import project.app.warzone.Model.Country;

/**
* This class stores all the player-related functions in gameplay
*/
@Component
public class PlayerFeatures {



/**
* @param allPlayers
* @param allPlayers list of all players
*/
public void showAllAssignments(List<Player> allPlayers){

Expand All @@ -38,7 +41,7 @@ public void showAllAssignments(List<Player> allPlayers){


/**
* @param p_gameEngine
* @param p_gameEngine storing gameEngine
*/
public void assignCountries(GameEngine p_gameEngine){

Expand All @@ -65,8 +68,8 @@ public void assignCountries(GameEngine p_gameEngine){


/**
* @param p_playerName
* @param gameEngine
* @param p_playerName storing playername
* @param gameEngine storing gameEngine
*/
public void addPlayers(String p_playerName, GameEngine gameEngine){

Expand All @@ -76,6 +79,9 @@ public void addPlayers(String p_playerName, GameEngine gameEngine){

}

/**
* @param gameEngine storing gameEngine
*/
public void setPlayerIds(GameEngine gameEngine){

int i=1;
Expand All @@ -89,8 +95,8 @@ public void setPlayerIds(GameEngine gameEngine){


/**
* @param p_playerName
* @param gameEngine
* @param p_playerName storing playername
* @param gameEngine storing gameEngine
*/
public void removePlayers(String p_playerName, GameEngine gameEngine){

Expand All @@ -105,7 +111,7 @@ public void removePlayers(String p_playerName, GameEngine gameEngine){


/**
* @param gameEngine
* @param gameEngine storing gameEngine
*/
public void printAllPlayers(GameEngine gameEngine){
System.out.println("Final players of the game are:");
Expand All @@ -118,7 +124,7 @@ public void printAllPlayers(GameEngine gameEngine){


/**
* @param gameengine
* @param gameengine storing gameEngine
*/
public void showStats(GameEngine gameengine){
List<Player> listOfPlayers = gameengine.getPlayers();
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/project/app/warzone/Model/Continent.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public class Continent {
private String continentName;
private Integer bonus;

//Intializing continentName
public Continent(String continentName) {
this.continentName = continentName;
}

//Intializing continentName and bonus
public Continent(String continentName, Integer bonus) {
this.continentName = continentName;
this.bonus = bonus;
Expand All @@ -21,7 +23,7 @@ public Continent(String continentName, Integer bonus) {
* @return String
*/
public String getContinentName() {
return continentName;
return continentName; //returns Continent name
}


Expand All @@ -30,22 +32,22 @@ public String getContinentName() {
* @return int
*/
public int getBonus() {
return bonus;
return bonus; //returns Bonus value
}

/**
* @param newBonus
*/
public void setBonus(int newBonus) {
bonus = newBonus;
bonus = newBonus; //used for setting new Bonus value
}


/**
* @param newContinentName
*/
public void setContinentName(String newContinentName) {
continentName = newContinentName;
continentName = newContinentName; //used for setting new Continent name
}


Expand Down
Loading

0 comments on commit f1355ad

Please sign in to comment.