public class PuzzleService extends java.lang.Object implements IPuzzleService, jadex.commons.IPropertiesProvider
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
agent
The agent to which the service belongs.
|
protected java.util.Map<java.lang.Integer,java.util.SortedSet<HighscoreEntry>> |
entries
The highscore entries (boardsize->sorted set).
|
protected jadex.bridge.IExternalAccess |
exta
The external access for decoupling settings service calls.
|
protected static int |
MAX_ENTRIES
The number of entries per board size in the high score list.
|
Constructor and Description |
---|
PuzzleService() |
Modifier and Type | Method and Description |
---|---|
jadex.commons.future.IFuture<java.lang.Void> |
addHighscore(HighscoreEntry entry)
Add a highscore entry and save the highscore list.
|
jadex.commons.future.IFuture<java.util.SortedSet<HighscoreEntry>> |
getHighscore(int size)
Get the highscore entries for a given board size.
|
jadex.commons.future.IFuture<jadex.commons.Properties> |
getProperties()
Write current state into properties.
|
jadex.commons.future.IFuture<Move> |
hint(Board board,
long timeout)
Solve the game and give a hint on the next move.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
save()
Save highscore using settings service.
|
jadex.commons.future.IFuture<java.lang.Void> |
setProperties(jadex.commons.Properties props)
Update from given properties.
|
jadex.commons.future.IFuture<java.lang.Void> |
shutdownService()
Termination method called on service shutdown.
|
jadex.commons.future.IFuture<java.lang.Void> |
startService()
Init method called on service startup.
|
protected static final int MAX_ENTRIES
protected jadex.bridge.IInternalAccess agent
protected jadex.bridge.IExternalAccess exta
protected java.util.Map<java.lang.Integer,java.util.SortedSet<HighscoreEntry>> entries
public jadex.commons.future.IFuture<java.lang.Void> startService()
public jadex.commons.future.IFuture<java.lang.Void> shutdownService()
public jadex.commons.future.IFuture<Move> hint(Board board, long timeout)
hint
in interface IPuzzleService
board
- The current board state.timeout
- A timeout to stop, when no solution is found in time (-1 for no timeout).java.lang.Exception
- in future, when puzzle can not be solved in time.public jadex.commons.future.IFuture<java.lang.Void> addHighscore(HighscoreEntry entry)
addHighscore
in interface IPuzzleService
entry
- The highscore entry.public jadex.commons.future.IFuture<java.util.SortedSet<HighscoreEntry>> getHighscore(int size)
getHighscore
in interface IPuzzleService
size
- The board size (e.g. 3, 5, ...).protected jadex.commons.future.IFuture<java.lang.Void> save()
public jadex.commons.future.IFuture<java.lang.Void> setProperties(jadex.commons.Properties props)
setProperties
in interface jadex.commons.IPropertiesProvider
public jadex.commons.future.IFuture<jadex.commons.Properties> getProperties()
getProperties
in interface jadex.commons.IPropertiesProvider