Class AbstractOptions

java.lang.Object
megamek.common.options.AbstractOptions
All Implemented Interfaces:
Serializable, IGameOptions
Direct Known Subclasses:
BasicGameOptions, PartialRepairs, PilotOptions, Quirks, SimulationOptions, WeaponQuirks

public abstract class AbstractOptions extends Object implements Serializable, IGameOptions
Parent class for options settings
See Also:
  • Field Details

  • Constructor Details

    • AbstractOptions

      protected AbstractOptions()
  • Method Details

    • initialize

      protected abstract void initialize()
    • getOptionMap

      public Map<String,IOption> getOptionMap()
    • count

      public int count()
      Description copied from interface: IGameOptions
      Returns a count of all options in this object.
      Specified by:
      count in interface IGameOptions
      Returns:
      Option count.
    • count

      public int count(String groupKey)
      Description copied from interface: IGameOptions
      Returns a count of all options in this object with the given group key.
      Specified by:
      count in interface IGameOptions
      Parameters:
      groupKey - the group key to filter on. Null signifies to return all options indiscriminately.
      Returns:
      Option count.
    • getOptionList

      public String getOptionList(String separator)
      Description copied from interface: IGameOptions
      Returns a string of all the quirk "codes" for this entity, using sep as the separator
      Specified by:
      getOptionList in interface IGameOptions
      Parameters:
      separator - The separator to insert between codes, in addition to a space
    • getOptionListString

      public String getOptionListString(String separator, String groupKey)
      Description copied from interface: IGameOptions
      Returns a string of all the quirk "codes" for this entity, using sep as the separator, filtering on a specific group key.
      Specified by:
      getOptionListString in interface IGameOptions
      Parameters:
      separator - The separator to insert between codes, in addition to a space
      groupKey - The group key to use to filter options. Null signifies to return all options indiscriminately.
    • getGroups

      public Enumeration<IOptionGroup> getGroups()
      Description copied from interface: IGameOptions
      Returns the Enumeration of the option groups in the options container.
      Specified by:
      getGroups in interface IGameOptions
      Returns:
      Enumeration of the IOptionGroup
    • getOptions

      public Enumeration<IOption> getOptions()
      Description copied from interface: IGameOptions
      Returns the Enumeration of the options in this options container. The order of options is not specified.
      Specified by:
      getOptions in interface IGameOptions
      Returns:
      Enumeration of the IOption
    • getOptionsList

      public Collection<IOption> getOptionsList()
      Description copied from interface: IGameOptions
      Returns a collection of all the options in this options container, regardless of whether they're active/selected or not. Note that this Collection is unmodifiable, but the contained IOptions are not copied, so changing their state will affect this options object.
      Specified by:
      getOptionsList in interface IGameOptions
      Returns:
      A collection containing all IOptions of this options object
    • getOptionInfo

      public IOptionInfo getOptionInfo(String name)
      Description copied from interface: IGameOptions
      Returns the UI specific data to allow the user to set the option
      Specified by:
      getOptionInfo in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      UI specific data
      See Also:
    • getOption

      @Nullable public IOption getOption(String name)
      Description copied from interface: IGameOptions
      Returns the option by name or null if there is no such option
      Specified by:
      getOption in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      the option or null if there is no such option
    • booleanOption

      public boolean booleanOption(String name)
      Description copied from interface: IGameOptions
      Returns the value of the desired option as the boolean
      Specified by:
      booleanOption in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      the value of the desired option as the boolean
    • intOption

      public int intOption(String name)
      Description copied from interface: IGameOptions
      Returns the value of the desired option as the int
      Specified by:
      intOption in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      the value of the desired option as the int
    • floatOption

      public float floatOption(String name)
      Description copied from interface: IGameOptions
      Returns the value of the desired option as the float
      Specified by:
      floatOption in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      the value of the desired option as the float
    • stringOption

      public String stringOption(String name)
      Description copied from interface: IGameOptions
      Returns the value of the desired option as the String
      Specified by:
      stringOption in interface IGameOptions
      Parameters:
      name - option name
      Returns:
      the value of the desired option as the String
    • getOptionsInfo

      public IOptionsInfo getOptionsInfo()
      Description copied from interface: IGameOptions
      Returns the options info object for this options object.
      Specified by:
      getOptionsInfo in interface IGameOptions
      Returns:
      the options info object for this options object.
    • getOptionsInfoImp

      protected abstract AbstractOptionsInfo getOptionsInfoImp()
    • addGroup

      protected IBasicOptionGroup addGroup(String groupName)
    • addGroup

      protected IBasicOptionGroup addGroup(String groupName, String key)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, String defaultValue)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, boolean defaultValue)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, int defaultValue)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, float defaultValue)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, Vector<String> defaultValue)
    • addOption

      protected void addOption(IBasicOptionGroup group, String name, int type, Object defaultValue)