games.strategy.engine.data
Class Territory

java.lang.Object
  extended by games.strategy.engine.data.GameDataComponent
      extended by games.strategy.engine.data.DefaultNamed
          extended by games.strategy.engine.data.NamedAttachable
              extended by games.strategy.engine.data.Territory
All Implemented Interfaces:
Attachable, Named, NamedUnitHolder, UnitHolder, java.io.Serializable, java.lang.Comparable<Territory>

public class Territory
extends NamedAttachable
implements NamedUnitHolder, java.io.Serializable, java.lang.Comparable<Territory>

Version:
1.0
Author:
Sean Bridges
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface games.strategy.engine.data.UnitHolder
PLAYER, TERRITORY
 
Constructor Summary
Territory(java.lang.String name, boolean water, GameData data)
          Creates new Territory
Territory(java.lang.String name, boolean water, GameData data, int... coordinate)
          Creates new Territory
 
Method Summary
 int compareTo(Territory o)
           
 PlayerID getOwner()
          May be null if not owned.
 java.lang.String getType()
           
 UnitCollection getUnits()
          Get the units in this territory
 int getX()
           
 int getY()
           
 boolean isWater()
           
 boolean matchesCoordinates(int... coordinate)
           
 void notifyChanged()
           
 void setOwner(PlayerID newOwner)
           
 java.lang.String toString()
           
 
Methods inherited from class games.strategy.engine.data.NamedAttachable
addAttachment, getAttachment, getAttachments
 
Methods inherited from class games.strategy.engine.data.DefaultNamed
equals, getName, hashCode
 
Methods inherited from class games.strategy.engine.data.GameDataComponent
getData, readInternal, writeInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface games.strategy.engine.data.Named
getName
 

Constructor Detail

Territory

public Territory(java.lang.String name,
                 boolean water,
                 GameData data)
Creates new Territory


Territory

public Territory(java.lang.String name,
                 boolean water,
                 GameData data,
                 int... coordinate)
Creates new Territory

Method Detail

isWater

public boolean isWater()

getOwner

public PlayerID getOwner()
May be null if not owned.


setOwner

public void setOwner(PlayerID newOwner)

getUnits

public UnitCollection getUnits()
Get the units in this territory

Specified by:
getUnits in interface UnitHolder

notifyChanged

public void notifyChanged()
Specified by:
notifyChanged in interface UnitHolder

toString

public java.lang.String toString()
Overrides:
toString in class DefaultNamed

compareTo

public int compareTo(Territory o)
Specified by:
compareTo in interface java.lang.Comparable<Territory>

getType

public java.lang.String getType()
Specified by:
getType in interface UnitHolder

matchesCoordinates

public boolean matchesCoordinates(int... coordinate)

getX

public int getX()

getY

public int getY()