Package net.sf.freecol.common.model
Class ExportData
- java.lang.Object
-
- net.sf.freecol.common.model.FreeColObject
-
- net.sf.freecol.common.model.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 Summary
Fields Modifier and Type Field Description private static int
EXPORT_LEVEL_DEFAULT
private static java.lang.String
EXPORT_LEVEL_TAG
private boolean
exported
Whether to export or not.private static java.lang.String
EXPORTED_TAG
private int
exportLevel
The amount of goods to retain, goods beyond this amount are exported.private static int
HIGH_LEVEL_DEFAULT
private static java.lang.String
HIGH_LEVEL_TAG
private int
highLevel
The high water mark for the goods type.private static java.lang.String
IMPORT_LEVEL_TAG
private int
importLevel
The amount of goods to import to, do not import when this is present.private static int
LOW_LEVEL_DEFAULT
private static java.lang.String
LOW_LEVEL_TAG
private int
lowLevel
The low water mark for the goods type.static java.lang.String
TAG
-
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE_TAG, DEFAULT_CLASS_INDEX, fcoComparator, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE_TAG, VALUE_TAG
-
-
Constructor Summary
Constructors Constructor Description ExportData()
Trivial constructor for Game.newInstance.ExportData(FreeColXMLReader xr)
Create a newExportData
by reading a stream.ExportData(GoodsType goodsType, int importLevel)
Creates a newExportData
instance with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends FreeColObject>
booleancopyIn(T other)
Copy another FreeColObject into this one if it is compatible.int
getEffectiveImportLevel(int capacity)
Get the effective import level given the warehouse capacity to default to when the actual import level is invalid.boolean
getExported()
Can the goods type of this export data to be exported?int
getExportLevel()
Get the export level.int
getHighLevel()
Get the high water mark for this data.int
getImportLevel()
Get the import level.int
getLowLevel()
Get the low water mark for this data.java.lang.String
getXMLTagName()
Get the serialization tag for this object.void
readAttributes(FreeColXMLReader xr)
Reads the attributes of this object from an XML stream.void
setExported(boolean newExport)
Set export status of the goods type of this export data.ExportData
setExportLevel(int newExportLevel)
Set the export level.ExportData
setHighLevel(int newHighLevel)
Set the high water mark for this data.ExportData
setImportLevel(int newImportLevel)
Set the import level.ExportData
setLowLevel(int newLowLevel)
Set the low water mark for this data.protected void
writeAttributes(FreeColXMLWriter xw)
Write the attributes of this object to a stream.-
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addAbility, addFeatures, addModifier, addPropertyChangeListener, addPropertyChangeListener, apply, apply, applyModifiers, applyModifiers, arrayKey, compareIds, compareTo, containsAbilityKey, containsModifierKey, copy, copy, copy, copy, copyInCast, dumpObject, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAbilities, getAbilities, getAbilities, getAbilities, getClassIndex, getDefenceModifiers, getDisplayObject, getFeatureContainer, getFreeColObjectClass, getFreeColObjectClassByName, getGame, getId, getIdNumber, getIdType, getIdTypeByName, getModifiers, getModifiers, getModifiers, getModifiers, getObjectClassIndex, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getSortedAbilities, getSortedModifiers, getSpecification, getSuffix, getSuffix, hasAbility, hasAbility, hasAbility, hashCode, hasListeners, hasModifier, hasModifier, hasModifier, idEquals, invokeMethod, logFreeColObjects, readChild, readChildren, readFromXML, readFromXMLPartial, removeAbilities, removeAbility, removeFeatures, removeModifier, removeModifiers, removePropertyChangeListener, removePropertyChangeListener, save, save, save, save, serialize, serialize, serialize, serialize, setGame, setId, setSpecification, toString, toXML, toXML, toXMLPartial, toXMLPartial, writeChildren
-
-
-
-
Field Detail
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
HIGH_LEVEL_DEFAULT
private static final int HIGH_LEVEL_DEFAULT
- See Also:
- Constant Field Values
-
LOW_LEVEL_DEFAULT
private static final int LOW_LEVEL_DEFAULT
- See Also:
- Constant Field Values
-
EXPORT_LEVEL_DEFAULT
private static final int EXPORT_LEVEL_DEFAULT
- See Also:
- Constant Field Values
-
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.
-
EXPORTED_TAG
private static final java.lang.String EXPORTED_TAG
- See Also:
- Constant Field Values
-
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
-
HIGH_LEVEL_TAG
private static final java.lang.String HIGH_LEVEL_TAG
- See Also:
- Constant Field Values
-
LOW_LEVEL_TAG
private static final java.lang.String LOW_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 newExportData
instance with default settings.- Parameters:
goodsType
- TheGoodsType
this data refers to.importLevel
- The import level to use.
-
ExportData
public ExportData(FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException
Create a newExportData
by reading a stream.- Parameters:
xr
- TheFreeColXMLReader
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 classFreeColObject
- Type Parameters:
T
- TheFreeColObject
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 classFreeColObject
- Parameters:
xw
- TheFreeColXMLWriter
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 classFreeColObject
- Parameters:
xr
- TheFreeColXMLReader
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 classFreeColObject
- Returns:
- The tag.
-
-