Class baseEF

java.lang.Object
name.moore.kevin.ze.entities.baseEF
Direct Known Subclasses:
engineEF, engineEF, engineSpecEF, engineSpecEF, factionEF, hullEF, hullEF, hullSpecEF, hullSpecEF, industryEF, industryEF, industrySpecEF, industrySpecEF, planetEF, planetEF, planetSpecEF, planetSpecEF, shieldEF, shieldEF, shieldSpecEF, shieldSpecEF, shipEF, shipEF, shipEF, shipSpecEF, shipSpecEF, shipSpecEF, shipyardEF, shipyardEF, shipyardSpecEF, shipyardSpecEF, speciesSpecEF, starEF, starEF, starSpecEF, starSpecEF, weaponEF, weaponEF, weaponSpecEF, weaponSpecEF

public abstract class baseEF extends Object
Factories produce entities in the entity repository. All the specialised factories inherit from here to provide some common functions.

By default most methods are NOP, the specialised factories override to create their functionality.

There is no direct reference to the entityrepository. Any actions on the entities are done by the verbs.

Author:
Kevin Moore <dev@kevin.moore.name>
See Also:
name.moore.kevin.ze.game.verbs
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Map<Class,​Double>
    Derived factories should add values to these Maps for use in calculations.
    static Map<Class,​Double>
     
    static Map<Class,​Double>
     
    static hasher
     
    private static org.slf4j.Logger
     
    private com.simsilica.es.EntityId
    The database entity this processor is going to process.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Provide a list of components created by this processor when creating an entity.
    protected com.simsilica.es.EntityId
     
    protected com.simsilica.es.EntityId
    findbyName​(reference name, Class clazz)
     
    protected Set<com.simsilica.es.EntityId>
    findEntities​(com.simsilica.es.ComponentFilter cf, Class[] clazzes)
     
    <T extends XMLbase>
    com.simsilica.es.EntityId
    Create a new entity appropriate to the factory.
    <T extends XMLbase>
    com.simsilica.es.EntityId
    fromXML​(T cast)
    Convert from parsed XML into an entity complete with appropriate components.
    com.simsilica.es.EntityComponent
    getComponent​(com.simsilica.es.EntityId eid, Class clazz)
     
    com.simsilica.es.EntityId
     
    makeSerial​(Class item)
    Make a unique serial-number String in the format engine.XJ4ONH2F.
    setTarget​(com.simsilica.es.EntityId eid)
    Set the specific entityId in the entity database that this processor will process.
    <T extends XMLbase>
    List<com.simsilica.es.EntityComponent>
    Used by factories to produce hardcoded test fixtures - so we dont need to specify any specs.
    <T extends XMLbase>
    List<com.simsilica.es.EntityComponent>
    toComponents​(com.simsilica.es.EntityId seid)
    Provide the components of an entity based on a specification.
    protected <T extends XMLbase>
    List<com.simsilica.es.EntityComponent>
    toComponents​(T cast)
    Use the parsed XML object to create the components of an entity.

    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
    • hasher

      public static final hasher hasher
    • ABSORB_SCALER

      public static Map<Class,​Double> ABSORB_SCALER
      Derived factories should add values to these Maps for use in calculations. These are used to scale energy damage and absorb calculation to reasonable values. fragile values are used to determine how relatively damageable a component is.
      See Also:
      fire
    • DAMAGE_SCALER

      public static Map<Class,​Double> DAMAGE_SCALER
    • FRAGILE_SCALER

      public static Map<Class,​Double> FRAGILE_SCALER
    • target

      private com.simsilica.es.EntityId target
      The database entity this processor is going to process.
  • Constructor Details

    • baseEF

      public baseEF()
  • Method Details

    • makeSerial

      public String makeSerial(Class item)
      Make a unique serial-number String in the format engine.XJ4ONH2F.
      Parameters:
      item -
      Returns:
    • setTarget

      public baseEF setTarget(com.simsilica.es.EntityId eid)
      Set the specific entityId in the entity database that this processor will process.
      Parameters:
      eid -
      Returns:
    • getTarget

      public com.simsilica.es.EntityId getTarget()
    • diagnostic

      public List<Class> diagnostic()
      Provide a list of components created by this processor when creating an entity.
      Returns:
    • toComponents

      protected <T extends XMLbase> List<com.simsilica.es.EntityComponent> toComponents(T cast)
      Use the parsed XML object to create the components of an entity.
      Type Parameters:
      T -
      Parameters:
      cast -
      Returns:
    • toComponents

      public <T extends XMLbase> List<com.simsilica.es.EntityComponent> toComponents(com.simsilica.es.EntityId seid)
      Provide the components of an entity based on a specification. Component values will be defaulted. Public because the construct verb uses it.
      Type Parameters:
      T -
      Parameters:
      seid - entityid of the specification to base the components on.
      Returns:
      See Also:
      construct.build(com.simsilica.es.EntityId)
    • toComponents

      public <T extends XMLbase> List<com.simsilica.es.EntityComponent> toComponents()
      Used by factories to produce hardcoded test fixtures - so we dont need to specify any specs.
      Type Parameters:
      T -
      Returns:
    • fromXML

      public <T extends XMLbase> com.simsilica.es.EntityId fromXML(T cast)
      Convert from parsed XML into an entity complete with appropriate components.

      The required components are provided by the specialised processor (which is calling this method!).

      Type Parameters:
      T -
      Parameters:
      cast -
      Returns:
      EntityId of newly created and populated entity.
    • from

      public <T extends XMLbase> com.simsilica.es.EntityId from()
      Create a new entity appropriate to the factory.
      Type Parameters:
      T -
      Returns:
    • findbyName

      protected com.simsilica.es.EntityId findbyName(reference name)
      Parameters:
      name -
      Returns:
    • findbyName

      protected com.simsilica.es.EntityId findbyName(reference name, Class clazz)
    • getComponent

      public com.simsilica.es.EntityComponent getComponent(com.simsilica.es.EntityId eid, Class clazz)
    • findEntities

      protected Set<com.simsilica.es.EntityId> findEntities(com.simsilica.es.ComponentFilter cf, Class[] clazzes)