Package org.bitsquad.warzone.map
Class Adapter
java.lang.Object
org.bitsquad.warzone.map.Map
org.bitsquad.warzone.map.Adapter
The Adapter class extends the Map class and adapts the functionality of the ConquestMap class.
-
Constructor Summary
ConstructorsConstructorDescriptionAdapter
(ConquestMap p_conquestMap) Constructs an Adapter object with a ConquestMap instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContinent
(int p_continentId, int p_bonusValue) Adds a continent with the specified ID and bonus value to the adapted ConquestMap.boolean
addCountry
(int p_countryId, int p_continentId) Adds a country with the specified ID to the adapted ConquestMap.boolean
addNeighbor
(int p_sourceCountryId, int p_destinationCountryId) Adds a neighbor relationship between two countries in the adapted ConquestMap.void
Edits the map by loading it from the specified file using the adapted ConquestMap.Gets the continents from the adapted ConquestMap.boolean
Loads a map from the specified file using the adapted ConquestMap.boolean
removeContinent
(int p_continentId) Removes the continent with the specified ID from the adapted ConquestMap.void
removeCountry
(int p_countryId) Removes the country with the specified ID from the adapted ConquestMap.void
removeNeighbor
(int p_sourceCountryId, int p_destinationCountryId) Removes a neighbor relationship between two countries in the adapted ConquestMap.void
Saves the map to a file with the specified name using the adapted ConquestMap.boolean
Validates the current state of the map using the adapted ConquestMap.void
Visualizes the graph representation of the map using the adapted ConquestMap.Methods inherited from class org.bitsquad.warzone.map.Map
addContinent, addCountry, getContinent, isContinentSubgraph
-
Constructor Details
-
Adapter
Constructs an Adapter object with a ConquestMap instance.- Parameters:
p_conquestMap
- The ConquestMap instance to be adapted.
-
-
Method Details
-
getContinents
Gets the continents from the adapted ConquestMap.- Overrides:
getContinents
in classMap
- Returns:
- HashMap containing continent IDs and corresponding Continent objects.
-
addContinent
public void addContinent(int p_continentId, int p_bonusValue) Adds a continent with the specified ID and bonus value to the adapted ConquestMap.- Overrides:
addContinent
in classMap
- Parameters:
p_continentId
- The ID of the continent.p_bonusValue
- The bonus value of the continent.
-
removeContinent
public boolean removeContinent(int p_continentId) Removes the continent with the specified ID from the adapted ConquestMap.- Overrides:
removeContinent
in classMap
- Parameters:
p_continentId
- The ID of the continent to be removed.- Returns:
- True if the continent is successfully removed, false otherwise.
-
addCountry
public boolean addCountry(int p_countryId, int p_continentId) Adds a country with the specified ID to the adapted ConquestMap.- Overrides:
addCountry
in classMap
- Parameters:
p_countryId
- The ID of the country.p_continentId
- The ID of the continent.- Returns:
- True if the country is successfully added, false otherwise.
-
removeCountry
public void removeCountry(int p_countryId) Removes the country with the specified ID from the adapted ConquestMap.- Overrides:
removeCountry
in classMap
- Parameters:
p_countryId
- The ID of the country to be removed.
-
addNeighbor
public boolean addNeighbor(int p_sourceCountryId, int p_destinationCountryId) Adds a neighbor relationship between two countries in the adapted ConquestMap.- Overrides:
addNeighbor
in classMap
- Parameters:
p_sourceCountryId
- The ID of the source country.p_destinationCountryId
- The ID of the destination country.- Returns:
- True if the neighbor relationship is successfully added, false otherwise.
-
removeNeighbor
public void removeNeighbor(int p_sourceCountryId, int p_destinationCountryId) Removes a neighbor relationship between two countries in the adapted ConquestMap.- Overrides:
removeNeighbor
in classMap
- Parameters:
p_sourceCountryId
- The ID of the source country.p_destinationCountryId
- The ID of the destination country.
-
loadMap
Loads a map from the specified file using the adapted ConquestMap. -
saveMap
Saves the map to a file with the specified name using the adapted ConquestMap. -
editMap
Edits the map by loading it from the specified file using the adapted ConquestMap. -
visualizeGraph
public void visualizeGraph()Visualizes the graph representation of the map using the adapted ConquestMap.- Overrides:
visualizeGraph
in classMap
-
validateMap
public boolean validateMap()Validates the current state of the map using the adapted ConquestMap.- Overrides:
validateMap
in classMap
- Returns:
- True if the map is valid, false otherwise.
-