Package net.sf.colossus.xmlparser
Class CreatureLoader
- java.lang.Object
-
- net.sf.colossus.xmlparser.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,CreatureType>byNameprivate java.util.SortedSet<CreatureType>creaturesprivate static java.lang.StringcurrentVersionprivate static java.util.logging.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description CreatureLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfillCreatureLoader(java.io.InputStream creIS, java.util.List<java.lang.String> varDirectoriesList)private booleangetAttributeBoolean(org.jdom.Element el, java.lang.String name)Lookup attribute of name name in Element el, and return its value as boolean.CreatureTypegetCreatureTypeByName(java.lang.String name)Convert a name into the actual CreatureTypejava.util.SortedSet<CreatureType>getCreatureTypes()Retrieve all the CreatureType in the game.java.util.List<CreatureType>getCreatureTypesAsList()Retrieve all the CreatureType in the game.private voidhandleCreature(org.jdom.Element el, java.util.List<java.lang.String> varDirectoriesList)
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
currentVersion
private static final java.lang.String currentVersion
- See Also:
- Constant Field Values
-
creatures
private final java.util.SortedSet<CreatureType> creatures
-
byName
private final java.util.Map<java.lang.String,CreatureType> byName
-
-
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.JDOMExceptionLookup 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.JDOMExceptionObjectCreationException
-
getCreatureTypesAsList
public java.util.List<CreatureType> getCreatureTypesAsList()
Description copied from interface:AllCreatureTypeRetrieve all the CreatureType in the game. They are sorted by name.- Specified by:
getCreatureTypesAsListin interfaceAllCreatureType- Returns:
- The immutable list of all CreatureType in the Variant.
-
getCreatureTypes
public java.util.SortedSet<CreatureType> getCreatureTypes()
Description copied from interface:AllCreatureTypeRetrieve all the CreatureType in the game. The set is sorted by the natural order of CreatureType- Specified by:
getCreatureTypesin interfaceAllCreatureType- Returns:
- The immutable SortedSet of all CreatureType in the Variant.
-
getCreatureTypeByName
public CreatureType getCreatureTypeByName(java.lang.String name)
Description copied from interface:AllCreatureTypeConvert a name into the actual CreatureType- Specified by:
getCreatureTypeByNamein interfaceAllCreatureType- Parameters:
name- The name of the CreatureType- Returns:
- The CreatureType of name name.
-
-