Package org.opt4j.config
Class Task
java.lang.Object
org.opt4j.config.Task
- Direct Known Subclasses:
Opt4JTask
The
Task
is an abstract class for optimization tasks.- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected Exception
protected boolean
protected final Set<TaskStateListener>
protected final List<com.google.inject.Module>
protected Task.State
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStateListener
(TaskStateListener listener) Adds aTaskStateListener
.call()
abstract void
execute()
Executes theTask
.Collection<com.google.inject.Module>
Returns a copy of theModule
s of thisTask
.getState()
Returns the state of theTask
.void
init
(com.google.inject.Module... modules) Initializes theTask
with modules.void
init
(Collection<com.google.inject.Module> modules) Initializes theTask
with modules.void
removeStateListener
(TaskStateListener listener) Removes aTaskStateListener
.protected void
setState
(Task.State state) Sets the state of theTask
.toString()
-
Field Details
-
state
-
e
-
modules
-
isInit
protected boolean isInit -
listeners
-
-
Constructor Details
-
Task
public Task()
-
-
Method Details
-
init
public void init(com.google.inject.Module... modules) Initializes theTask
with modules.- Parameters:
modules
- the modules for the task- See Also:
-
init
Initializes theTask
with modules. Note that if a module is aPropertyModule
, a copy is made with thePropertyModule.clone()
method. If theModule
is not aPropertyModule
, the module is copied as a reference, i.e., it can be changed until theexecute()
is called.- Parameters:
modules
- the modules for the task
-
execute
Executes theTask
.- Throws:
Exception
-
call
-
getException
- Returns:
- the occurred exception
-
getState
Returns the state of theTask
.- Returns:
- the state of the task
-
setState
Sets the state of theTask
.- Parameters:
state
- the state of the task to be set
-
toString
-
addStateListener
Adds aTaskStateListener
.- Parameters:
listener
- the listener to be added- See Also:
-
removeStateListener
Removes aTaskStateListener
.- Parameters:
listener
- the listener to be removed- See Also:
-
getModules
Returns a copy of theModule
s of thisTask
.- Returns:
- a set of modules
-