Class hullSpec

java.lang.Object
name.moore.kevin.ze.XMLdata.XMLbase
name.moore.kevin.ze.XMLdata.specs.hullSpec

public class hullSpec extends XMLbase
The read-only properties of a particular type ship hull as represented in XML.

Hulls provide space for other ship equipment to be added. All ships start with a hull. Hulls provide the ability to move - powering that movement comes from the engine. Depending on how the hull is equipped we can define different functions to a ship.

XML data is parsed by XStream into the appropriate data object.

So for instance the XML <planet> element is processed by the planet class to create a planet data object with properties set from the XML. These properties are fixed and thus have no public setter methods since there is no in-game reason to change them or create them.

Once loaded, the data object can be converted into a usable entity with components via by creating the appropriate entity factory eg a planetEF and using the baseEF.fromXML(name.moore.kevin.ze.XMLdata.XMLbase) with the XML data object as a the parameter. Once transferred into the entity-component database, the data object can be discarded.

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

    Fields
    Modifier and Type
    Field
    Description
    private Integer
    Number of bays this hull provides.
    private Integer
    Required element in XML <daystobuild>.
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
    This amount of energy needs to be delivered to the hull to enable FTL, upto this amount allows sub-light movement (at commensurate velocity).
    private static org.slf4j.Logger
     
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Mass>
    For reference the mass of a Nimitz-class aircraft carrier is ~ 102,000 metric tonnes.
    private org.jscience.physics.amount.Amount<org.jscience.economics.money.Money>
    Optional element in XML <money>.

    Fields inherited from class name.moore.kevin.ze.XMLdata.XMLbase

    key
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
     
    Derived classes have to override this and say what class eg engine.class they are.
    org.jscience.physics.amount.Amount<javax.measure.quantity.Mass>
     
    org.jscience.physics.amount.Amount<org.jscience.economics.money.Money>
     
    protected Object
    Called automatically when loading from XML as part of JDK serialisation.

    Methods inherited from class name.moore.kevin.ze.XMLdata.XMLbase

    defaultXMLmessage, duplicatedXMLmessage, getDescription, getKey, getSpec, missingXMLmessage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • money

      @XStreamConverter(SingleValueMoneyConverter.class) private org.jscience.physics.amount.Amount<org.jscience.economics.money.Money> money
      Optional element in XML <money>. Defaults to zero if not provided.
    • daystobuild

      private Integer daystobuild
      Required element in XML <daystobuild>.
    • energy

      @XStreamConverter(SingleValueEnergyConverter.class) private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> energy
      This amount of energy needs to be delivered to the hull to enable FTL, upto this amount allows sub-light movement (at commensurate velocity). Required XML element <energy>0 GJ</energy>
    • mass

      @XStreamConverter(SingleValueMassConverter.class) private org.jscience.physics.amount.Amount<javax.measure.quantity.Mass> mass
      For reference the mass of a Nimitz-class aircraft carrier is ~ 102,000 metric tonnes. Required XML <mass>100000 t</mass>
    • bays

      private Integer bays
      Number of bays this hull provides. Equipment is installed into bays, one item per bay. Required. <bays>3</bays>
  • Constructor Details

    • hullSpec

      public hullSpec()
  • Method Details

    • getMoney

      public org.jscience.physics.amount.Amount<org.jscience.economics.money.Money> getMoney()
      Returns:
    • getDaystobuild

      public Integer getDaystobuild()
      Returns:
    • getEnergy

      public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> getEnergy()
      Returns:
    • getMass

      public org.jscience.physics.amount.Amount<javax.measure.quantity.Mass> getMass()
      Returns:
    • getBays

      public Integer getBays()
      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: