Class ResourceType

    • Field Detail

      • maxValue

        private int maxValue
        Maximum and minimum values for this resource type.
      • minValue

        private int minValue
        Maximum and minimum values for this resource type.
      • 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

      • ResourceType

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

      • getMaxValue

        public int getMaxValue()
        Gets the maximum value for this resource.
        Returns:
        The maximum value.
      • getMinValue

        public int getMinValue()
        Gets the minimum value for this resource.
        Returns:
        The minimum value.
      • getBestGoodsType

        public GoodsType getBestGoodsType()
        Get the best goods type to make with this resource type.
        Returns:
        The best GoodsType.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class FreeColSpecObjectType
        Type Parameters:
        T - The FreeColObject subclass of the object to copy in.
        Parameters:
        other - The other object.
        Returns:
        True if the copy in is succesful.
      • 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 FreeColObject
        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 FreeColSpecObjectType
        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.