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 TypeMethodDescriptionvoidaddContinent(int p_continentId, int p_bonusValue) Adds a continent with the specified ID and bonus value to the adapted ConquestMap.booleanaddCountry(int p_countryId, int p_continentId) Adds a country with the specified ID to the adapted ConquestMap.booleanaddNeighbor(int p_sourceCountryId, int p_destinationCountryId) Adds a neighbor relationship between two countries in the adapted ConquestMap.voidEdits the map by loading it from the specified file using the adapted ConquestMap.Gets the continents from the adapted ConquestMap.booleanLoads a map from the specified file using the adapted ConquestMap.booleanremoveContinent(int p_continentId) Removes the continent with the specified ID from the adapted ConquestMap.voidremoveCountry(int p_countryId) Removes the country with the specified ID from the adapted ConquestMap.voidremoveNeighbor(int p_sourceCountryId, int p_destinationCountryId) Removes a neighbor relationship between two countries in the adapted ConquestMap.voidSaves the map to a file with the specified name using the adapted ConquestMap.booleanValidates the current state of the map using the adapted ConquestMap.voidVisualizes 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:
getContinentsin 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:
addContinentin 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:
removeContinentin 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:
addCountryin 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:
removeCountryin 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:
addNeighborin 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:
removeNeighborin 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:
visualizeGraphin classMap
-
validateMap
public boolean validateMap()Validates the current state of the map using the adapted ConquestMap.- Overrides:
validateMapin classMap- Returns:
- True if the map is valid, false otherwise.
-