|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
world.WorldFileParser
A parser for world files.
Field Summary | |
private int |
airportID
An ID of the current airport. |
private java.lang.String |
airportName
A name of the airport. |
private int |
arrivalTime
An arrival time for the station assigned to the connection. |
private int |
busStopID
An ID of the current bus stop. |
private java.lang.String |
busStopName
A name of the bus stop. |
private java.util.ArrayList |
cities
A list of all parsed cities. |
private java.lang.String |
cityName
A name of a city. |
private java.util.ArrayList |
connectionArrivalTimes
A list of arrival times for the current connection. |
private java.util.ArrayList |
connectionDepartureTimes
A list of departure times for the current connection. |
private int |
connectionMeanOfTransportation
A mean of transportation for the connection. |
private java.lang.String |
connectionName
A name of the connection. |
private java.util.ArrayList |
connections
A list of all parsed connections. |
private java.util.ArrayList |
connectionStations
A list of stations assigned to the current connection. |
private java.lang.String |
continentName
The continentName name in the location. |
private char |
dayOfWeekFlag
A day of the week flag for the connection. |
private int |
departureTime
A departure time for the station assigned to the connection. |
private boolean |
fInAirport
Indicates whether the parser is inside an `airport' tag. |
private boolean |
fInAirports
Indicates whether the parser is inside an `airports' tag. |
private boolean |
fInArrivalTimes
Indicates whether the parser is inside a `arrival times' tag. |
private boolean |
fInBusStop
Indicates whether the parser is inside a `bus stop' tag. |
private boolean |
fInBusStops
Indicates whether the parser is inside a `bus stops' tag. |
private boolean |
fInCities
Indicates whether the parser is inside a `cities' tag. |
private boolean |
fInCity
Indicates whether the parser is inside a `city' tag. |
private boolean |
fInConnection
Indicates whether the parser is inside a `connection' tag. |
private boolean |
fInConnections
Indicates whether the parser is inside a `connections' tag. |
private boolean |
fInDaysOfWeek
Indicates whether the parser is inside a `days of week' tag. |
private boolean |
fInDepartureTimes
Indicates whether the parser is inside a `departure times' tag. |
private boolean |
fInHarbour
Indicates whether the parser is inside a `harbour' tag. |
private boolean |
fInHarbours
Indicates whether the parser is inside a `harbours' tag. |
private boolean |
fInLocation
Indicates whether the parser is inside a `location' tag. |
private boolean |
fInStationIDs
Indicates whether the parser is inside a `stations ids' tag. |
private boolean |
fInTrainStation
Indicates whether the parser is inside a `train station' tag. |
private boolean |
fInTrainStations
Indicates whether the parser is inside a `train stations' tag. |
private boolean |
fInWorld
Indicates whether the parser is inside a `world' tag. |
private int |
harbourID
An ID of the current harbour. |
private java.lang.String |
harbourName
A name of the harbour. |
private java.util.HashMap |
idToStationMap
A maping from tha station ID to the station. |
private java.lang.String |
islandName
The the island name in the location. |
private org.xml.sax.Locator |
locator
The SAX locator. |
private int |
stationID
An ID of the station assigned to the connection. |
private java.util.ArrayList |
stations
A list of all parsed stations. |
private int |
trainStationID
An ID of the current train station. |
private java.lang.String |
trainStationName
A name of the train station. |
private java.util.ArrayList |
usedConnectionNames
A list of used connection names. |
private java.util.ArrayList |
usedIDs
A list of used IDs for the stations. |
private int |
x
The x coordinate of the location. |
private int |
y
The y coordinate of the location. |
Constructor Summary | |
WorldFileParser()
Constructor. |
Method Summary | |
private void |
ChangeWorld()
Changes the world to the parsed one. |
private void |
ClearData()
Clears all the internal data, so the parser is ready to parse a new file. |
private void |
ClearLocation()
Clears the data of the connection. |
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)
|
private Location |
GetLocation()
Gets the location built basing on the parsed data. |
private boolean |
IsLocationParsed()
Indicates whether the location tag has been parsed completely. |
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)
|
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 |
private boolean fInWorld
private boolean fInCities
private boolean fInCity
private boolean fInLocation
private boolean fInAirports
private boolean fInAirport
private boolean fInBusStops
private boolean fInBusStop
private boolean fInTrainStations
private boolean fInTrainStation
private boolean fInHarbours
private boolean fInHarbour
private boolean fInConnections
private boolean fInConnection
private boolean fInStationIDs
private boolean fInArrivalTimes
private boolean fInDepartureTimes
private boolean fInDaysOfWeek
private java.lang.String cityName
private java.lang.String airportName
private int airportID
private java.lang.String busStopName
private int busStopID
private java.lang.String trainStationName
private int trainStationID
private java.lang.String harbourName
private int harbourID
private java.lang.String connectionName
private int connectionMeanOfTransportation
private java.util.ArrayList usedIDs
private java.util.ArrayList usedConnectionNames
private int stationID
private java.util.HashMap idToStationMap
private java.util.ArrayList stations
private int arrivalTime
private int departureTime
private char dayOfWeekFlag
private int x
private int y
private java.lang.String continentName
private java.lang.String islandName
private java.util.ArrayList cities
private java.util.ArrayList connectionStations
private java.util.ArrayList connectionArrivalTimes
private java.util.ArrayList connectionDepartureTimes
private java.util.ArrayList connections
private org.xml.sax.Locator locator
Constructor Detail |
public WorldFileParser()
Method Detail |
public void Parse(java.lang.String fileName) throws java.lang.Exception, java.io.IOException, org.xml.sax.SAXException
fileName
- The name of the file to be parsed.
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.private void ClearData()
private static javax.xml.parsers.SAXParser CreateSAXParser() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
- If it was imposible to create a parser satisfing the current configuration.
org.xml.sax.SAXException
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
org.xml.sax.SAXException
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(java.lang.String uriNamespace, java.lang.String qualifiedName, java.lang.String simpleName) throws org.xml.sax.SAXParseException
org.xml.sax.SAXParseException
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void setDocumentLocator(org.xml.sax.Locator locator)
ContentHandler.setDocumentLocator(org.xml.sax.Locator)
private void ChangeWorld() throws java.lang.Exception
java.lang.Exception
- Thrown in case of data error.private boolean IsLocationParsed()
private Location GetLocation()
private void ClearLocation()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |