Class ExportData

  • All Implemented Interfaces:
    java.lang.Comparable<FreeColObject>, ObjectWithId

    public class ExportData
    extends FreeColObject
    Objects of this class hold the export data for a particular type of goods.
    • Field Detail

      • highLevel

        private int highLevel
        The high water mark for the goods type.
      • lowLevel

        private int lowLevel
        The low water mark for the goods type.
      • importLevel

        private int importLevel
        The amount of goods to import to, do not import when this is present.
      • exportLevel

        private int exportLevel
        The amount of goods to retain, goods beyond this amount are exported.
      • exported

        private boolean exported
        Whether to export or not.
      • EXPORT_LEVEL_TAG

        private static final java.lang.String EXPORT_LEVEL_TAG
        See Also:
        Constant Field Values
      • IMPORT_LEVEL_TAG

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

      • ExportData

        public ExportData()
        Trivial constructor for Game.newInstance.
      • ExportData

        public ExportData​(GoodsType goodsType,
                          int importLevel)
        Creates a new ExportData instance with default settings.
        Parameters:
        goodsType - The GoodsType this data refers to.
        importLevel - The import level to use.
      • ExportData

        public ExportData​(FreeColXMLReader xr)
                   throws javax.xml.stream.XMLStreamException
        Create a new ExportData by reading a stream.
        Parameters:
        xr - The FreeColXMLReader to read.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
    • Method Detail

      • getHighLevel

        public final int getHighLevel()
        Get the high water mark for this data.
        Returns:
        The high water mark.
      • setHighLevel

        public final ExportData setHighLevel​(int newHighLevel)
        Set the high water mark for this data.
        Parameters:
        newHighLevel - The new high water mark value.
        Returns:
        This export data.
      • getLowLevel

        public final int getLowLevel()
        Get the low water mark for this data.
        Returns:
        The low water mark.
      • setLowLevel

        public final ExportData setLowLevel​(int newLowLevel)
        Set the low water mark for this data.
        Parameters:
        newLowLevel - The new low water mark value.
        Returns:
        This export data.
      • getImportLevel

        public final int getImportLevel()
        Get the import level.
        Returns:
        The import level.
      • getEffectiveImportLevel

        public final int getEffectiveImportLevel​(int capacity)
        Get the effective import level given the warehouse capacity to default to when the actual import level is invalid.
        Parameters:
        capacity - The warehouse capacity.
        Returns:
        The effective import level.
      • setImportLevel

        public final ExportData setImportLevel​(int newImportLevel)
        Set the import level.
        Parameters:
        newImportLevel - The new import level value.
        Returns:
        This export data.
      • getExportLevel

        public final int getExportLevel()
        Get the export level.
        Returns:
        The export level.
      • setExportLevel

        public final ExportData setExportLevel​(int newExportLevel)
        Set the export level.
        Parameters:
        newExportLevel - The new export level value.
        Returns:
        This export data.
      • getExported

        public final boolean getExported()
        Can the goods type of this export data to be exported?
        Returns:
        True if this goods type is to be exported.
      • setExported

        public final void setExported​(boolean newExport)
        Set export status of the goods type of this export data.
        Parameters:
        newExport - The new export status.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class FreeColObject
        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

        public void readAttributes​(FreeColXMLReader xr)
                            throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class FreeColObject
        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.