Package org.opt4j.viewer
Class PopulationWidget
- java.lang.Object
-
- org.opt4j.viewer.PopulationWidget
-
- All Implemented Interfaces:
IndividualSetListener,IndividualStateListener,ObjectivesMonitor.ObjectivesListener,Widget
public class PopulationWidget extends Object implements IndividualStateListener, IndividualSetListener, Widget, ObjectivesMonitor.ObjectivesListener
A widget that monitors thePopulation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classPopulationWidget.Modelprotected classPopulationWidget.Table
-
Field Summary
Fields Modifier and Type Field Description protected Archivearchiveprotected List<Objective>objectivesprotected static intOFFSETprotected JPanelpanelprotected org.opt4j.viewer.SynchronizedIndividualListpopulationprotected intsizeprotected List<Individual>swtIndividualsprotected JTabletableprotected DelayTasktask
-
Constructor Summary
Constructors Constructor Description PopulationWidget(Population population, Archive archive, IndividualFactory individualFactory, ObjectivesMonitor objectivesMonitor)Constructs aPopulationWidget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JPanelgetPanel()Returns the panel with the content.protected JTablegetTable()voidindividualAdded(IndividualSet collection, Individual individual)Invoked if theIndividualis added to theIndividualSet.voidindividualRemoved(IndividualSet collection, Individual individual)Invoked if theIndividualis removed from theIndividualSet.voidinidividualStateChanged(Individual individual)Invoked if theIndividualchanges its state.voidinit(Viewport viewport)Called once after the widget is added to theViewport.voidobjectives(Collection<Objective> obj)Callback method that passes the objectives of the optimization problem.protected voidpaint()
-
-
-
Field Detail
-
OFFSET
protected static final int OFFSET
- See Also:
- Constant Field Values
-
archive
protected final Archive archive
-
population
protected final org.opt4j.viewer.SynchronizedIndividualList population
-
swtIndividuals
protected List<Individual> swtIndividuals
-
panel
protected final JPanel panel
-
table
protected final JTable table
-
size
protected int size
-
task
protected final DelayTask task
-
-
Constructor Detail
-
PopulationWidget
@Inject public PopulationWidget(Population population, Archive archive, IndividualFactory individualFactory, ObjectivesMonitor objectivesMonitor)
Constructs aPopulationWidget.- Parameters:
population- the populationarchive- the archiveindividualFactory- the individual creatorobjectivesMonitor- the objective monitor that determine the objective of the optimization problem
-
-
Method Detail
-
getTable
protected final JTable getTable()
-
init
public void init(Viewport viewport)
Description copied from interface:WidgetCalled once after the widget is added to theViewport.
-
inidividualStateChanged
public void inidividualStateChanged(Individual individual)
Description copied from interface:IndividualStateListenerInvoked if theIndividualchanges its state.- Specified by:
inidividualStateChangedin interfaceIndividualStateListener- Parameters:
individual- the individual that changes the state
-
individualAdded
public void individualAdded(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis added to theIndividualSet.- Specified by:
individualAddedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the added individual
-
individualRemoved
public void individualRemoved(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis removed from theIndividualSet.- Specified by:
individualRemovedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the removed individual
-
paint
protected void paint()
-
getPanel
public JPanel getPanel()
Description copied from interface:WidgetReturns the panel with the content.
-
objectives
public void objectives(Collection<Objective> obj)
Description copied from interface:ObjectivesMonitor.ObjectivesListenerCallback method that passes the objectives of the optimization problem.- Specified by:
objectivesin interfaceObjectivesMonitor.ObjectivesListener- Parameters:
obj- the objectives
-
-