universe.server.database
Class PlanetBase

java.lang.Object
  |
  +--universe.common.database.DBItem
        |
        +--universe.server.database.PlanetBase
All Implemented Interfaces:
java.io.Serializable

public class PlanetBase
extends DBItem

See Also:
Serialized Form

Field Summary
private static PlanetID currentID
           
private  java.util.Vector fleetsInOrbit
           
private  java.util.Vector 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  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, SimpleAccrete.PlanetaryMakeup pm)
          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
 java.util.Vector 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.
 java.util.Vector getGroundStationList()
          This method adds the given ground station to those present on the planet.
 PlanetID getID()
           
 Index getIndex()
           
 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.
 java.lang.String getRadiusString()
          This method returns a string representing the radius of the planet.
 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 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.
 
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 java.util.Vector GroundStationList

makeup

private SimpleAccrete.PlanetaryMakeup makeup

name

private java.lang.String name

owner

private CivID owner

starIndex

private int starIndex

planetaryPrimaryID

private PlanetID planetaryPrimaryID

fleetsInOrbit

private java.util.Vector fleetsInOrbit
Constructor Detail

PlanetBase

protected PlanetBase(SystemID SID,
                     int starIndex,
                     java.lang.String in_name,
                     SimpleAccrete.PlanetaryMakeup pm)
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()
Specified by:
getIndex in class DBItem
See Also:
in the subclasses for a typed version.

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

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.


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 )

getGroundStationList

public java.util.Vector getGroundStationList()
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.


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.


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

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 java.util.Vector getFleetsInOrbit()
This method returns the IDs of all fleets currently in orbit around the planet.


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.