universe.server.database
Class SystemBase

java.lang.Object
  |
  +--universe.common.database.DBItem
        |
        +--universe.server.database.SystemBase
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SystemStd

public abstract class SystemBase
extends DBItem

The abstract base class from which concrete star system classes are defined. A star system contains one or more stars, and zero or more planets orbiting these stars. The system is enclosed in a single hyperlimit (i.e. the stars in the system orbit each other close enough that they represent a single end point to a hyperspace flight).

Version:
$Id: SystemBase.java,v 1.6 2003/04/03 00:20:55 sstarkey Exp $
Author:
Sean Starkey, Allan Noordvyk (noordvyk@home.com)
See Also:
SystemStd, Serialized Form

Field Summary
private  Coord coord_location
           
private static SystemID currentID
           
private  java.util.Vector fleetsInOrbit
           
private  GalaxyID GalaxyMember
           
private  SystemID ID
           
private  java.util.Vector myStars
           
private  java.util.Vector myWormholeIDs
           
private  java.lang.String name
           
private  CivID owner
           
private  SimpleAccrete.StarMakeup starMakeup
           
private  java.util.Vector systemPlanets
           
 
Constructor Summary
protected SystemBase()
          Creates a new system with a default undefined name and ID.
protected SystemBase(GalaxyID in_galID, java.lang.String in_name, Coord in_coord, SimpleAccrete.StarMakeup sm)
          Creates a new instance of this class, containing a single star and no planets.
 
Method Summary
 void addPlanet(PlanetID PID)
          Adds a new planet with the given ID to the system instance.
 void addStar(Star aStar)
          Adds the given star to the set of those present in the system.
 void generatePlanetsForStar(SimpleAccrete.PlanetaryMakeup[] pms, int starIndex)
          Adds planets to the star with the given index in the system, based on the given planetary make-ups.
 Coord getCoords()
          Returns the three-space coordinates of the system instance within the galaxy to which it belongs.
 java.util.Vector getFleetsInOrbit()
          This method returns the IDs of all fleets currently directly orbiting the star system.
 java.util.Vector getFleetsPresent()
          This method returns the IDs of all fleets currently present in the star system, regardless of the individual body within the star system which the fleet is directly orbiting.
 GalaxyID getGalaxy()
          Returns the ID of the galaxy to which the system instance belongs
 SystemID getID()
          Returns the unique ID assigned to the receiving system when it was created.
 Index getIndex()
          Simply calls getID().
 java.lang.String getName()
          Returns the name of the receiving system.
 CivID getOwner()
          Returns the ID of the civ who is deemed to be in control of the receiving system.
 SimpleAccrete.StarMakeup getStarMakeup()
          Returns the stellar make-up of the primary star in the receiving system instance.
 java.util.Vector getStars()
           
 java.util.Vector getSystemPlanets()
          Returns the planets which are orbitting the system instance.
 java.util.Vector getWormholeIDs()
          Returns a vector of wormhole IDs representing the wormholes with end-points in the star system.
 void planetChangedOwner(PlanetID aPlanetID, CivID newPlanetOwner)
          This method is called by planets in the star system when they have changed ownership.
 void setName(java.lang.String newName)
          Sets the name of the receiving system.
 void setOwner(CivID newOwner)
          Sets the civ who is deemed to be in control of the system instance.
 void setStarMakeup(SimpleAccrete.StarMakeup sm)
          Sets the stellar make-up of the primary star in the receiving instance.
 Star starAtIndex(int index)
          This method returns the star at the given index in the set of those stars present in the system.
 int starCount()
          This method returns the number of stars present in the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentID

private static SystemID currentID

ID

private SystemID ID

name

private java.lang.String name

GalaxyMember

private GalaxyID GalaxyMember

coord_location

private Coord coord_location

myStars

private java.util.Vector myStars

systemPlanets

private java.util.Vector systemPlanets

starMakeup

private SimpleAccrete.StarMakeup starMakeup

owner

private CivID owner

myWormholeIDs

private java.util.Vector myWormholeIDs

fleetsInOrbit

private java.util.Vector fleetsInOrbit
Constructor Detail

SystemBase

protected SystemBase(GalaxyID in_galID,
                     java.lang.String in_name,
                     Coord in_coord,
                     SimpleAccrete.StarMakeup sm)
