games.strategy.engine.data
Class Rule

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.Rule
All Implemented Interfaces:
Attachable, Named, NamedUnitHolder, UnitHolder, java.io.Serializable, java.lang.Comparable<Rule>

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

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
Rule(java.lang.String name, boolean water, GameData data)
          Creates new Territory
Rule(java.lang.String name, boolean water, GameData data, int... coordinate)
          Creates new Territory
 
Method Summary
 int compareTo(Rule r)
           
 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()
           
 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

Rule

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


Rule

public Rule(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.


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(Rule r)
Specified by:
compareTo in interface java.lang.Comparable<Rule>

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()