Class providing methods of parsing the XML simulation protocol file. More...
Public Member Functions | |
XMLParser (Element localRoot) | |
Create an XML parser for a given XML local grouping. More... | |
XMLParser (String fileName) | |
XMLParser (String activePath, String protocolFile) | |
Used to parse an XML file before a simulation log file is generated, when the simulation is being initialised. More... | |
void | openXMLDocument (String fileName, boolean testDTD) |
Creates a DOM document for an XML protocol file of a given name. More... | |
void | openXMLDocument (String activePath, String protocolFile, boolean testDTD) |
Used to open an XML file in simulation initialisation - where the log file has yet to be created. More... | |
LinkedList< Element > | buildSetMarkUp (String childMarkup) |
Returns a linked list of all XML elements of a given tag name. More... | |
LinkedList< XMLParser > | buildSetParser (String childMarkup) |
Returns a list of XML parsers from combining nodes in the protocol file. Used for boundary conditions. More... | |
XMLParser | getChild (String childName) |
Returns the child node for a given XML tag name. More... | |
String | getParam (String paramName) |
Searches the child nodes of a given tag for a particular parameter name. Returns the assigned string value if present. More... | |
Element | getParamMarkUp (String paramName) |
Searches the child nodes of a given tag for a particular parameter name. Returns the XML element for that tag if present. More... | |
String | getParam (String paramName, StringBuffer unit) |
Searches the child nodes of a given tag for a particular parameter name and a specified unit. Returns the String value of that tag if present. More... | |
double | getParamDbl (String paramName) |
Returns the double value assigned to an XML tag in the protocol file. More... | |
double | getParamDbl (String paramName, StringBuffer unit) |
For a given XML tag name, returns the value in the specified unit (if that tag exists) More... | |
int | getParamInt (String paramName) |
For a given XML tag name, returns the value it is assigned (if that tag exists) More... | |
int | getParamInt (String paramName, StringBuffer unit) |
For a given XML tag name, and a given unit of measurement, returns the value the tag is assigned (if that tag exists) More... | |
double | getParamLength (String paramName) |
Returns a length parameter from the XML, converting to the correct unit as required. More... | |
double | getParamMass (String paramName) |
Returns the mass of a specified parameter from the XML, calculating this using the unit of measurement for that parameter. More... | |
double | getParamTime (String paramName) |
Gets a given parameter from the protocol file and converts into a double representing time. More... | |
double | getParamConc (String paramName) |
Reads a concentration from the protocol file and converts this to the required unit. More... | |
DiscreteVector | getParamXYZ (String paramName) |
Converts coordinates specified in the protocol file into a discrete vector. More... | |
Boolean | getParamBool (String paramName) |
Read in boolean value of specified parameter from the XML file. More... | |
Boolean | getParamBool (String paramName, StringBuffer unit) |
Read in boolean value and unit of measurement of a specified parameter from the XML file. More... | |
String | getParamSuch (String paramName, String detailName) |
Searches through the attributes of the XML tags of a given parameter name to find the String value of a specified detail within that tag. More... | |
String | getParamSuch (String paramName, String detailName, StringBuffer unit) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the String value of a specified detail within that tag. More... | |
double | getParamSuchDbl (String paramName, String detailName) |
Searches through the attributes of the XML tags of a given parameter name to find the Double value of a specified detail within that tag. More... | |
Boolean | getParamSuchBool (String paramName, String detailName) |
Searches through the attributes of the XML tags of a given parameter name to find the boolean value of a specified detail within that tag. More... | |
double | getParamSuchDbl (String paramName, String detailName, StringBuffer unit) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the Double value of a specified detail within that tag. More... | |
Boolean | getParamSuchBool (String paramName, String detailName, StringBuffer unit) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the boolean value of a specified detail within that tag. More... | |
Element | getChildSuchAttribute (String childName, String attrName, String attrValue) |
Returns the XML element matching the specified tag name, attribute name, and attribute value. If not find return the local root. More... | |
String | getAttributeStr (String attributeName) |
Return the string value of an attribute of the current localroot of the XML file. More... | |
double | getAttributeDbl (String attributeName) |
Return the double value of an attribute of the current localroot of the XML file. More... | |
String | getChildAttrStr (String childName, String attrName) |
Return the string value of a child attribute of the current localroot of the XML file. More... | |
double | getChildAttrDbl (String childName, String attrName) |
Returns the value assigned to an attribute within a child node. More... | |
List< Element > | getChildren (String childName) |
Returns a list of the children of a given XML child tag name. More... | |
Element | getChildElement (String childName) |
Returns the XML element of a given child node tag name. More... | |
String | getAttribute (String attributeName) |
Return the value assigned to a given XML tag. More... | |
Element | getElement () |
Return the current XML local root element. More... | |
Object | instanceCreator (String prefix) |
Creates an instance of a class using a string containing that class name. More... | |
double | getDblAttrOfChildSuchAttribute (String childName, String attrName, String attrValue, String attr2Name) |
Used for Epi-Bac scenarios - retrieving list of environments to which this species is sensitive to and the correspondent probability of dying if under the influence of that environment. More... | |
Class providing methods of parsing the XML simulation protocol file.
In iDynoMiCS, protocol files are used to create the conditions under which a simulation is run. This is specified in XML. During initialisation, the simulation will require access to tags within this file. This class provides a means of accessing the data in these tags
utils.XMLParser.XMLParser | ( | Element | localRoot | ) |
Create an XML parser for a given XML local grouping.
Create an XML parser for a given XML local grouping
localRoot | An element that is the root of a group of XML tags |
utils.XMLParser.XMLParser | ( | String | fileName | ) |
Create an XML parser object for an XML file of a given name
fileName | The name of the XML file to be processed |
utils.XMLParser.XMLParser | ( | String | activePath, |
String | protocolFile | ||
) |
Used to parse an XML file before a simulation log file is generated, when the simulation is being initialised.
There are some checks the simulation needs to do on initialisation (with the protocol file). This is before the simulation log is generated. These errors get stored in a separate log file
activePath | The path to the protocol file to open |
protocolFile | The protocol file to read in |
LinkedList<Element> utils.XMLParser.buildSetMarkUp | ( | String | childMarkup | ) |
Returns a linked list of all XML elements of a given tag name.
Returns a linked list of all XML elements within that protocol file that have a given tag name
childMarkup | The tag name of the elements to put in the list |
LinkedList<XMLParser> utils.XMLParser.buildSetParser | ( | String | childMarkup | ) |
Returns a list of XML parsers from combining nodes in the protocol file. Used for boundary conditions.
Returns a list of XML parsers from combining nodes in the protocol file. Used for boundary conditions
childMarkup | The XML tag for which many nodes may exist. boundaryCondition is a good example |
String utils.XMLParser.getAttribute | ( | String | attributeName | ) |
Return the value assigned to a given XML tag.
Returns the value assigned to a given XML tag in a protocol file
attributeName | The XML tag for which the associated value is needed |
double utils.XMLParser.getAttributeDbl | ( | String | attributeName | ) |
Return the double value of an attribute of the current localroot of the XML file.
Return the double value of an attribute of the current localroot of the XML file
attributeName | The attribute name for which the value is being sought |
String utils.XMLParser.getAttributeStr | ( | String | attributeName | ) |
Return the string value of an attribute of the current localroot of the XML file.
Return the string value of an attribute of the current localroot of the XML file
attributeName | The attribute name for which the value is being sought |
XMLParser utils.XMLParser.getChild | ( | String | childName | ) |
Returns the child node for a given XML tag name.
Returns the child node for a given XML tag name
childName | The XML tag name to return |
double utils.XMLParser.getChildAttrDbl | ( | String | childName, |
String | attrName | ||
) |
Returns the value assigned to an attribute within a child node.
Returns the value assigned to an attribute within a child node. Checking computation domain dimension is one example of its use
childName | The name of the child node of which the attribute value is being sought |
attrName | The name of the attribute for which the value is required |
String utils.XMLParser.getChildAttrStr | ( | String | childName, |
String | attrName | ||
) |
Return the string value of a child attribute of the current localroot of the XML file.
Return the string value of a child attribute of the current localroot of the XML file
childName | Name of the XML child tag |
attrName | The attribute of that tag for which the value is being sought |
Element utils.XMLParser.getChildElement | ( | String | childName | ) |
Returns the XML element of a given child node tag name.
Returns the XML element of a given child node tag name
childName | The child tag name for which the XML element is required |
List<Element> utils.XMLParser.getChildren | ( | String | childName | ) |
Returns a list of the children of a given XML child tag name.
Returns a list of the children of a given XML child tag name
childName | The name of a child tag in the XML file for which the list of children is required |
Element utils.XMLParser.getChildSuchAttribute | ( | String | childName, |
String | attrName, | ||
String | attrValue | ||
) |
Returns the XML element matching the specified tag name, attribute name, and attribute value. If not find return the local root.
Returns the XML element matching the specified tag name, attribute name, and attribute value. If not find return the local root
childName | The XML tag required |
attrName | The name of the attribute within that tag |
attrValue | The value of the attribute within that tag |
double utils.XMLParser.getDblAttrOfChildSuchAttribute | ( | String | childName, |
String | attrName, | ||
String | attrValue, | ||
String | attr2Name | ||
) |
Used for Epi-Bac scenarios - retrieving list of environments to which this species is sensitive to and the correspondent probability of dying if under the influence of that environment.
Used for Epi-Bac scenarios - retrieving list of environments to which this species is sensitive to and the correspondent probability of dying if under the influence of that environment
childName | The name of the XML tag that contains the information on this parameter |
attrName | The name of the first attribute within that XML tag |
attrValue | The value of the first attribute |
attr2Name | The name of the related attribute that is required to find this value |
Element utils.XMLParser.getElement | ( | ) |
Return the current XML local root element.
Return the current XML local root element
String utils.XMLParser.getParam | ( | String | paramName | ) |
Searches the child nodes of a given tag for a particular parameter name. Returns the assigned string value if present.
Searches the child nodes of a given tag for a particular parameter name. Returns the assigned string value if present
paramName | The name of the parameter for which a String value is being sought |
String utils.XMLParser.getParam | ( | String | paramName, |
StringBuffer | unit | ||
) |
Searches the child nodes of a given tag for a particular parameter name and a specified unit. Returns the String value of that tag if present.
Searches the child nodes of a given tag for a particular parameter name and a specified unit. Returns the String value of that tag if present
paramName | The name of the parameter for which a String value is being sought |
unit | The unit that this parameter should be |
Boolean utils.XMLParser.getParamBool | ( | String | paramName | ) |
Read in boolean value of specified parameter from the XML file.
Reads in boolean value of specified parameter from the XML file
paramName | The parameter to be retrieved from the XML file |
Boolean utils.XMLParser.getParamBool | ( | String | paramName, |
StringBuffer | unit | ||
) |
Read in boolean value and unit of measurement of a specified parameter from the XML file.
Read in boolean value and unit of measurement of a specified parameter from the XML file
paramName | The parameter to be retrieved from the XML file |
unit | The unit of measurement specified for this parameter |
double utils.XMLParser.getParamConc | ( | String | paramName | ) |
Reads a concentration from the protocol file and converts this to the required unit.
Reads a concentration from the protocol file and converts this to the required unit
paramName | The concentration of the parameter to be retrieved from the protocol file |
double utils.XMLParser.getParamDbl | ( | String | paramName | ) |
Returns the double value assigned to an XML tag in the protocol file.
Returns the double value assigned to an XML tag in the protocol file, if the tag is present
paramName | The XML parameter for which the value is required |
double utils.XMLParser.getParamDbl | ( | String | paramName, |
StringBuffer | unit | ||
) |
For a given XML tag name, returns the value in the specified unit (if that tag exists)
For a given XML tag name, returns the value in the specified unit (if that tag exists)
paramName | The name of the XML tag for which a value is required |
unit | The unit that this parameter is required to be within |
int utils.XMLParser.getParamInt | ( | String | paramName | ) |
For a given XML tag name, returns the value it is assigned (if that tag exists)
For a given XML tag name, returns the value it is assigned (if that tag exists)
paramName | The name of the XML tag for which a value is required |
int utils.XMLParser.getParamInt | ( | String | paramName, |
StringBuffer | unit | ||
) |
For a given XML tag name, and a given unit of measurement, returns the value the tag is assigned (if that tag exists)
For a given XML tag name, and a given unit of measurement, returns the value the tag is assigned (if that tag exists)
paramName | The name of the XML tag for which a value is required |
unit | The unif of measurement specified for this parameter |
double utils.XMLParser.getParamLength | ( | String | paramName | ) |
Returns a length parameter from the XML, converting to the correct unit as required.
Returns a length parameter from the XML, converting to the correct unit as required
paramName | The name of the parameter for which the length value should be returned |
Element utils.XMLParser.getParamMarkUp | ( | String | paramName | ) |
Searches the child nodes of a given tag for a particular parameter name. Returns the XML element for that tag if present.
Searches the child nodes of a given tag for a particular parameter name. Returns the XML element for that tag if present
paramName | The name of the parameter for which a String value is being sought |
double utils.XMLParser.getParamMass | ( | String | paramName | ) |
Returns the mass of a specified parameter from the XML, calculating this using the unit of measurement for that parameter.
Returns the mass of a specified parameter from the XML, calculating this using the unit of measurement for that parameter
paramName | The name of the parameter for which the mass should be returned |
String utils.XMLParser.getParamSuch | ( | String | paramName, |
String | detailName | ||
) |
Searches through the attributes of the XML tags of a given parameter name to find the String value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
String utils.XMLParser.getParamSuch | ( | String | paramName, |
String | detailName, | ||
StringBuffer | unit | ||
) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the String value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
unit | The unit that this parameter should be measured in |
Boolean utils.XMLParser.getParamSuchBool | ( | String | paramName, |
String | detailName | ||
) |
Searches through the attributes of the XML tags of a given parameter name to find the boolean value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the boolean value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
Boolean utils.XMLParser.getParamSuchBool | ( | String | paramName, |
String | detailName, | ||
StringBuffer | unit | ||
) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the boolean value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the boolean value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
unit | The unit that this parameter should be measured in |
double utils.XMLParser.getParamSuchDbl | ( | String | paramName, |
String | detailName | ||
) |
Searches through the attributes of the XML tags of a given parameter name to find the Double value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the Double value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
double utils.XMLParser.getParamSuchDbl | ( | String | paramName, |
String | detailName, | ||
StringBuffer | unit | ||
) |
Searches through the attributes of the XML tags of a given parameter name, in a specified unit to find the Double value of a specified detail within that tag.
Searches through the attributes of the XML tags of a given parameter name to find the Double value of a specified detail within that tag
paramName | The parameter name for which the value is required |
detailName | The name of the detail element which is part of that tag, if present |
unit | The unit that this parameter should be measured in |
double utils.XMLParser.getParamTime | ( | String | paramName | ) |
Gets a given parameter from the protocol file and converts into a double representing time.
Gets a given parameter from the protocol file and converts into a double representing time
paramName | The parameter to be retrieved from the XML file |
DiscreteVector utils.XMLParser.getParamXYZ | ( | String | paramName | ) |
Converts coordinates specified in the protocol file into a discrete vector.
Converts coordinates specified in the protocol file into a discrete vector. Used for boundary conditions and specifications of birth area of agents
paramName | The protocol file parameter specified as X,Y,and Z coordinated |
Object utils.XMLParser.instanceCreator | ( | String | prefix | ) |
Creates an instance of a class using a string containing that class name.
Creates an instance of a class using a string containing that class name. Useful for a set of boundary conditions, for example
prefix | The class for which a new instance is being created |
void utils.XMLParser.openXMLDocument | ( | String | fileName, |
boolean | testDTD | ||
) |
Creates a DOM document for an XML protocol file of a given name.
Creates a DOM document for an XML protocol file of a given name
fileName | The name of the XML protocol file being processed |
testDTD | Boolean stating whether or not schema validation should be applied on reading the XML file |
void utils.XMLParser.openXMLDocument | ( | String | activePath, |
String | protocolFile, | ||
boolean | testDTD | ||
) |
Used to open an XML file in simulation initialisation - where the log file has yet to be created.
Used to open an XML file in simulation initialisation - where the log file has yet to be created. This is the case as the simulation log file location is specified in the protocol file. If that can't be read then there is a problem
activePath | String of path to protocol file being processed |
protocolFile | The protocol file to be read |
testDTD | Boolean stating whether or not schema validation should be applied on reading the XML file |