public class Opt4JTask extends Task implements ControlListener, OptimizerIterationListener
Opt4JTask
executes one optimization process.Task
Task.State
Modifier and Type | Field and Description |
---|---|
protected boolean |
closeOnStop |
protected com.google.inject.Injector |
injector |
protected boolean |
isClosed |
protected Optimizer |
optimizer |
protected com.google.inject.Injector |
parentInjector |
Constructor and Description |
---|
Opt4JTask()
Constructs a
Opt4JTask . |
Opt4JTask(boolean closeOnStop)
Constructs a
Opt4JTask . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the task.
|
void |
execute()
Executes the
Task . |
protected com.google.inject.Injector |
getInjector()
Returns the
Injector of the task. |
<O> O |
getInstance(java.lang.Class<O> type)
Returns the instance of the given class.
|
int |
getIteration()
Returns the current iteration.
|
protected Optimizer |
getOptimizer()
Returns the
Optimizer of the task. |
void |
init(java.util.Collection<com.google.inject.Module> modules)
Initializes the
Task with modules. |
void |
init(com.google.inject.Injector injector)
Initialize with a parent
Injector . |
void |
iterationComplete(int iteration)
Invoked if the
Optimizer completes an iteration. |
void |
open()
Initialize a task manually before executing it.
|
void |
stateChanged(Control.State state)
Invoked if the state of the
Control changes. |
addStateListener, call, getException, getModules, getState, init, removeStateListener, setState, toString
protected Optimizer optimizer
protected com.google.inject.Injector injector
protected com.google.inject.Injector parentInjector
protected final boolean closeOnStop
protected boolean isClosed
@Inject public Opt4JTask()
Opt4JTask
.public Opt4JTask(boolean closeOnStop)
Opt4JTask
.closeOnStop
- close automatically after optimizationpublic void execute() throws java.lang.Exception
Task
Task
.public void init(java.util.Collection<com.google.inject.Module> modules)
Task
Task
with modules. Note that if a module is a
PropertyModule
, a copy is made with the
PropertyModule.clone()
method. If the Module
is not a
PropertyModule
, the module is copied as a reference, i.e., it can
be changed until the Task.execute()
is called.public void init(com.google.inject.Injector injector)
Injector
.injector
- the parent injectorpublic void close()
public void open()
public int getIteration()
public <O> O getInstance(java.lang.Class<O> type)
O
- the type of classtype
- the classprotected com.google.inject.Injector getInjector()
Injector
of the task.protected Optimizer getOptimizer()
Optimizer
of the task.public void stateChanged(Control.State state)
ControlListener
Control
changes.stateChanged
in interface ControlListener
state
- the current state of the optimization processpublic void iterationComplete(int iteration)
OptimizerIterationListener
Optimizer
completes an iteration.iterationComplete
in interface OptimizerIterationListener
iteration
- the completed iteration