org.gjt.universe
Class ShipBase

java.lang.Object
  |
  +--org.gjt.universe.DBItem
        |
        +--org.gjt.universe.ShipBase
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ShipStd

public abstract class ShipBase
extends DBItem

This class represents one ship. Particulars about the ship like the crew and damage will be stored in this object (or a subclass.) See subclasses for more specifics. Information like location is stored in the fleet that the ship is a member.

See Also:
FleetBase, Serialized Form

Field Summary
private static ShipID currentID
           
private  ShipDesignID design
           
private  FleetID fleet
           
private  ShipID ID
           
private  java.lang.String name
           
private  CivID owner
           
 
Constructor Summary
protected ShipBase()
          This constructor makes an undefined ship object.
protected ShipBase(ShipDesignID SDID, CivID AID, java.lang.String in_name)
          This constructor makes a ship object.
 
Method Summary
abstract  boolean build()
           
 boolean colonize(PlanetID PID)
           
 void destroy()
          This method destroys the ship.
abstract  AttackBase getAttack()
           
abstract  DefenseBase getDefense()
           
 FleetID getFleet()
          Returns the fleet that this ship is a member.
 ShipID getID()
          Returns the ID of the ship.
 Index getIndex()
          See getID() in the subclasses for a typed version.
 java.lang.String getName()
          Returns the name of this ship.
 CivID getOwner()
          Returns the owner (civ) of this ship.
 ShipDesignID getShipDesign()
          Returns the ship design of this ship.
abstract  SpeedBase getSpeed()
          Returns the speed of the ship.
 boolean isColonizable()
           
 void setFleet(FleetID FID)
          Sets the fleet this ship is a member.
 void setName(java.lang.String new_name)
          Sets the name of the ship.
 
Methods inherited from class org.gjt.universe.DBItem
getLocation, specificDisplayDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentID

private static ShipID currentID

ID

private ShipID ID

design

private ShipDesignID design

fleet

private FleetID fleet

owner

private CivID owner

name

private java.lang.String name
Constructor Detail

ShipBase

protected ShipBase(ShipDesignID SDID,
                   CivID AID,
                   java.lang.String in_name)
This constructor makes a ship object.

Parameters:
SDID - Ship design of this ship.
AID - owner of this ship.
in_name - name of this ship.

ShipBase

protected ShipBase()
This constructor makes an undefined ship object.

Method Detail

getID

public ShipID getID()
Returns the ID of the ship.


getIndex

public Index getIndex()
Description copied from class: DBItem
See getID() in the subclasses for a typed version.

Specified by:
getIndex in class DBItem

getName

public java.lang.String getName()
Returns the name of this ship.

Specified by:
getName in class DBItem

setName

public void setName(java.lang.String new_name)
Sets the name of the ship.


getOwner

public CivID getOwner()
Returns the owner (civ) of this ship.

Overrides:
getOwner in class DBItem

getShipDesign

public ShipDesignID getShipDesign()
Returns the ship design of this ship.


setFleet

public void setFleet(FleetID FID)
Sets the fleet this ship is a member.


getFleet

public FleetID getFleet()
Returns the fleet that this ship is a member.


getAttack

public abstract AttackBase getAttack()

getDefense

public abstract DefenseBase getDefense()

getSpeed

public abstract SpeedBase getSpeed()
Returns the speed of the ship. This should be a function of the ShipDesign's engine and the damage of the ship.


build

public abstract boolean build()

isColonizable

public boolean isColonizable()

colonize

public boolean colonize(PlanetID PID)

destroy

public void destroy()
This method destroys the ship. It is removed from the fleet it is a member of and that fleet is destroyed if no more ships exist in it.



Copyright © 2001 Universe Dev Team All Rights Reserved.