net.sf.freecol.common.model
Class SettlementType

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObjectType
          extended by net.sf.freecol.common.model.SettlementType

public class SettlementType
extends FreeColGameObjectType


Field Summary
private  boolean capital
          Whether this SettlementType is a capital.
private  int claimableRadius
          How many tiles this SettlementType can claim.
private  int extraClaimableRadius
          The extra radius beyond the claimableRadius where wandering units may claim as yet unclaimed tiles.
private  java.util.List<RandomRange> gifts
          The gifts this SettlementType generates when visited by a scout.
private  int maximumGrowth
          The maximum number of tiles to grown this SettlementType.
private  int maximumSize
          The maximum number of units for this SettlementType.
private  int minimumGrowth
          The minimum number of tiles to grow this SettlementType.
private  int minimumSize
          The minimum number of units for this SettlementType.
private  java.util.List<RandomRange> plunder
          The plunder this SettlementType generates when destroyed.
private  int tradeBonus
          The general trade bonus, roughly proportional to the settlement size and general sophistication.
private  int visibleRadius
          How many tiles this SettlementType can see.
private  int wanderingRadius
          How far units from this SettlementType may roam.
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
SettlementType(java.lang.String id, Specification specification)
          Creates a new SettlementType instance.
 
Method Summary
 int getClaimableRadius()
          Get the ClaimableRadius value.
 int getExtraClaimableRadius()
          Get the extraClaimableRadius value.
 RandomRange getGifts(Unit unit)
          Get the Gifts value.
 int getMaximumGrowth()
          Get the maximum growth value.
 int getMaximumSize()
          Get the MaximumSize value.
 int getMinimumGrowth()
          Get the minimum growth value.
 int getMinimumSize()
          Get the MinimumSize value.
 RandomRange getPlunderRange(Unit unit)
          Gets the plunder range available for the supplied unit.
 int getTradeBonus()
          Gets the trade bonus.
 int getVisibleRadius()
          Get the VisibleRadius value.
 int getWanderingRadius()
          Get the WanderingRadius value.
 int getWarehouseCapacity()
          Gets the warehouse capacity of this settlement.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 boolean isCapital()
          Get the Capital value.
protected  void readAttributes(javax.xml.stream.XMLStreamReader in)
          Reads the attributes of this object from an XML stream.
protected  void readChild(javax.xml.stream.XMLStreamReader in)
          Reads a child object.
 void setCapital(boolean newCapital)
          Set the Capital value.
 void setClaimableRadius(int newClaimableRadius)
          Set the ClaimableRadius value.
 void setGifts(RandomRange newGifts)
          Set the Gifts value.
 void setMaximumSize(int newMaximumSize)
          Set the MaximumSize value.
 void setMinimumSize(int newMinimumSize)
          Set the MinimumSize value.
 void setPlunder(RandomRange newPlunder)
          Set the Plunder value.
 void setVisibleRadius(int newVisibleRadius)
          Set the VisibleRadius value.
 void setWanderingRadius(int newWanderingRadius)
          Set the WanderingRadius value.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
protected  void writeChildren(javax.xml.stream.XMLStreamWriter out)
          Write the children of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, applyDifficultyLevel, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierIndex, getModifierSet, getNameKey, hasAbility, hasAbility, isAbstractType, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, toString, toXMLImpl
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

capital

private boolean capital
Whether this SettlementType is a capital.


visibleRadius

private int visibleRadius
How many tiles this SettlementType can see.


claimableRadius

private int claimableRadius
How many tiles this SettlementType can claim.


extraClaimableRadius

private int extraClaimableRadius
The extra radius beyond the claimableRadius where wandering units may claim as yet unclaimed tiles.


wanderingRadius

private int wanderingRadius
How far units from this SettlementType may roam.


plunder

private java.util.List<RandomRange> plunder
The plunder this SettlementType generates when destroyed.


gifts

private java.util.List<RandomRange> gifts
The gifts this SettlementType generates when visited by a scout.


minimumSize

private int minimumSize
The minimum number of units for this SettlementType.


maximumSize

private int maximumSize
The maximum number of units for this SettlementType.


minimumGrowth

private int minimumGrowth
The minimum number of tiles to grow this SettlementType.


maximumGrowth

private int maximumGrowth
The maximum number of tiles to grown this SettlementType.


tradeBonus

private int tradeBonus
The general trade bonus, roughly proportional to the settlement size and general sophistication.

Constructor Detail

SettlementType

public SettlementType(java.lang.String id,
                      Specification specification)
Creates a new SettlementType instance.

Parameters:
id - a String value
specification - a Specification value
Method Detail

isCapital

public final boolean isCapital()
Get the Capital value.

Returns:
a boolean value

setCapital

public final void setCapital(boolean newCapital)
Set the Capital value.

Parameters:
newCapital - The new Capital value.

getMinimumSize

public final int getMinimumSize()
Get the MinimumSize value.

Returns:
an int value

setMinimumSize

public final void setMinimumSize(int newMinimumSize)
Set the MinimumSize value.

Parameters:
newMinimumSize - The new MinimumSize value.

getMaximumSize

public final int getMaximumSize()
Get the MaximumSize value.

Returns:
an int value

setMaximumSize

public final void setMaximumSize(int newMaximumSize)
Set the MaximumSize value.

Parameters:
newMaximumSize - The new MaximumSize value.

getVisibleRadius

public final int getVisibleRadius()
Get the VisibleRadius value.

Returns:
an int value

setVisibleRadius

public final void setVisibleRadius(int newVisibleRadius)
Set the VisibleRadius value.

Parameters:
newVisibleRadius - The new VisibleRadius value.

getClaimableRadius

public final int getClaimableRadius()
Get the ClaimableRadius value.

Returns:
an int value

getExtraClaimableRadius

public final int getExtraClaimableRadius()
Get the extraClaimableRadius value.

Returns:
The extra claimable radius.

setClaimableRadius

public final void setClaimableRadius(int newClaimableRadius)
Set the ClaimableRadius value.

Parameters:
newClaimableRadius - The new ClaimableRadius value.

getWanderingRadius

public final int getWanderingRadius()
Get the WanderingRadius value.

Returns:
an int value

setWanderingRadius

public final void setWanderingRadius(int newWanderingRadius)
Set the WanderingRadius value.

Parameters:
newWanderingRadius - The new WanderingRadius value.

getMinimumGrowth

public final int getMinimumGrowth()
Get the minimum growth value.

Returns:
The minimum number of tiles to try to grow this settlement type by.

getMaximumGrowth

public final int getMaximumGrowth()
Get the maximum growth value.

Returns:
The maximum number of tiles to try to grow this settlement type by.

getTradeBonus

public final int getTradeBonus()
Gets the trade bonus.

Returns:
The general bonus to trade.

getPlunderRange

public final RandomRange getPlunderRange(Unit unit)
Gets the plunder range available for the supplied unit.

Parameters:
unit - The Unit to check.
Returns:
The plunder range.

setPlunder

public final void setPlunder(RandomRange newPlunder)
Set the Plunder value.

Parameters:
newPlunder - The new Plunder value.

getGifts

public final RandomRange getGifts(Unit unit)
Get the Gifts value.

Parameters:
unit - an Unit value
Returns:
a RandomRange value

setGifts

public final void setGifts(RandomRange newGifts)
Set the Gifts value.

Parameters:
newGifts - The new Gifts value.

getWarehouseCapacity

public int getWarehouseCapacity()
Gets the warehouse capacity of this settlement.

Returns:
The warehouse capacity of this settlement.

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Overrides:
toXMLImpl in class FreeColGameObjectType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeChildren

protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
                      throws javax.xml.stream.XMLStreamException
Write the children of this object to a stream.

Overrides:
writeChildren in class FreeColGameObjectType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Reads the attributes of this object from an XML stream.

Overrides:
readAttributes in class FreeColGameObjectType
Parameters:
in - The XML input stream.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

readChild

protected void readChild(javax.xml.stream.XMLStreamReader in)
                  throws javax.xml.stream.XMLStreamException
Reads a child object.

Overrides:
readChild in class FreeColGameObjectType
Parameters:
in - The XML stream to read.
Throws:
javax.xml.stream.XMLStreamException - if an error occurs

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"settlementType".