|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.FreeColGameObject
net.sf.freecol.common.model.Region
public class Region
A named region on the map.
| Nested Class Summary | |
|---|---|
static class |
Region.RegionType
|
| Field Summary | |
|---|---|
static java.lang.String |
CHILD_TAG
|
private java.util.List<Region> |
children
The children Regions of this Region. |
private boolean |
claimable
Whether this Region is claimable. |
private boolean |
discoverable
Whether this Region is discoverable. |
private Player |
discoveredBy
Which Player the Region was discovered by. |
private Turn |
discoveredIn
Which Turn the Region was discovered in. |
private java.lang.String |
name
The name of this Region. |
private java.lang.String |
nameKey
Key used to retrieve description from Messages. |
static java.lang.String |
PACIFIC_NAME_KEY
|
private Region |
parent
The parent Region of this Region. |
private boolean |
prediscovered
Whether the Region is already discovered when the game starts. |
private int |
scoreValue
How much discovering this Region contributes to your score. |
private Region.RegionType |
type
Describe type here. |
| Fields inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
UNITS_TAG_NAME |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
Region(Game game)
Creates a new Region instance. |
|
Region(Game game,
java.lang.String id)
Creates a new Region instance. |
|
Region(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new Region from an XML representation. |
|
| Method Summary | |
|---|---|
void |
addChild(Region child)
Add a child region to this region. |
HistoryEvent |
discover(Player player,
Turn turn,
java.lang.String newName)
Mark the Region as discovered. |
java.util.List<Region> |
getChildren()
Get the Children value. |
Region |
getDiscoverableRegion()
Returns a discoverable Region or null. |
Player |
getDiscoveredBy()
Get the DiscoveredBy value. |
Turn |
getDiscoveredIn()
Get the DiscoveredIn value. |
StringTemplate |
getLabel()
Returns the name or default name of this Region. |
java.lang.String |
getName()
Get the Name value. |
java.lang.String |
getNameKey()
Get the NameKey value. |
Region |
getParent()
Get the Parent value. |
int |
getScoreValue()
Get the ScoreValue value. |
Region.RegionType |
getType()
Get the Type value. |
java.lang.String |
getTypeNameKey()
|
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
isClaimable()
Get the Claimable value. |
boolean |
isDiscoverable()
Get the Discoverable value. |
boolean |
isLeaf()
Returns true if this is a leaf node. |
boolean |
isPacific()
Returns true if this Region is the Pacific
Ocean. |
boolean |
isPrediscovered()
Get the Prediscovered value. |
boolean |
isRoot()
Returns true if this is the whole map Region. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
setChildren(java.util.List<Region> newChildren)
Set the Children value. |
void |
setClaimable(boolean newClaimable)
Set the Claimable value. |
void |
setDiscoverable(boolean newDiscoverable)
Set the Discoverable value. |
void |
setDiscoveredBy(Player newDiscoveredBy)
Set the DiscoveredBy value. |
void |
setDiscoveredIn(Turn newDiscoveredIn)
Set the DiscoveredIn value. |
void |
setName(java.lang.String newName)
Set the Name value. |
void |
setNameKey(java.lang.String newNameKey)
Set the NameKey value. |
void |
setParent(Region newParent)
Set the Parent value. |
void |
setPrediscovered(boolean newPrediscovered)
Set the Prediscovered value. |
void |
setScoreValue(int newScoreValue)
Set the ScoreValue value. |
void |
setType(Region.RegionType newType)
Set the Type value. |
java.lang.String |
toString()
Gets a string representation of the object. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
This method writes an XML-representation of this object to the given stream. |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
dispose, disposeList, equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PACIFIC_NAME_KEY
public static final java.lang.String CHILD_TAG
private java.lang.String name
private java.lang.String nameKey
private Region parent
private boolean claimable
private boolean discoverable
private Turn discoveredIn
private Player discoveredBy
private boolean prediscovered
private int scoreValue
private Region.RegionType type
private java.util.List<Region> children
| Constructor Detail |
|---|
public Region(Game game)
Region instance.
game - a Game value
public Region(Game game,
java.lang.String id)
Region instance.
game - a Game valueid - a String value
public Region(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
Region from an XML representation.
game - The Game this object belongs to.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if an error occurred during parsing.| Method Detail |
|---|
public final java.lang.String getNameKey()
NameKey value.
String valuepublic final void setNameKey(java.lang.String newNameKey)
NameKey value.
newNameKey - The new NameKey value.public boolean isPacific()
true if this Region is the Pacific
Ocean. The Pacific Ocean is special in so far as it is the only
Region that could be discovered in the original game.
boolean valuepublic final java.lang.String getName()
Name value.
getName in interface NameableString valuepublic final void setName(java.lang.String newName)
Name value.
setName in interface NameablenewName - The new Name value.public StringTemplate getLabel()
String valuepublic java.lang.String getTypeNameKey()
public final Region getParent()
Parent value.
Region valuepublic final void setParent(Region newParent)
Parent value.
newParent - The new Parent value.public final java.util.List<Region> getChildren()
Children value.
List valuepublic final void setChildren(java.util.List<Region> newChildren)
Children value.
newChildren - The new Children value.public void addChild(Region child)
child - The child Region to add.public final boolean isClaimable()
Claimable value.
boolean valuepublic final void setClaimable(boolean newClaimable)
Claimable value.
newClaimable - The new Claimable value.public final boolean isDiscoverable()
Discoverable value.
boolean valuepublic final void setDiscoverable(boolean newDiscoverable)
Discoverable value.
newDiscoverable - The new Discoverable value.public final boolean isPrediscovered()
Prediscovered value.
boolean valuepublic final void setPrediscovered(boolean newPrediscovered)
Prediscovered value.
newPrediscovered - The new Prediscovered value.public final int getScoreValue()
ScoreValue value.
int valuepublic final void setScoreValue(int newScoreValue)
ScoreValue value.
newScoreValue - The new ScoreValue value.public final Region.RegionType getType()
Type value.
RegionType valuepublic final void setType(Region.RegionType newType)
Type value.
newType - The new Type value.public boolean isRoot()
boolean valuepublic boolean isLeaf()
boolean valuepublic Region getDiscoverableRegion()
Region valuepublic final Turn getDiscoveredIn()
DiscoveredIn value.
Turn valuepublic final void setDiscoveredIn(Turn newDiscoveredIn)
DiscoveredIn value.
newDiscoveredIn - The new DiscoveredIn value.public final Player getDiscoveredBy()
DiscoveredBy value.
Player valuepublic final void setDiscoveredBy(Player newDiscoveredBy)
DiscoveredBy value.
newDiscoveredBy - The new DiscoveredBy value.
public HistoryEvent discover(Player player,
Turn turn,
java.lang.String newName)
player - a Player valueturn - a Turn valuenewName - a String value
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
Player will be added
to that representation if showAll is set to
false.
toXMLImpl in class FreeColGameObjectout - The target stream.player - The Player this XML-representation should be
made for, or null if
showAll == true.showAll - Only attributes visible to player will be
added to the representation if showAll is set
to false.toSavedGame - If true then information that is only
needed when saving a game is added.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public java.lang.String toString()
FreeColGameObject
toString in class FreeColGameObjectpublic static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||