Class IntegerOption

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • value

        private int value
        The value of this option.
      • maximumValue

        private int maximumValue
        A upper bound on the value of this option.
      • minimumValue

        private int minimumValue
        A lower bound on the value of this option.
      • stepSize

        private int stepSize
        The step size to be used when this option is displayed using a spinner.
      • MAXIMUM_VALUE_TAG

        private static final java.lang.String MAXIMUM_VALUE_TAG
        See Also:
        Constant Field Values
      • MINIMUM_VALUE_TAG

        private static final java.lang.String MINIMUM_VALUE_TAG
        See Also:
        Constant Field Values
    • Constructor Detail

      • IntegerOption

        public IntegerOption​(Specification specification)
        Creates a new IntegerOption.
        Parameters:
        specification - The Specification to refer to.
      • IntegerOption

        public IntegerOption​(java.lang.String id,
                             Specification specification)
        Creates a new IntegerOption.
        Parameters:
        id - The object identifier.
        specification - The Specification to refer to.
    • Method Detail

      • getMinimumValue

        public int getMinimumValue()
        Get the minimum allowed value.
        Returns:
        The minimum value allowed by this option.
      • setMinimumValue

        public void setMinimumValue​(int minimumValue)
        Set the minimum allowed value.
        Parameters:
        minimumValue - The new minimum value.
      • getMaximumValue

        public int getMaximumValue()
        Get the maximum allowed value.
        Returns:
        The maximum value allowed by this option.
      • setMaximumValue

        public void setMaximumValue​(int maximumValue)
        Set the maximum allowed value.
        Parameters:
        maximumValue - The new maximum value.
      • limitValue

        public int limitValue​(int value)
        Limit a value with respect to the limits of this option.
        Parameters:
        value - The value to limit.
        Returns:
        The value limited by the option limits.
      • getStepSize

        public int getStepSize()
        Gets the step size to be used when this option is displayed using a spinner.
        Returns:
        The step size, if defined, or 0.
      • getValue

        public java.lang.Integer getValue()
        Gets the value of this option.
        Specified by:
        getValue in interface Option<java.lang.Integer>
        Specified by:
        getValue in class AbstractOption<java.lang.Integer>
        Returns:
        The value of this Option.
      • setValue

        public void setValue​(java.lang.Integer value)
        Sets the value of this option.
        Specified by:
        setValue in interface Option<java.lang.Integer>
        Specified by:
        setValue in class AbstractOption<java.lang.Integer>
        Parameters:
        value - The new value of this Option.
      • setValue

        protected void setValue​(java.lang.String valueString,
                                java.lang.String defaultValueString)
        Sets the value of this option from the given string representation. Both parameters must not be null at the same time. This method does nothing. Override it if the option has a suitable string representation.
        Overrides:
        setValue in class AbstractOption<java.lang.Integer>
        Parameters:
        valueString - The string representation of the value of this Option.
        defaultValueString - The string representation of the default value of this Option.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class AbstractOption<java.lang.Integer>
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readAttributes

        protected void readAttributes​(FreeColXMLReader xr)
                               throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class AbstractOption<java.lang.Integer>
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.