repast.simphony.parameter
Class ParametersValuesLoader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.xml.sax.ext.DefaultHandler2
          extended by repast.simphony.parameter.ParametersValuesLoader
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler

public class ParametersValuesLoader
extends DefaultHandler2

Parser for loading stored parameter values into a Parameters object. This assumes that the schema is appropriate for the loaded values. The format consists of a name value pair where the value is a string representation of parameter value. For example,

 
                                
 
 

Version:
$Revision$ $Date$
Author:
Nick Collier

Field Summary
static Map<String,Class> typeMap
           
 
Constructor Summary
ParametersValuesLoader(File file)
           
ParametersValuesLoader(String str)
           
 
Method Summary
 void endDocument()
           
 void loadValues(Parameters params)
          Loads the stored values into the specified Parameters.
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 
Methods inherited from class org.xml.sax.ext.DefaultHandler2
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeMap

public static Map<String,Class> typeMap
Constructor Detail

ParametersValuesLoader

public ParametersValuesLoader(File file)
                       throws IOException,
                              SAXException,
                              ParserConfigurationException
Throws:
IOException
SAXException
ParserConfigurationException

ParametersValuesLoader

public ParametersValuesLoader(String str)
                       throws IOException,
                              SAXException,
                              ParserConfigurationException
Throws:
IOException
SAXException
ParserConfigurationException
Method Detail

loadValues

public void loadValues(Parameters params)
                throws ParameterFormatException
Loads the stored values into the specified Parameters. This assumes that the Parameters' schema is appropriate for the loaded parameter values.

Parameters:
params - the Parameters to load the stored values into
Throws:
ParameterFormatException - if there is an error loading the parameters

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException