crn
Class OtherSettingsFileHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycrn.OtherSettingsFileHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public final class OtherSettingsFileHandler
extends org.xml.sax.helpers.DefaultHandler

A class used to parse an XML file containing settings used by the comparison functions.

Author:
Piotrek

Field Summary
private  boolean fInOtherSettings
          Indicates whether the parser is inside the `OtherSettings' tag.
private  org.xml.sax.Locator locator
          The SAX locator.
 int maxSimilarChangesCountsDifference
          Max similar changes counts difference.
 int maxSimilarDepartureHoursOfDayDifference
          Max similar departure hours of day difference.
 double maxSimilarLocationsDistance
          Max similar locations distance.
 int maxSimilarRanksDifference
          Max similar ranks difference.
 int maxSimilarTotalDurationsDifference
          Max similar total durations difference.
 
Constructor Summary
OtherSettingsFileHandler()
          Constructor.
 
Method Summary
private static javax.xml.parsers.SAXParser CreateSAXParser()
          Creates an instance of the SAXParser.
 void endElement(java.lang.String uriNamespace, java.lang.String qualifiedName, java.lang.String simpleName)
           
static void LoadFromFile(java.lang.String fileName)
          Loads the `other settings' from the given file.
 void Parse(java.lang.String fileName)
          Parses the given file.
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void startElement(java.lang.String uriNamespace, java.lang.String simpleName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
           
static void StoreToFile(java.lang.String fileName)
          Stores the `other settings' to the given file.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, 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

fInOtherSettings

private boolean fInOtherSettings
Indicates whether the parser is inside the `OtherSettings' tag.


maxSimilarChangesCountsDifference

public int maxSimilarChangesCountsDifference
Max similar changes counts difference.


maxSimilarDepartureHoursOfDayDifference

public int maxSimilarDepartureHoursOfDayDifference
Max similar departure hours of day difference.


maxSimilarLocationsDistance

public double maxSimilarLocationsDistance
Max similar locations distance.


maxSimilarRanksDifference

public int maxSimilarRanksDifference
Max similar ranks difference.


maxSimilarTotalDurationsDifference

public int maxSimilarTotalDurationsDifference
Max similar total durations difference.


locator

private org.xml.sax.Locator locator
The SAX locator.

Constructor Detail

OtherSettingsFileHandler

public OtherSettingsFileHandler()
Constructor.

Method Detail

StoreToFile

public static void StoreToFile(java.lang.String fileName)
                        throws java.io.IOException
Stores the `other settings' to the given file.

Parameters:
fileName - The name of file to store the `other seetings' to.
Throws:
java.io.IOException - Thrown in case of IO problems.

LoadFromFile

public static void LoadFromFile(java.lang.String fileName)
Loads the `other settings' from the given file.

Parameters:
fileName - The name of file to load the data from.

Parse

public void Parse(java.lang.String fileName)
           throws java.lang.Exception,
                  java.io.IOException,
                  org.xml.sax.SAXException
Parses the given file.

Parameters:
fileName - The name of the file to be parsed.
Throws:
java.lang.Exception - Thrown in case of error.
java.io.IOException - In case of any IO error.
org.xml.sax.SAXException - In case of some parsing error.

CreateSAXParser

private static javax.xml.parsers.SAXParser CreateSAXParser()
                                                    throws javax.xml.parsers.ParserConfigurationException,
                                                           org.xml.sax.SAXException
Creates an instance of the SAXParser.

Returns:
The requested parser.
Throws:
javax.xml.parsers.ParserConfigurationException - If it was imposible to create a parser satisfing the current configuration.
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uriNamespace,
                         java.lang.String simpleName,
                         java.lang.String qualifiedName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(java.lang.String uriNamespace,
                       java.lang.String qualifiedName,
                       java.lang.String simpleName)
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)