org.gjt.universe
Class PlanetBase

java.lang.Object
  |
  +--org.gjt.universe.DBItem
        |
        +--org.gjt.universe.PlanetBase
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Planet_001, PlanetUndefined

public abstract class PlanetBase
extends DBItem

See Also:
Serialized Form

Field Summary
private static PlanetID currentID
           
private  VectorFleetID fleetsInOrbit
           
private  VectorStationID GroundStationList
           
private  PlanetID ID
           
private  SimpleAccrete.PlanetaryMakeup makeup
           
private  java.lang.String name
           
private static java.text.NumberFormat ourNumberFormat
           
private  CivID owner
           
private  PlanetID planetaryPrimaryID
           
private  PlanetType planetType
           
private  int starIndex
           
private  SystemID SystemMember
           
 
Constructor Summary
protected PlanetBase()
          This constructor is used to create a special "undefined" planet instance.
protected PlanetBase(SystemID SID, int starIndex, java.lang.String in_name)
          This is the designated constructor for instances of this class/ It creates a new instance of a planet in the given star system, orbiting the given star in that system, and having the given name.
 
Method Summary
 void addGroundStation(StationID BID)
          This method adds the given ground station to those present on the planet.
abstract  void drawInfoPanelOne(GUIFactoryOne gui, javax.swing.JPanel panel)
           
 void fleetArrived(FleetBase aFleet)
          This method is called automatically by fleets when they arrive in orbit around the planet.
 void fleetDeparted(FleetBase aFleet)
          This method is called automatically by fleets when they depart orbit around the planet.
 VectorFleetID getFleetsInOrbit()
          This method returns the IDs of all fleets currently in orbit around the planet.
 java.lang.String getGravityString()
          This method returns a string representing the gravity of the planet.
 VectorStationID getGroundStationList()
           
 PlanetID getID()
           
