com.isti.trinetwatch.station
Class StationInfoParser

java.lang.Object
  extended by com.isti.util.CfgFileParser
      extended by com.isti.trinetwatch.station.StationInfoParser

public class StationInfoParser
extends CfgFileParser

Class StationInfoParser reads data from an input stream into a table of station objects.


Field Summary
static java.lang.String GROUP_TAG_STR
           
static java.lang.String HELP_TAG_STR
           
static java.lang.String LONGNAME_TAG_STR
           
static java.lang.String RULESET_TAG_STR
           
 
Fields inherited from class com.isti.util.CfgFileParser
CLOSE_BRACKET_CHAR, commaSepFlag, errorMessage, inTokens, OPEN_BRACKET_CHAR, wordSlashFlag
 
Constructor Summary
StationInfoParser(java.io.Reader rdr, RuleSetTable rSetTable)
          Creates parser object which reads from the given stream.
 
Method Summary
 GroupTable getGroupsTable()
          Returns the handle to the GroupTable of station groups.
 GroupTable getNetworksTable()
          Returns the handle to the GroupTable of station networks.
 StationTable getStationsTable()
          Returns a handle to the table of stations.
 Station parseStationInfo(Station stationObj, java.lang.String leftString, java.lang.String rightString, boolean allowChangeFlag, LogFile logFileObj)
          Parses information for a station and uses it with the given station and rule-set.
 boolean parseStream(LogFile logFileObj)
          Parses the given input stream as a station information file.
 boolean parseStream(LogFile logFileObj, UsageLevelTag defaultUsageLevel)
          Parses the given input stream as a station information file.
 boolean updateTables(Station stationObj, LogFile logFileObj)
          Update the tables for the station.
 
Methods inherited from class com.isti.util.CfgFileParser
getErrorMessage, parseEqualsNumber, parseEqualsString, resetInput, setDupFieldMsg, setIllegalCharMsg, setNoCloseBracketMsg, setNoOpenBracketMsg, setUnexpectedEOFMsg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LONGNAME_TAG_STR

public static final java.lang.String LONGNAME_TAG_STR
See Also:
Constant Field Values

RULESET_TAG_STR

public static final java.lang.String RULESET_TAG_STR
See Also:
Constant Field Values

HELP_TAG_STR

public static final java.lang.String HELP_TAG_STR
See Also:
Constant Field Values

GROUP_TAG_STR

public static final java.lang.String GROUP_TAG_STR
See Also:
Constant Field Values
Constructor Detail

StationInfoParser

public StationInfoParser(java.io.Reader rdr,
                         RuleSetTable rSetTable)
Creates parser object which reads from the given stream.

Parameters:
rdr - stream reader object to read from.
rSetTable - RuleSetTable object from which to fetch rule-sets.
Method Detail

getGroupsTable

public GroupTable getGroupsTable()
Returns the handle to the GroupTable of station groups.

Returns:
the handle to the GroupTable of station groups.

getNetworksTable

public GroupTable getNetworksTable()
Returns the handle to the GroupTable of station networks.

Returns:
the handle to the GroupTable of station networks.

getStationsTable

public StationTable getStationsTable()
Returns a handle to the table of stations.

Returns:
a handle to the table of stations.

parseStream

public boolean parseStream(LogFile logFileObj)
Parses the given input stream as a station information file.

Parameters:
logFileObj - log file object to use for debug messages. If null then no log file output is generated.
Returns:
true if successful, false if parameter or syntax error detected (retrieve error message with 'getErrorMessage()').

parseStream

public boolean parseStream(LogFile logFileObj,
                           UsageLevelTag defaultUsageLevel)
Parses the given input stream as a station information file.

Parameters:
logFileObj - log file object to use for debug messages. If null then no log file output is generated.
defaultUsageLevel - the default usage level or null if none.
Returns:
true if successful, false if parameter or syntax error detected (retrieve error message with 'getErrorMessage()').

parseStationInfo

public Station parseStationInfo(Station stationObj,
                                java.lang.String leftString,
                                java.lang.String rightString,
                                boolean allowChangeFlag,
                                LogFile logFileObj)
Parses information for a station and uses it with the given station and rule-set. After information for a station has been updated the tables should also be updated via the 'updateTables()' method.

Parameters:
stationObj - the station.
leftString - the left string.
rightString - the right string.
allowChangeFlag - true to allow change, false to flag duplicate error.
logFileObj - log file object to use for debug messages. If null then no log file output is generated.
Returns:
the station or null if error.

updateTables

public boolean updateTables(Station stationObj,
                            LogFile logFileObj)
Update the tables for the station.

Parameters:
stationObj - the station.
logFileObj - log file object to use for debug messages. If null then no log file output is generated.
Returns:
true if successful, false otherwise.