public class ConfigurationControl extends Object implements IConfigurationControl
Constructor and Description |
---|
ConfigurationControl(GuiControl guiControl)
The constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position newBlockedPosition)
This method adds a position to the list of blocked positions
|
boolean |
checkConfiguration()
This method checks if the Configuration is allowable
|
void |
createDefaultConfiguration()
This method creates a default configuration
|
DynamicConfiguration |
getConfig() |
void |
loadConfiguration()
This method loads a Configuration
|
boolean |
pathOfLoadedFileIsNotEmpty()
Checks if a the path of a loaded file is empty
|
void |
removeBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position removedBlockedPosition)
This method removes a position from the list of blocked positions
|
void |
replacePlayerTile(int removeTileId,
int addTileId)
This method replaces a tileID in the TileList
|
void |
saveConfigToFile()
This method checks the configuration and saves it to a newly choosen file
|
void |
saveConfigToLoadedFile()
Checks the configuration and saves it to the location where it was loaded from (this is only called, if a configuration was loaded).
|
void |
setBlockedPositions(ArrayList<de.smarten.tsuro.shared.gamemodel.Position> blockedPositions)
This method sets the blocked positions
|
void |
setBoardLength(int size)
This method sets the length of the board.
|
void |
setPathOfLoadedFile(Path filePath)
It sets the path of a loaded file
|
void |
setRoundTimeAI(int time)
This method sets the roundtime of the AI
|
void |
setTileList(ArrayList<Integer> playerTiles)
This method sets a TileList
|
public ConfigurationControl(GuiControl guiControl)
guiControl
- the control class of the GUIpublic void createDefaultConfiguration()
IConfigurationControl
createDefaultConfiguration
in interface IConfigurationControl
public void loadConfiguration() throws IOException
IConfigurationControl
loadConfiguration
in interface IConfigurationControl
IOException
- if an I/O error occurs loading the filepublic boolean checkConfiguration() throws ConfigurationInvalidException
IConfigurationControl
checkConfiguration
in interface IConfigurationControl
ConfigurationInvalidException
- if at least one of the parameters of the configuration is invalidpublic void setBoardLength(int size)
IConfigurationControl
setBoardLength
in interface IConfigurationControl
size
- is the size the board should havepublic void setTileList(ArrayList<Integer> playerTiles)
IConfigurationControl
setTileList
in interface IConfigurationControl
playerTiles
- Tiles for the Playerpublic void replacePlayerTile(int removeTileId, int addTileId)
removeTileId
- the TileID to be replacedaddTileId
- the TileID to replace the old onepublic void setRoundTimeAI(int time)
IConfigurationControl
setRoundTimeAI
in interface IConfigurationControl
time
- time for the AI to take its turnpublic void setBlockedPositions(ArrayList<de.smarten.tsuro.shared.gamemodel.Position> blockedPositions)
setBlockedPositions
in interface IConfigurationControl
blockedPositions
- an ArrayList with the positions that should be blockedpublic void addBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position newBlockedPosition)
newBlockedPosition
- the Position to be addedpublic void removeBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position removedBlockedPosition)
removedBlockedPosition
- the Position to be removedpublic void saveConfigToFile() throws IOException, ConfigurationInvalidException
IConfigurationControl
saveConfigToFile
in interface IConfigurationControl
IOException
- if an I/O error occurs writing to or creating a fileConfigurationInvalidException
- if one of the parameters of the configuration is invalidpublic void saveConfigToLoadedFile() throws ConfigurationInvalidException, IOException
saveConfigToLoadedFile
in interface IConfigurationControl
IOException
- if an I/O error occurs writing to or creating the fileConfigurationInvalidException
- if at least one of the given parameters is invalidpublic void setPathOfLoadedFile(Path filePath)
filePath
- the path that should be setpublic boolean pathOfLoadedFileIsNotEmpty()
public DynamicConfiguration getConfig()
Copyright © 2017 smarTen. All rights reserved.