Class faction
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static org.slf4j.Loggerprivate org.jscience.physics.amount.Amount<org.jscience.economics.money.Money>The wealth of this faction.Optional XML with multiple<ship>...</ship>elements.Optional XML with multiple<star>...</star>elements.private referenceRequired element in XML<spec key="S"></specification>. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDerived classes have to override this and say what class eg engine.class they are.org.jscience.physics.amount.Amount<org.jscience.economics.money.Money>getMoney()An unmodifiable list of owned ships' name (not an actual entity)An unmodifiable list of owned stars' name (not an actual entity)getSpec()Derived classes override if they really do want to return a spec reference.protected ObjectCalled automatically when loading from XML as part of JDK serialisation.Methods inherited from class name.moore.kevin.ze.XMLdata.XMLbase
defaultXMLmessage, duplicatedXMLmessage, getDescription, getKey, missingXMLmessage
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DEFAULTSPEC
-
spec
@ZodiacEntityReference @XStreamConverter(AttributedValueReferenceConverter.class) private reference specRequired 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> moneyThe wealth of this faction.It is always an exact value, no decimals.
Optional element in XML<money>. Defaults to zero if not provided. -
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
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
An unmodifiable list of owned stars' name (not an actual entity)- Returns:
-
getOwnedships
An unmodifiable list of owned ships' name (not an actual entity)- Returns:
-
getSpec
Description copied from class:XMLbaseDerived classes override if they really do want to return a spec reference. -
getMoney
public org.jscience.physics.amount.Amount<org.jscience.economics.money.Money> getMoney()- Returns:
-
readResolve
Description copied from class:XMLbaseCalled 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:
readResolvein classXMLbase- Returns:
- null if we can't create a valid object
-
getEntityClass
Description copied from class:XMLbaseDerived 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:
getEntityClassin classXMLbase- Returns:
-