Creates a new instance of this class, containing a single star and no planets.

Parameters:
in_galID - The unique ID of the galaxy to which the system is being added.
in_name - The name which is to be shown to the user for this system.
in_coord - The coordinates of the system within its galaxy.
sm - The composition of the intial star in the system.

SystemBase

protected SystemBase()
Creates a new system with a default undefined name and ID.

Method Detail

getID

public SystemID getID()
Returns the unique ID assigned to the receiving system when it was created.


getIndex

public Index getIndex()
Simply calls getID(). Used for backwards compatibility.

Specified by:
getIndex in class DBItem
See Also:
getID()

getName

public java.lang.String getName()
Returns the name of the receiving system.

Specified by:
getName in class DBItem

setName

public void setName(java.lang.String newName)
Sets the name of the receiving system.


getOwner

public CivID getOwner()
Returns the ID of the civ who is deemed to be in control of the receiving system. If the star system is not owned by any civ then null is returned.

See Also:
setOwner( CivID newOwner ), planetChangedOwner( PlanetID aPlanetID, CivID newPlanetOwner )

setOwner

public void setOwner(CivID newOwner)
Sets the civ who is deemed to be in control of the system instance.


getCoords

public Coord getCoords()
Returns the three-space coordinates of the system instance within the galaxy to which it belongs.


getGalaxy

public GalaxyID getGalaxy()
Returns the ID of the galaxy to which the system instance belongs


getStarMakeup

public SimpleAccrete.StarMakeup getStarMakeup()
Returns the stellar make-up of the primary star in the receiving system instance.


setStarMakeup

public void setStarMakeup(SimpleAccrete.StarMakeup sm)
Sets the stellar make-up of the primary star in the receiving instance.


starCount

public int starCount()
This method returns the number of stars present in the system.

See Also:
starAtIndex

starAtIndex

public Star starAtIndex(int index)
This method returns the star at the given index in the set of those stars present in the system.

Parameters:
index - The position of the desired star in the set of those present in the system (starting from zero).

addStar

public void addStar(Star aStar)
Adds the given star to the set of those present in the system. This method causes the name of the system to be updated to reflect the additional star.

Parameters:
aStar - The star to be added as a new component of the system.

getStars

public java.util.Vector getStars()

getSystemPlanets

public java.util.Vector getSystemPlanets()
Returns the planets which are orbitting the system instance. The planet objects in the returned vector will be given in ascending order of distance from their primary.


addPlanet

public void addPlanet(PlanetID PID)
Adds a new planet with the given ID to the system instance.

Parameters:
PID - The unique ID of the planet to be added. NOTE: Check if this this method called anywhere? Maybe from PlanetBase?

generatePlanetsForStar

public void generatePlanetsForStar(SimpleAccrete.PlanetaryMakeup[] pms,
                                   int starIndex)
Adds planets to the star with the given index in the system, based on the given planetary make-ups. The generated planets will be given default names based on their star and relative position in the array (e.g. If the star is Altair, the planets will be Altair I, Altair II, and so on).

Parameters:
pms - Planetary make-up information for the new planets.
starIndex - Index of the star that is being populated with planets.

planetChangedOwner

public void planetChangedOwner(PlanetID aPlanetID,
                               CivID newPlanetOwner)
This method is called by planets in the star system when they have changed ownership. The receiving instance decides if this means a change of ownership of the star system as a whole by determining if there are any remaining planets still occupied by an original owner.


getWormholeIDs

public java.util.Vector getWormholeIDs()
Returns a vector of wormhole IDs representing the wormholes with end-points in the star system. If the system contains no wormholes, then an empty vector is returned.


getFleetsInOrbit

public java.util.Vector getFleetsInOrbit()
This method returns the IDs of all fleets currently directly orbiting the star system. This does not include fleets which are orbiting a planet within the star system.

See Also:
getFleetsPresent

getFleetsPresent

public java.util.Vector getFleetsPresent()
This method returns the IDs of all fleets currently present in the star system, regardless of the individual body within the star system which the fleet is directly orbiting.

See Also:
getFleetsInOrbit


Copyright © 2001 Universe Dev Team All Rights Reserved.