Custom Asteroids  0.2.0
A mod for Kerbal Space Program that lets users control where asteroids appear
 All Classes Namespaces Files Functions Properties Pages
Population Class Reference

Represents a set of asteroids with similar orbits. More...

Public Member Functions

override string ToString ()
 Returns a string that represents the current object. More...
 

Package Functions

 Population ()
 Creates a dummy population. More...
 
Orbit drawOrbit ()
 Generates a random orbit consistent with the population properties. More...
 
double getSpawnRate ()
 Returns the rate at which asteroids are discovered in the population. More...
 

Detailed Description

Represents a set of asteroids with similar orbits.

Warning
Population objects are typically initialized using an external traversal, rather than a constructor. Therefore, traditional validity guarantees cannot be enforced. Instead, the Population class makes heavier than usual use of defensive programming.
Note
To avoid breaking the persistence code, Population may not have subclasses

Constructor & Destructor Documentation

Population ( )
package

Creates a dummy population.

Postcondition
The object is initialized to a state in which it will not be expected to generate orbits. Any orbits that are generated will be located inside the Sun, causing the game to immediately delete the object with the orbit.
Exception Safety
Does not throw exceptions.
Note
Required by interface of ConfigNode.LoadObjectFromConfig()

Member Function Documentation

Orbit drawOrbit ( )
package

Generates a random orbit consistent with the population properties.

Returns
The orbit of a randomly selected member of the population
Exceptions
System.InvalidOperationExceptionThrown if population's parameter values cannot produce valid orbits.
Exception Safety
The program is in a consistent state in the event of an exception
Todo:
Break up this function
double getSpawnRate ( )
package

Returns the rate at which asteroids are discovered in the population.

Returns
The rate relative to the rates of all other populations.
Exception Safety
Does not throw exceptions.
override string ToString ( )

Returns a string that represents the current object.

See Also
Object.ToString()

The documentation for this class was generated from the following file: