Class CreatureLoader

  • All Implemented Interfaces:
    AllCreatureType

    public class CreatureLoader
    extends java.lang.Object
    implements AllCreatureType
    CreatureLoader loads the creature descriptions.
    Version:
    $Id: CreatureLoader.java 4053 2009-04-21 12:40:24Z dolbeau $
    Author:
    Romain Dolbeau
    See Also:
    CreatureType
    • Constructor Summary

      Constructors 
      Constructor Description
      CreatureLoader()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void fillCreatureLoader​(java.io.InputStream creIS, java.util.List<java.lang.String> varDirectoriesList)  
      private boolean getAttributeBoolean​(org.jdom.Element el, java.lang.String name)
      Lookup attribute of name name in Element el, and return its value as boolean.
      CreatureType getCreatureTypeByName​(java.lang.String name)
      Convert a name into the actual CreatureType
      java.util.SortedSet<CreatureType> getCreatureTypes()
      Retrieve all the CreatureType in the game.
      java.util.List<CreatureType> getCreatureTypesAsList()
      Retrieve all the CreatureType in the game.
      private void handleCreature​(org.jdom.Element el, java.util.List<java.lang.String> varDirectoriesList)  
      • Methods inherited from class java.lang.Object

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

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • creatures

        private final java.util.SortedSet<CreatureType> creatures
      • byName

        private final java.util.Map<java.lang.String,​CreatureType> byName
    • Constructor Detail

      • CreatureLoader

        public CreatureLoader()
    • Method Detail

      • fillCreatureLoader

        public void fillCreatureLoader​(java.io.InputStream creIS,
                                       java.util.List<java.lang.String> varDirectoriesList)
      • getAttributeBoolean

        private boolean getAttributeBoolean​(org.jdom.Element el,
                                            java.lang.String name)
                                     throws org.jdom.JDOMException
        Lookup attribute of name name in Element el, and return its value as boolean. Assume lack of attribute means false.
        Parameters:
        el - The element with the attribute (or not)
        name - The name of the attribute
        Returns:
        The boolean value of the attribute, defaulting to false if absent
        Throws:
        org.jdom.JDOMException
      • handleCreature

        private void handleCreature​(org.jdom.Element el,
                                    java.util.List<java.lang.String> varDirectoriesList)
                             throws org.jdom.JDOMException,
                                    ObjectCreationException
        Throws:
        org.jdom.JDOMException
        ObjectCreationException
      • getCreatureTypesAsList

        public java.util.List<CreatureType> getCreatureTypesAsList()
        Description copied from interface: AllCreatureType
        Retrieve all the CreatureType in the game. They are sorted by name.
        Specified by:
        getCreatureTypesAsList in interface AllCreatureType
        Returns:
        The immutable list of all CreatureType in the Variant.
      • getCreatureTypes

        public java.util.SortedSet<CreatureType> getCreatureTypes()
        Description copied from interface: AllCreatureType
        Retrieve all the CreatureType in the game. The set is sorted by the natural order of CreatureType
        Specified by:
        getCreatureTypes in interface AllCreatureType
        Returns:
        The immutable SortedSet of all CreatureType in the Variant.
      • getCreatureTypeByName

        public CreatureType getCreatureTypeByName​(java.lang.String name)
        Description copied from interface: AllCreatureType
        Convert a name into the actual CreatureType
        Specified by:
        getCreatureTypeByName in interface AllCreatureType
        Parameters:
        name - The name of the CreatureType
        Returns:
        The CreatureType of name name.