|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.universe.DBItem | +--org.gjt.universe.GalaxyBase
Abstract class from which all concrete classes used to represent galaxies in the game are to be derived. This class contains implementation of basic primitive methods for the storage and manipulation of standard galaxy attributes. Subclasses merely have to override the generateSystems method to ensure that star systems and their planets are created as per the nature of the galaxy (e.g. randomly determined, loaded from a data file, a combination of the above, etc.).
GalaxyStd
,
GalaxyGliese
,
Serialized FormField Summary | |
private static GalaxyID |
currentID
|
private VectorSystemID |
GalaxySystems
|
private boolean |
HasGeneratedSystems
|
private GalaxyID |
ID
|
private java.lang.String |
name
|
Constructor Summary | |
(package private) |
GalaxyBase()
Designated constructor - generates unique ID for the galaxy object and adds it to the list of galaxies in the game. |
(package private) |
GalaxyBase(boolean dummy)
Constructor for GalaxyUndefined. |
Method Summary | |
void |
addSystem(SystemID SID)
Adds a star system to the galaxy. |
void |
generateSystems(float[] planetDistribution)
This method should be extended by subclasses to causes the receiving galaxy to generate the collection of star systems and associated planets which it will contain. |
VectorSystemID |
getGalaxySystems()
Returns the galaxy's system list. |
GalaxyID |
getID()
Return the ID |
Index |
getIndex()
See getID() in the subclasses for a typed version. |
java.lang.String |
getName()
|
SystemBase |
getRandomSystem()
This method returns a star system randomly selected from those prsent in the galaxy. |
SystemID |
getRandomSystemID()
This method returns the ID of a star system randomly selected from those present in the galaxy. |
VectorSystemID |
getRandomSystemIDs(int n)
This method returns a list of distinct IDs of a star system randomly selected from those present in the galaxy. |
boolean |
hasGeneratedSystems()
Returns true if the galaxy has been populated with star systems and their planets, and false if this has not yet been done. |
void |
setName(java.lang.String in_name)
|
Methods inherited from class org.gjt.universe.DBItem |
getLocation, getOwner, specificDisplayDebug |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static GalaxyID currentID
private GalaxyID ID
private java.lang.String name
private VectorSystemID GalaxySystems
private boolean HasGeneratedSystems
Constructor Detail |
GalaxyBase()
GalaxyBase(boolean dummy)
Method Detail |
public GalaxyID getID()
public Index getIndex()
DBItem
getIndex
in class DBItem
public java.lang.String getName()
getName
in class DBItem
public void setName(java.lang.String in_name)
public void addSystem(SystemID SID)
SID
- The unique ID of the system to be added.public VectorSystemID getGalaxySystems()
public boolean hasGeneratedSystems()
This method is primarily used as a guard to prevent the calling of generateSystems() more than once.
generateSystems( float[] planetDistribution )
public SystemID getRandomSystemID()
getRandomSystem()
public SystemBase getRandomSystem()
getRandomSystemID()
public VectorSystemID getRandomSystemIDs(int n)
n
- The number distinct system IDs desired.getRandomSystemID()
public void generateSystems(float[] planetDistribution) throws SchemeUnknownException, java.lang.InterruptedException
planetDistribution
- Array of floating point values representing the probability of planetary mass at successive distances from its primary.
SchemeUnknownException
- If unable to determine a ID of the galaxy to which systems are to be added.
java.lang.InterruptedException
- If access to a resource needed for star system generation has been interrupted.hasGeneratedSystems()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |