Class starmap

java.lang.Object
name.moore.kevin.ze.XMLdata.XMLbase
name.moore.kevin.ze.XMLdata.starmap

public class starmap extends XMLbase
A starmap contains the unchanging geographical positions in space of the planets (and other such?) stellar features.

It is contained in a distinct XML file from the gamefile file so we can reuse the same starmap in different games. Parsing is done through XStream. The map is a list of stars, planets with their coordinates and types.

Once loaded the lists of stars and planets will need converting into a collection of entities with their components. There is an assumption that this geographic information will be loaded early in preparing a gamefile but after specifications have been loaded. This is so that when a planet is loaded in the starmap, its associated planetSpec has already been loaded.

Ownership of such planets is not recorded here - that's in the gamefile savefile

Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • stars

      private List<star> stars
      Required element to specify each star.
    • planets

      private List<planet> planets
      Required element to specify each planet and what it's orbiting.
  • Constructor Details

    • starmap

      public starmap()
  • Method Details

    • getStars

      public List<star> getStars()
      Returns:
    • getPlanets

      public List<planet> getPlanets()
      Returns:
    • readResolve

      protected Object readResolve()
      Description copied from class: XMLbase
      Called automatically when loading from XML as part of JDK serialisation.

      Used to do some validation of that incoming XML by asserting that properties are set and have defaults as required. Output warning messages if a default is applied. Output error messages if a required XML element is missing and return null to indicate an invalid object.

      Overrides:
      readResolve in class XMLbase
      Returns:
      null if we can't create a valid object
    • getEntityClass

      public Class getEntityClass()
      Description copied from class: XMLbase
      Derived classes have to override this and say what class eg engine.class they are. This allows us to use this base class but discover the derived class.
      Specified by:
      getEntityClass in class XMLbase
      Returns: