Package net.sf.freecol.common.option
Interface OptionContainer
-
- All Known Implementing Classes:
ActionManager
,ClientOptions
,OptionGroup
,Specification
public interface OptionContainer
The routines common to option containers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
getBoolean(java.lang.String id)
Gets the value of aBooleanOption
.default java.io.File
getFile(java.lang.String id)
Gets the file value of aFileOption
.default int
getInteger(java.lang.String id)
Gets the value of anIntegerOption
.default int
getIntegerMinimum(java.lang.String id)
Gets the minimum value of anIntegerOption
.default java.util.List<FreeColModFile>
getModList(java.lang.String id)
Gets the mod list from aModListOption
.<T extends Option>
TgetOption(java.lang.String id, java.lang.Class<T> returnClass)
Get an option in this group (or descendents) by object identifier.default OptionGroup
getOptionGroup(java.lang.String id)
Gets the value of anOptionGroup
.default int
getPercentage(java.lang.String id)
Gets the percentage value of aPercentageOption
.default double
getPercentageMultiplier(java.lang.String id)
Gets the percentage value of aPercentageOption
normalized to double.default int
getRange(java.lang.String id)
Gets the value of aRangeOption
.default int
getSelection(java.lang.String id)
Gets the value of aSelectOption
.default java.lang.String
getSelectionName(java.lang.String id)
Gets the name associated with the current value of aSelectOption
.default java.lang.String
getString(java.lang.String id)
Gets the string value of an option.default java.lang.String
getText(java.lang.String id)
Gets the value of aTextOption
.default java.util.List<AbstractUnit>
getUnitList(java.lang.String id)
Gets the unit list from aUnitListOption
.<T extends Option>
booleanhasOption(java.lang.String id, java.lang.Class<T> returnClass)
Is an option present in the container.default void
setBoolean(java.lang.String id, boolean value)
Sets the value of aBooleanOption
.default void
setFile(java.lang.String id, java.io.File value)
Sets the value of aFileOption
.default void
setInteger(java.lang.String id, int value)
Sets the value of anIntegerOption
.default void
setIntegerMinimum(java.lang.String id, java.lang.Integer value)
Sets the minimum value of anIntegerOption
.default void
setString(java.lang.String id, java.lang.String value)
Sets the string value of an option.default void
setText(java.lang.String id, java.lang.String value)
Sets the value of aTextOption
.
-
-
-
Method Detail
-
hasOption
<T extends Option> boolean hasOption(java.lang.String id, java.lang.Class<T> returnClass)
Is an option present in the container.- Type Parameters:
T
- The actual return type.- Parameters:
id
- The object identifier.returnClass
- The expected option class.- Returns:
- True if the option is present.
-
getOption
<T extends Option> T getOption(java.lang.String id, java.lang.Class<T> returnClass)
Get an option in this group (or descendents) by object identifier.- Type Parameters:
T
- The actual return type.- Parameters:
id
- The object identifier.returnClass
- The expected option class.- Returns:
- The option, or a run time exception if the option does not exist or is of the wrong class.
-
getBoolean
default boolean getBoolean(java.lang.String id)
Gets the value of aBooleanOption
.- Parameters:
id
- The object identifier.- Returns:
- The boolean value.
-
setBoolean
default void setBoolean(java.lang.String id, boolean value)
Sets the value of aBooleanOption
.- Parameters:
id
- The object identifier.value
- The new boolean value of the option.
-
getFile
default java.io.File getFile(java.lang.String id)
Gets the file value of aFileOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
setFile
default void setFile(java.lang.String id, java.io.File value)
Sets the value of aFileOption
.- Parameters:
id
- The object identifier.value
- The new value.
-
getInteger
default int getInteger(java.lang.String id)
Gets the value of anIntegerOption
.- Parameters:
id
- The object identifier.- Returns:
- The integer value.
-
setInteger
default void setInteger(java.lang.String id, int value)
Sets the value of anIntegerOption
.- Parameters:
id
- The object identifier.value
- The new integer value of the option.
-
getIntegerMinimum
default int getIntegerMinimum(java.lang.String id)
Gets the minimum value of anIntegerOption
.- Parameters:
id
- The object identifier.- Returns:
- value The minimum value.
-
setIntegerMinimum
default void setIntegerMinimum(java.lang.String id, java.lang.Integer value)
Sets the minimum value of anIntegerOption
.- Parameters:
id
- The object identifier.value
- The new minimum value.
-
getModList
default java.util.List<FreeColModFile> getModList(java.lang.String id)
Gets the mod list from aModListOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
getOptionGroup
default OptionGroup getOptionGroup(java.lang.String id)
Gets the value of anOptionGroup
.- Parameters:
id
- The object identifier.- Returns:
- The
OptionGroup
value.
-
getPercentage
default int getPercentage(java.lang.String id)
Gets the percentage value of aPercentageOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
getPercentageMultiplier
default double getPercentageMultiplier(java.lang.String id)
Gets the percentage value of aPercentageOption
normalized to double.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
getRange
default int getRange(java.lang.String id)
Gets the value of aRangeOption
.- Parameters:
id
- The object identifier.- Returns:
- The range value.
-
getString
default java.lang.String getString(java.lang.String id)
Gets the string value of an option.- Parameters:
id
- The object identifier.- Returns:
- The string value.
-
setString
default void setString(java.lang.String id, java.lang.String value)
Sets the string value of an option.- Parameters:
id
- The object identifier.value
- The new string value.
-
getSelection
default int getSelection(java.lang.String id)
Gets the value of aSelectOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
getSelectionName
default java.lang.String getSelectionName(java.lang.String id)
Gets the name associated with the current value of aSelectOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
getText
default java.lang.String getText(java.lang.String id)
Gets the value of aTextOption
.- Parameters:
id
- The object identifier.- Returns:
- The string value.
-
setText
default void setText(java.lang.String id, java.lang.String value)
Sets the value of aTextOption
.- Parameters:
id
- The object identifier.value
- The new string value.
-
getUnitList
default java.util.List<AbstractUnit> getUnitList(java.lang.String id)
Gets the unit list from aUnitListOption
.- Parameters:
id
- The object identifier.- Returns:
- The value.
-
-