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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Exceptionprotected booleanprotected final Set<TaskStateListener>protected final List<com.google.inject.Module>protected Task.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateListener(TaskStateListener listener) Adds aTaskStateListener.call()abstract voidexecute()Executes theTask.Collection<com.google.inject.Module>Returns a copy of theModules of thisTask.getState()Returns the state of theTask.voidinit(com.google.inject.Module... modules) Initializes theTaskwith modules.voidinit(Collection<com.google.inject.Module> modules) Initializes theTaskwith modules.voidremoveStateListener(TaskStateListener listener) Removes aTaskStateListener.protected voidsetState(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 theTaskwith modules.- Parameters:
modules- the modules for the task- See Also:
-
init
Initializes theTaskwith modules. Note that if a module is aPropertyModule, a copy is made with thePropertyModule.clone()method. If theModuleis 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 theModules of thisTask.- Returns:
- a set of modules
-