Class XMLParser

java.lang.Object
  |
  +--XMLParser

public class XMLParser
extends java.lang.Object


Constructor Summary
XMLParser(JESSCommunicator jessCommunicator)
           
 
Method Summary
protected  double convertPriorityToDouble(java.lang.String prior)
          The priority should be a value between 0 and 1.
protected  double convertProbabilityToDouble(java.lang.String prob)
           
protected  java.lang.String getAttributeValue(org.w3c.dom.Node element, java.lang.String attributeName)
          A helper method that returns the value of the attribute with the given name, or null if no such an attribute could be found.
 java.util.HashMap getSituations()
          Gets all situations that have been found in the xml file.
protected  java.util.Vector parseActions(org.w3c.dom.Node actionsNode)
           
protected  java.util.Vector parseConstraints(org.w3c.dom.Node constraintsNode, Situation situation)
           
protected  java.util.Vector parseNextSituations(org.w3c.dom.Node nextSituationsNode, Situation situation)
           
protected  void parseSituations()
          Iterates over all situation elements, gets the name of the situations from the attribute list.
 boolean parseXMLFile(java.io.File xmlFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLParser

public XMLParser(JESSCommunicator jessCommunicator)
Method Detail

getSituations

public java.util.HashMap getSituations()
Gets all situations that have been found in the xml file.


parseXMLFile

public boolean parseXMLFile(java.io.File xmlFile)

parseSituations

protected void parseSituations()
Iterates over all situation elements, gets the name of the situations from the attribute list. Then the constraints for the situation are retrieved from the xml file and parsed to Constraint classes. Those are put in a vector and the vector is put in the situation which is then put in the hashmap as an element with the situation name as the key.


getAttributeValue

protected java.lang.String getAttributeValue(org.w3c.dom.Node element,
                                             java.lang.String attributeName)
A helper method that returns the value of the attribute with the given name, or null if no such an attribute could be found.


parseNextSituations

protected java.util.Vector parseNextSituations(org.w3c.dom.Node nextSituationsNode,
                                               Situation situation)

parseConstraints

protected java.util.Vector parseConstraints(org.w3c.dom.Node constraintsNode,
                                            Situation situation)

parseActions

protected java.util.Vector parseActions(org.w3c.dom.Node actionsNode)

convertProbabilityToDouble

protected double convertProbabilityToDouble(java.lang.String prob)

convertPriorityToDouble

protected double convertPriorityToDouble(java.lang.String prior)
The priority should be a value between 0 and 1. There are elements though that have multiple priority values for example 0 | 1. In this case for now the first of those possible values is chosen as the priority value.