|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--universe.common.database.DBItem | +--universe.server.database.GalaxyBase | +--universe.server.database.GalaxyStd | +--universe.server.database.GalaxySpiral
This class implements instances of randomly generated spiral galaxies. This type of galaxy is good for large scale games. At smaller scales, the spiral nature of the galaxy does not work as well, and thus an elliptical or globular galaxy is more suitable.
GalaxyElliptical
,
GalaxyGlobular
,
Serialized FormField Summary | |
static java.lang.String |
DESCRIPTION
|
private float |
myAngStep
|
private int |
myArmCount
|
private float |
myCurrentAng
|
private int |
myCurrentArm
|
private float |
myCurrentRad
|
private float[] |
myLastArmX
|
private float[] |
myLastArmY
|
private float |
myRadStep
|
Fields inherited from class universe.server.database.GalaxyStd |
ourRandGen |
Fields inherited from class universe.server.database.GalaxyBase |
|
Constructor Summary | |
GalaxySpiral(float width,
float height,
float depth,
float density)
This is the designated constructor which should be used to create instances of this class. |
Method Summary | |
Coord |
newSystemCoord()
This method returns a random coordinate within the overall shape of the galaxy (as tested with containsCoord). |
private void |
resetGenerator()
This method is called by the initializer to prepare for the first call to newSystemCoord and by that method when the generation of new systems has reached the edge and must return to generating new systems from the center. |
int |
starSystemCount()
This method has been overridden to reflect the fact that approx. |
java.lang.String |
structureDescription()
This method overrides that of our superclass to return "Spiral". |
Methods inherited from class universe.server.database.GalaxyStd |
containsCoord, generateSystems, getCenter, getDensity, getSpan |
Methods inherited from class universe.server.database.GalaxyBase |
addSystem, getID, getIndex, getName, getSystems, hasGeneratedSystems, setName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String DESCRIPTION
private float myAngStep
private float myCurrentAng
private float myRadStep
private float myCurrentRad
private int myArmCount
private int myCurrentArm
private float[] myLastArmX
private float[] myLastArmY
Constructor Detail |
public GalaxySpiral(float width, float height, float depth, float density)
width
- The width of the galaxy (in parsecs)height
- The height of the galaxy (in parsecs)depth
- The depth of the galaxy (in parsecs)density
- The average density (in systems per cubic parsec) of stars within the hull of the galaxy (not its bounding cube).Method Detail |
public java.lang.String structureDescription()
structureDescription
in class GalaxyStd
public int starSystemCount()
starSystemCount
in class GalaxyStd
private void resetGenerator()
public Coord newSystemCoord()
GalaxyStd
While this method is primarily used by the standard contructor it can also be used to generate locations for random events in interstellar space within the galaxy.
Subclasses may choose to override this method in order to more efficiently generate coordinates within some kind of overall galactic structure, as this implementation will test random points throughout the bounding cube. However, overridding the containsCoord method is all that is minimally required to get a new shape. Subclasses wishing to have the star system distribution follow a general internal structure, however, will definately wish to override this method.
newSystemCoord
in class GalaxyStd
#containsCoord()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |