Class Phase2D.TraitCommand

Object
TraitCommand
All Implemented Interfaces:
Scheduler.ScheduledCommand, Command
Enclosing class:
Phase2D

public class Phase2D.TraitCommand extends Object implements Command
Command to toggle the inclusion of a trait on the phase plane axis.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    The axis that this command affects.
    (package private) int
    The index of the trait to show on the axis.
    static final int
    The index of the horizontal axis.
    static final int
    The index of the vertical axis.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TraitCommand(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 Type
    Method
    Description
    void
    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 in items on the current axis.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • X_AXIS

      public static final int X_AXIS
      The index of the horizontal axis.
      See Also:
    • Y_AXIS

      public static final int Y_AXIS
      The index of the vertical axis.
      See Also:
    • trait

      int trait
      The index of the trait to show on the axis.
    • axis

      int axis
      The 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 axis
      axis - the index of the axis
  • Method Details

    • execute

      public void execute()
      Toggle the inclusion of the trait on the axis.
      Specified by:
      execute in interface Command
      Specified by:
      execute in interface Scheduler.ScheduledCommand
    • toggleState

      int[] toggleState(int[] states, ContextMenuCheckBoxItem[] items)
      Toggle the inclusion of traits that are selected in items on the current axis.
      Parameters:
      states - the list of trait indices that are displayed on current axis
      items - the list of context menu items
      Returns:
      the updated list of trait indices