Package org.evoludo.simulator.views
Class Phase2D.TraitCommand
Object
TraitCommand
- All Implemented Interfaces:
Scheduler.ScheduledCommand
,Command
- Enclosing class:
Phase2D
Command to toggle the inclusion of a trait on the phase plane axis.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTraitCommand
(int trait, int axis) Construct a new command to toggle the inclusion of a trait on either one of the phase plane axis. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Toggle the inclusion of the trait on the axis.(package private) int[]
toggleState
(int[] states, ContextMenuCheckBoxItem[] items) Toggle the inclusion of traits that are selected initems
on the current axis.
-
Field Details
-
X_AXIS
public static final int X_AXISThe index of the horizontal axis.- See Also:
-
Y_AXIS
public static final int Y_AXISThe index of the vertical axis.- See Also:
-
trait
int traitThe index of the trait to show on the axis. -
axis
int axisThe axis that this command affects.
-
-
Constructor Details
-
TraitCommand
public TraitCommand(int trait, int axis) Construct a new command to toggle the inclusion of a trait on either one of the phase plane axis.- Parameters:
trait
- the index of the trait to show/hide on the axisaxis
- the index of the axis
-
-
Method Details
-
execute
public void execute()Toggle the inclusion of the trait on the axis.- Specified by:
execute
in interfaceCommand
- Specified by:
execute
in interfaceScheduler.ScheduledCommand
-
toggleState
Toggle the inclusion of traits that are selected initems
on the current axis.- Parameters:
states
- the list of trait indices that are displayed on current axisitems
- the list of context menu items- Returns:
- the updated list of trait indices
-