Package edu.kit.ipd.sdq.eventsim.command
Class CachingPCMModelCommandExecutor
- java.lang.Object
-
- edu.kit.ipd.sdq.eventsim.command.CachingPCMModelCommandExecutor
-
- All Implemented Interfaces:
ICommandExecutor<PCMModel>
public class CachingPCMModelCommandExecutor extends Object implements ICommandExecutor<PCMModel>
Use this class to executeICommand
s requiring access to a PCM model. Commands that are cachable, are executed only once. Further executions of the same command are served from the cache.In order to be cached, the
isCachable()
method of the command must returntrue
.
-
-
Constructor Summary
Constructors Constructor Description CachingPCMModelCommandExecutor(PCMModel pcm)
Constructs an executor that is capable of executingICommand
s operating on PCM models.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
execute(ICommand<T,PCMModel> command)
Executes the specified command.
-
-
-
Constructor Detail
-
CachingPCMModelCommandExecutor
public CachingPCMModelCommandExecutor(PCMModel pcm)
Constructs an executor that is capable of executingICommand
s operating on PCM models. Additionally, the commands are served from cache, if caching is enabled for the command and the command has been executed before.- Parameters:
pcm
- the PCM model on which the executed commands are to operate
-
-
Method Detail
-
execute
public <T> T execute(ICommand<T,PCMModel> command)
Executes the specified command.- Specified by:
execute
in interfaceICommandExecutor<PCMModel>
- Parameters:
command
- the command that is to be executed- Returns:
- the result of executing the specified command, or null if the return type (T) is
Void
.
-
-