static PlanetID getID(java.lang.String in_name)
           
 Index getIndex()
          See getID() in the subclasses for a typed version.
 Location getLocation()
           
 java.lang.String getName()
           
 CivID getOwner()
          Returns the ID of the civ who is considered the owner of the planet (i.e.
 PlanetID getPlanetaryPrimaryID()
          This method returns the ID of the planetary body which the receiving instance is orbiting.
 SimpleAccrete.PlanetaryMakeup getPlanetMakeup()
          This method returns the planetary make-up of the receiving instance.
 PlanetType getPlanetType()
          This method returns an object representing the general classification of the planet based on its make-up.
 java.lang.String getRadiusString()
          This method returns a string representing the radius of the planet.
abstract  void getSpecificTableInfo(CivID AID, DisplayReturn DR)
          This function allows additional values to be presented in the planet table.
 int getStarIndex()
          Returns the index of the star within the planet's system that the planet is orbiting.
 SystemID getSystemID()
           
 java.lang.String getTemperatureString()
          This method returns a string representing the temperature of the planet.
 boolean isInhabited()
          This method returns true if the receiving planet instance is populated, and false otherwise.
 boolean isInhabitedByAnotherCiv(CivID aCivID)
          This method returns true if the receiving planet instance is populated by member's of a civilization other than the one given, and false otherwise.
 boolean isInhabitedByCiv(CivID aCivID)
          This method returns true if the receiving planet instance is populated by member's of the given civilization, and false otherwise.
 boolean isMoon()
          This method returns true if the receiving instance represents a moon orbiting another planetary body.
 void setName(java.lang.String new_name)
           
 void setOwner(CivID newOwner)
          This method sets the owner of the planet to be the civ with the given ID.
 void setPlanetaryPrimaryID(PlanetID newValue)
          This method sets the ID of the planetary body which the receiving instance is orbiting.
 void setPlanetMakeup(SimpleAccrete.PlanetaryMakeup pm)
          This method sets the planetary make-up of the receiving instance to the given value.
 void setStarIndex(int newValue)
          Sets the index of the star within the plane'ts system that the planet is orbiting.
abstract  void setToHomePlanetValues()
           
abstract  VectorDisplayReturn specificDisplay()
          This method returns the ID of the receiving instance
 
Methods inherited from class org.gjt.universe.DBItem
specificDisplayDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentID

private static PlanetID currentID

ourNumberFormat

private static java.text.NumberFormat ourNumberFormat

ID

private PlanetID ID

SystemMember

private SystemID SystemMember

GroundStationList

private VectorStationID GroundStationList

makeup

private SimpleAccrete.PlanetaryMakeup makeup

planetType

private PlanetType planetType

name

private java.lang.String name

owner

private CivID owner

starIndex

private int starIndex

planetaryPrimaryID

private PlanetID planetaryPrimaryID

fleetsInOrbit

private VectorFleetID fleetsInOrbit
Constructor Detail

PlanetBase

protected PlanetBase(SystemID SID,
                     int starIndex,
                     java.lang.String in_name)
This is the designated constructor for instances of this class/ It creates a new instance of a planet in the given star system, orbiting the given star in that system, and having the given name. As well, the planet will be given a default planetary make-up. This method handles adding the new instance to the master list of planets in the game, as well as the list of plaents present in its assigned system.

Parameters:
SID - The unique ID of the star syste to which the planet is being added.
starIndex - The index of the star within that system which the planet is orbiting.
in_name - The name to be assigned to the planet.

PlanetBase

protected PlanetBase()
This constructor is used to create a special "undefined" planet instance.

Method Detail

getID

public PlanetID getID()

getIndex

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

Specified by:
getIndex in class DBItem

getID

public static PlanetID getID(java.lang.String in_name)

getName

public java.lang.String getName()
Specified by:
getName in class DBItem

setName

public void setName(java.lang.String new_name)

getSystemID

public SystemID getSystemID()

getLocation

public Location getLocation()
Overrides:
getLocation in class DBItem

getOwner

public CivID getOwner()
Returns the ID of the civ who is considered the owner of the planet (i.e. the earliest colonizer who is still present). If the planet is not owned by any civ then null is returned.

Overrides:
getOwner in class DBItem

setOwner

public void setOwner(CivID newOwner)
This method sets the owner of the planet to be the civ with the given ID. This may, in turn, affect the ownership of the star system containing the planet.

Parameters:
newOwner - The unique ID of the new owner.
See Also:
SystemBase.planetChangedOwner( PlanetID aPlanetID, CivID newPlanetOwner )

addGroundStation

public void addGroundStation(StationID BID)
This method adds the given ground station to those present on the planet. If the planet currently has no owner or had an owner but was left unoccupied, then the owner of the station becomes the owner of the planet.

Parameters:
BID - The unique ID of the station.

getGroundStationList

public VectorStationID getGroundStationList()

isInhabited

public boolean isInhabited()
This method returns true if the receiving planet instance is populated, and false otherwise. Currently this is implemented as a simple check to see if there are any ground stations, but this may be enhanced in the future or by subclasing in a scheme. For example, we may wish to support abandoned and/or fully-automated stations that would not count.


isInhabitedByCiv

public boolean isInhabitedByCiv(CivID aCivID)
This method returns true if the receiving planet instance is populated by member's of the given civilization, and false otherwise. Currently this is implemented as a simple check to see if there are any ground stations owned by the given civ, but this may be enhanced in the future or by subclasing in a scheme. For example, we may wish to support abandoned and/or fully- automated stations that would not count.

Parameters:
aCivID - The unique ID of the civilization being sought.
See Also:
isInhabitedByAnotherCiv( CivID x )

isInhabitedByAnotherCiv

public boolean isInhabitedByAnotherCiv(CivID aCivID)
This method returns true if the receiving planet instance is populated by member's of a civilization other than the one given, and false otherwise. Note that this method does not check for the existance of a station owned by the given civilization. Currently this is implemented as a simple check to see if there are any ground stations owned by the a different civilization than the one given, but this may be enhanced in the future or by subclasing in a scheme. For example, we may wish to support abandoned and/or fully- automated stations that would not count.

Parameters:
aCivID - The unique ID of the civilization whose stations are to be ignored.
See Also:
isInhabitedByCiv( CivID x )

getPlanetMakeup

public SimpleAccrete.PlanetaryMakeup getPlanetMakeup()
This method returns the planetary make-up of the receiving instance.


setPlanetMakeup

public void setPlanetMakeup(SimpleAccrete.PlanetaryMakeup pm)
This method sets the planetary make-up of the receiving instance to the given value. This method automatically updates he planet type classification to match the new make-up.

Parameters:
pm - The new planetary make-up to be assigned to to the planet.
See Also:
getPlanetType()

getPlanetType

public PlanetType getPlanetType()
This method returns an object representing the general classification of the planet based on its make-up.

See Also:
setPlanetMakeup(SimpleAccrete.PlanetaryMakeup pm)

getStarIndex

public int getStarIndex()
Returns the index of the star within the planet's system that the planet is orbiting.


setStarIndex

public void setStarIndex(int newValue)
Sets the index of the star within the plane'ts system that the planet is orbiting.


isMoon

public boolean isMoon()
This method returns true if the receiving instance represents a moon orbiting another planetary body. Otherwise, the receiving instance is a planet directly orbiting its star and this method returns false.

See Also:
getPlanetaryPrimaryID(), setPlanetaryPrimaryID( PlanetID newValue )

setPlanetaryPrimaryID

public void setPlanetaryPrimaryID(PlanetID newValue)
This method sets the ID of the planetary body which the receiving instance is orbiting. If set to null, then the receiving instance is considered to be directly orbiting its star.

Parameters:
newValue - The ID of the planetary body which this body is orbiting.
See Also:
isMoon(), getPlanetaryPrimaryID()

getPlanetaryPrimaryID

public PlanetID getPlanetaryPrimaryID()
This method returns the ID of the planetary body which the receiving instance is orbiting. If the receiving instance is considered to be directly orbiting its star this method returns null.

See Also:
isMoon(), setPlanetaryPrimaryID( PlanetID newValue )

getFleetsInOrbit

public VectorFleetID getFleetsInOrbit()
This method returns the IDs of all fleets currently in orbit around the planet.


fleetArrived

public void fleetArrived(FleetBase aFleet)
This method is called automatically by fleets when they arrive in orbit around the planet. This method adds the fleet's ID to the list of those in orbit.

Parameters:
aFleet - The fleet which just arrived.

fleetDeparted

public void fleetDeparted(FleetBase aFleet)
This method is called automatically by fleets when they depart orbit around the planet. This method removes the fleet's ID from the list of those in orbit.

Parameters:
aFleet - The fleet which just arrived.

specificDisplay

public abstract VectorDisplayReturn specificDisplay()
This method returns the ID of the receiving instance


getSpecificTableInfo

public abstract void getSpecificTableInfo(CivID AID,
                                          DisplayReturn DR)
This function allows additional values to be presented in the planet table.


setToHomePlanetValues

public abstract void setToHomePlanetValues()

drawInfoPanelOne

public abstract void drawInfoPanelOne(GUIFactoryOne gui,
                                      javax.swing.JPanel panel)

getRadiusString

public java.lang.String getRadiusString()
This method returns a string representing the radius of the planet. Bodies less than 0.01 times the radius of the Earth will give their values in kilometers. Larger bodies will give their radius in multiples of the Earth's radius. In both cases the units used will be appended as a suffix.


getGravityString

public java.lang.String getGravityString()
This method returns a string representing the gravity of the planet. The gravity classification is returned with the actual value appended in brackets as a suffix if non-zero. Actual values are given in terms of Earth gravities.


getTemperatureString

public java.lang.String getTemperatureString()
This method returns a string representing the temperature of the planet. The temperature classification is returned with the actual minimum and maximum values appended in brackets as a suffix. Actual values are given in Celsius.



Copyright © 2001 Universe Dev Team All Rights Reserved.