dip.world
Class Unit

java.lang.Object
  extended bydip.world.Unit
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Unit
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A Unit is an object that has an owner (power), a coast location, and a Type describing that unit.

Units are placed in Provinces.

This object is not immutable!

See Also:
Serialized Form

Nested Class Summary
static class Unit.Type
          A Type is the class of unit, for example, Army or Fleet.
 
Field Summary
protected  Coast coast
           
protected  Power owner
           
protected  Unit.Type type
           
 
Constructor Summary
Unit(Power power, Unit.Type unitType)
          Creates a new Unit
 
Method Summary
 java.lang.Object clone()
          Returns a Clone of the unit.
 boolean equals(java.lang.Object obj)
          Returns if two Units are equivalent.
 Coast getCoast()
          Get the Coast where this Unit is located
 Power getPower()
          Get the Power who controls this Unit
 Unit.Type getType()
          Get the Type of unit (e.g., Army or Fleet)
 void setCoast(Coast coast)
          Set the coast of a unit.
 java.lang.String toString()
          Displays internal object values.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected final Unit.Type type

owner

protected final Power owner

coast

protected Coast coast
Constructor Detail

Unit

public Unit(Power power,
            Unit.Type unitType)
Creates a new Unit

Method Detail

setCoast

public void setCoast(Coast coast)
Set the coast of a unit.


getCoast

public Coast getCoast()
Get the Coast where this Unit is located


getPower

public Power getPower()
Get the Power who controls this Unit


getType

public Unit.Type getType()
Get the Type of unit (e.g., Army or Fleet)


equals

public boolean equals(java.lang.Object obj)
Returns if two Units are equivalent.


clone

public java.lang.Object clone()
Returns a Clone of the unit. Note that this is not a strict implementation of clone(); a constructor is invoked for performance reasons.


toString

public java.lang.String toString()
Displays internal object values. For debugging use only!



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.