Class weaponSpec

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

public class weaponSpec extends XMLbase
The read-only blueprint (eg "W01") for a particular type of weapon. These properties are fixed and thus have no setter methods since there is no in-game reason to change them or create them. Objects are initialised by loading XML via XStream.
Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Integer
    The base number of days to construct this weapon.
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
    The amount of energy that the weapon requires to have accumulated before it can fire.
    private static org.slf4j.Logger
     
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Mass>
    Mass of the component in kilogrammes.
    private org.jscience.physics.amount.Amount<org.jscience.economics.money.Money>
    The base cost of constructing this item.

    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
      The base cost of constructing this item.

      This may be modified by factors considered in the construction logic. It is always an exact value, no decimals.

      Optional element in XML <money>. Defaults to zero if not provided.
    • daystobuild

      private Integer daystobuild
      The base number of days to construct this weapon.

      This value may be modified by things such as a damaged factory.

      Required element in XML <daystobuild>. Defaults to 1
    • mass

      @XStreamConverter(SingleValueMassConverter.class) private org.jscience.physics.amount.Amount<javax.measure.quantity.Mass> mass
      Mass of the component in kilogrammes. Required XML <mass>100000 t</mass>
    • energy

      @XStreamConverter(SingleValueEnergyConverter.class) private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> energy
      The amount of energy that the weapon requires to have accumulated before it can fire.

      This is one of the factors in deciding how much damage the weapon inflicts.

      Required XML element <energy>10 GJ></energy>
  • Constructor Details

    • weaponSpec

      public weaponSpec()
  • Method Details

    • getMoney

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

      public Integer getDaystobuild()
      Returns:
    • getMass

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

      public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> getEnergy()
      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: