Class faction

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

public class faction extends XMLbase
Process a <faction> XML element into an object.

Factions represent the political groupings within a game. A faction has a species identified as its 'specification' (although this does mean a faction can only contain one species)

Factions can own things (such as stars and ships). Owning a star means you own the orbiting planets, the ships orbiting that planet, the factories on the planet.

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

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • DEFAULTSPEC

      private static String DEFAULTSPEC
    • spec

      Required element in XML <spec key="S"></specification>.

      The species this faction is made from. This field contains a String reference to the specification, not it's actual EntityId so we need to do a lookup via getEntityReference()

      If this isn't specified then it is defaulted to "U" - unclassified.

      See Also:
      speciesSpec
    • money

      @XStreamConverter(SingleValueMoneyConverter.class) private org.jscience.physics.amount.Amount<org.jscience.economics.money.Money> money
      The wealth of this faction.

      It is always an exact value, no decimals.

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

      private List<String> ownedstars
      Optional XML with multiple <star>...</star> elements.

      List of the names of the stars owned by this faction. The value is the unique name ('key') - so we need to convert it into a reference to a real entity later

    • ownedships

      private List<String> ownedships
      Optional XML with multiple <ship>...</ship> elements.

      List of the names of the ships owned by this faction. The value is the unique name ('key') - so we need to convert it into a reference to a real entity later

  • Constructor Details

    • faction

      public faction()
  • Method Details

    • getOwnedstars

      public List<String> getOwnedstars()
      An unmodifiable list of owned stars' name (not an actual entity)
      Returns:
    • getOwnedships

      public List<String> getOwnedships()
      An unmodifiable list of owned ships' name (not an actual entity)
      Returns:
    • getSpec

      public reference getSpec()
      Description copied from class: XMLbase
      Derived classes override if they really do want to return a spec reference.
      Overrides:
      getSpec in class XMLbase
      Returns:
    • getMoney

      public org.jscience.physics.amount.Amount<org.jscience.economics.money.Money> getMoney()
      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: