org.gjt.universe
Class GameScale

java.lang.Object
  |
  +--org.gjt.universe.KeyedItem
        |
        +--org.gjt.universe.GameScale
All Implemented Interfaces:
java.io.Serializable

public class GameScale
extends KeyedItem
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static GameScale[] ALL_SCALES
           
static GameScale CUSTOM
           
static java.lang.String CUSTOM_KEY
           
private static GalaxyType[] GLIESE_GALAXY_TYPES
           
static GameScale HUGE
           
private static GalaxyType[] HUGE_GALAXY_TYPES
           
static GameScale HUGE_GLIESE
           
static java.lang.String HUGE_GLIESE_KEY
           
static java.lang.String HUGE_KEY
           
static GameScale INTERGALACTIC
           
private static GalaxyType[] INTERGALACTIC_GALAXY_TYPES
           
static java.lang.String INTERGALACTIC_KEY
           
static GameScale LARGE
           
private static GalaxyType[] LARGE_GALAXY_TYPES
           
static GameScale LARGE_GLIESE
           
static java.lang.String LARGE_GLIESE_KEY
           
static java.lang.String LARGE_KEY
           
static GameScale MEDIUM
           
private static GalaxyType[] MEDIUM_GALAXY_TYPES
           
static GameScale MEDIUM_GLIESE
           
static java.lang.String MEDIUM_GLIESE_KEY
           
static java.lang.String MEDIUM_KEY
           
private static float MIN_DENSITY
           
private static float MIN_DIAMETER
           
private static int MIN_GALAXY_COUNT
           
private  GalaxyType[] myGalaxyTypes
           
private  float myMaxDensity
           
private  float myMaxDiameter
           
private  int myMaxGalaxyCount
           
private  float myMinDensity
           
private  float myMinDiameter
           
private  int myMinGalaxyCount
           
static GameScale SMALL
           
private static GalaxyType[] SMALL_GALAXY_TYPES
           
static GameScale SMALL_GLIESE
           
static java.lang.String SMALL_GLIESE_KEY
           
static java.lang.String SMALL_KEY
           
 
Fields inherited from class org.gjt.universe.KeyedItem
 
Constructor Summary
private GameScale(java.lang.String key)
          This constructor is used to construct instances whose galaxy count, diameter, and possible galaxy type ranges are inherently defined and thus do not need to be passed explicitly.
private GameScale(java.lang.String key, int minGalaxyCount, int maxGalaxyCount, float minDiameter, float maxDiameter, float minDensity, float maxDensity, GalaxyType[] GalaxyTypes)
          This constructor is used to construct instances whose galaxy count, diameter, and possible galaxy type ranges need to be explicitly specified as arguments.
 
Method Summary
static GameScale FindByKey(java.lang.String aKey)
          This class method returns the game scale instance matching the given key, or null if there isn't one.
 GalaxyType[] getGalaxyTypes()
          This method returns the array of galaxy types that may be generated by this game scale.
 float getMaxDensity()
          This method returns the maximum density to be used in randomly generated galaxies.
 float getMaxDiameter()
          This method returns the maximum diameter to be used in randomly generated galaxies.
 int getMaxGalaxyCount()
          This method returns the maximum number of galaxies to be randomly generated by this game scale.
 float getMinDensity()
          This method returns the minimum density to be used in randomly generated galaxies.
 float getMinDiameter()
          This method returns the minimum diameter to be used in randomly generated galaxies.
 int getMinGalaxyCount()
          This method returns the minimum number of galaxies to be randomly generated by this game scale.
 void performLocalization()
          This method overrides that of our abstract base class to set the description and back story of the receiving GalaxyType object.
 void setDensityRange(float minValue, float maxValue)
          This method sets the range of system densities to be used in randomly generated galaxies at this game scale.
 void setDiameterRange(float minValue, float maxValue)
          This method sets the range of diameters which will be used for randomly generated galaxies at this game scale.
 void setGalaxyCountRange(int minValue, int maxValue)
          This method sets the range of the number of galaxies that should be randomly generated at this game scale.
 void setGalaxyTypes(GalaxyType[] newValue)
          This method sets the array of galaxy types that may be generated by this game scale.
 
Methods inherited from class org.gjt.universe.KeyedItem
FindByDescriptionAndSpace, FindByKeyAndSpace, getBackStory, getDescription, getKey, hashCode, setBackStory, setDescription, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myMinGalaxyCount

private int myMinGalaxyCount

myMaxGalaxyCount

private int myMaxGalaxyCount

myMinDiameter

private float myMinDiameter

myMaxDiameter

private float myMaxDiameter

myMinDensity

private float myMinDensity

myMaxDensity

private float myMaxDensity

myGalaxyTypes

private GalaxyType[] myGalaxyTypes

MIN_GALAXY_COUNT

private static int MIN_GALAXY_COUNT

MIN_DIAMETER

private static float MIN_DIAMETER

MIN_DENSITY

private static float MIN_DENSITY

SMALL_GALAXY_TYPES

private static final GalaxyType[] SMALL_GALAXY_TYPES

MEDIUM_GALAXY_TYPES

private static final GalaxyType[] MEDIUM_GALAXY_TYPES

LARGE_GALAXY_TYPES

private static final GalaxyType[] LARGE_GALAXY_TYPES

HUGE_GALAXY_TYPES

private static final GalaxyType[] HUGE_GALAXY_TYPES

GLIESE_GALAXY_TYPES

private static final GalaxyType[] GLIESE_GALAXY_TYPES

INTERGALACTIC_GALAXY_TYPES

private static final GalaxyType[] INTERGALACTIC_GALAXY_TYPES

SMALL_KEY

public static final java.lang.String SMALL_KEY
See Also:
Constant Field Values

MEDIUM_KEY

public static final java.lang.String MEDIUM_KEY
See Also:
Constant Field Values

LARGE_KEY

public static final java.lang.String LARGE_KEY
See Also:
Constant Field Values

HUGE_KEY

public static final java.lang.String HUGE_KEY
See Also:
Constant Field Values

INTERGALACTIC_KEY

public static final java.lang.String INTERGALACTIC_KEY
See Also:
Constant Field Values

SMALL_GLIESE_KEY

public static final java.lang.String SMALL_GLIESE_KEY
See Also:
Constant Field Values

MEDIUM_GLIESE_KEY

public static final java.lang.String MEDIUM_GLIESE_KEY
See Also:
Constant Field Values

LARGE_GLIESE_KEY

public static final java.lang.String LARGE_GLIESE_KEY
See Also:
Constant Field Values

HUGE_GLIESE_KEY

public static final java.lang.String HUGE_GLIESE_KEY
See Also:
Constant Field Values

CUSTOM_KEY

public static final java.lang.String CUSTOM_KEY
See Also:
Constant Field Values

SMALL

public static final GameScale SMALL

MEDIUM

public static final GameScale MEDIUM

LARGE

public static final GameScale LARGE

HUGE

public static final GameScale HUGE

INTERGALACTIC

public static final GameScale INTERGALACTIC

SMALL_GLIESE

public static final GameScale SMALL_GLIESE

MEDIUM_GLIESE

public static final GameScale MEDIUM_GLIESE

LARGE_GLIESE

public static final GameScale LARGE_GLIESE

HUGE_GLIESE

public static final GameScale HUGE_GLIESE

CUSTOM

public static final GameScale CUSTOM

ALL_SCALES

public static GameScale[] ALL_SCALES
Constructor Detail

GameScale

private GameScale(java.lang.String key)
This constructor is used to construct instances whose galaxy count, diameter, and possible galaxy type ranges are inherently defined and thus do not need to be passed explicitly. Regular game scales should use the five argument constructor below. This constructor is private since all instances should be created as class variables above (e.g. GameScale.GLIESE).

Parameters:
key - The localization invariant unique key word used to uniquely identify a particular game scale (this is what is written to the game options file).
See Also:
FindByKey( String aKey )

GameScale

private GameScale(java.lang.String key,
                  int minGalaxyCount,
                  int maxGalaxyCount,
                  float minDiameter,
                  float maxDiameter,
                  float minDensity,
                  float maxDensity,
                  GalaxyType[] GalaxyTypes)
This constructor is used to construct instances whose galaxy count, diameter, and possible galaxy type ranges need to be explicitly specified as arguments. This constructor is private since all instances should be created as class variables above (e.g. GameScale.HUGE).

Parameters:
key - The localization invariant unique key word used to uniquely identify a particular game scale (this is what is written to the game options file).
minGalaxyCount - The minimum number of galaxies which should be randomly generated. Values less than 1 will be treated as 1.
maxGalaxyCount - The maximum number of galaxies which should be randomly generated. Values less than 1 will be treated as 1.
minDiameter - The minimum diameter of randomly generated galaxies (in parsecs). Values less than 0.01 will be treated as 0.01.
maxDiameter - The maximum diameter of randomly generated galaxies (in parsecs). Values less than 0.01 will be treated as 0.01.
minDensity - The minimum density of randomly generated galaxies (in systems / cubic parsec). Values less than 0.001 will be treated as 0.001.
maxDensity - The maximum density of randomly generated galaxies (in systems / cubic parsec). Values less than 0.001 will be treated as 0.001.
GalaxyTypes - An array of key words identifying the possible types of galaxies which may be generated. Null values will be treated as allowing all random galaxy types.
See Also:
FindByKey( String aKey )
Method Detail

FindByKey

public static GameScale FindByKey(java.lang.String aKey)
This class method returns the game scale instance matching the given key, or null if there isn't one.

Parameters:
aKey - The key word identifying the desired instance.

setGalaxyCountRange

public void setGalaxyCountRange(int minValue,
                                int maxValue)
This method sets the range of the number of galaxies that should be randomly generated at this game scale. This method is used by our constructor. It is also declared public so that the values belonging to custom game scales can be externally adjusted. Argument values less than 1 will be treated as 1.

Parameters:
minValue - The minimum number of galaxies which should be randomly generated.
maxValue - The maximum number of galaxies which should be randomly generated.

getMinGalaxyCount

public int getMinGalaxyCount()
This method returns the minimum number of galaxies to be randomly generated by this game scale.

See Also:
setGalaxyCountRange( int low, int high ), getMaxGalaxyCount()

getMaxGalaxyCount

public int getMaxGalaxyCount()
This method returns the maximum number of galaxies to be randomly generated by this game scale.

See Also:
setGalaxyCountRange( int low, int high ), getMinGalaxyCount()

setDiameterRange

public void setDiameterRange(float minValue,
                             float maxValue)
This method sets the range of diameters which will be used for randomly generated galaxies at this game scale. This method is used by our constructor. It is also declared public so that the values belonging to custom game scales can be externally adjusted. Argument values less than 0.01 will be treated as 0.01.

Parameters:
minValue - The minimum diameter of randomly generated galaxies (in parsecs).
maxValue - The maximum diameter of randomly generated galaxies (in parsecs).

getMinDiameter

public float getMinDiameter()
This method returns the minimum diameter to be used in randomly generated galaxies.

See Also:
setDiameterRange( float low, float high ), getMaxDiameter()

getMaxDiameter

public float getMaxDiameter()
This method returns the maximum diameter to be used in randomly generated galaxies.

See Also:
setDiameterRange( float low, float high ), getMinDiameter()

setDensityRange

public void setDensityRange(float minValue,
                            float maxValue)
This method sets the range of system densities to be used in randomly generated galaxies at this game scale. This method is used by our constructor. It is also declared public so that the values belonging to custom game scales can be externally adjusted. Values less than 0.001 will be treated as 0.001.

Parameters:
minValue - The minimum density of randomly generated galaxies (in systems / cubic parsec).
maxValue - The maximum density of randomly generated galaxies (in systems / cubic parsec).

getMinDensity

public float getMinDensity()
This method returns the minimum density to be used in randomly generated galaxies.

See Also:
setDensityRange( float low, float high ), getMaxDensity()

getMaxDensity

public float getMaxDensity()
This method returns the maximum density to be used in randomly generated galaxies.

See Also:
setDensityRange( float low, float high ), getMinDensity()

setGalaxyTypes

public void setGalaxyTypes(GalaxyType[] newValue)
This method sets the array of galaxy types that may be generated by this game scale. This method is used by our constructor. It is also declared public so that the set belonging to custom game scales can be externally adjusted.

Parameters:
newValue - An array of galaxy type objects.
See Also:
getGalaxyTypes()

getGalaxyTypes

public GalaxyType[] getGalaxyTypes()
This method returns the array of galaxy types that may be generated by this game scale.

See Also:
setGalaxyTypes( GalaxyType[] newValue )

performLocalization

public void performLocalization()
This method overrides that of our abstract base class to set the description and back story of the receiving GalaxyType object. This method will be called automatically when either our getDescription or getBackStory methods are called.

Overrides:
performLocalization in class KeyedItem
See Also:
KeyedItem.getDescription(), KeyedItem.getBackStory()


Copyright © 2001 Universe Dev Team All Rights Reserved.