Next / Previous / Contents / Shipman's homepage

8.4. BaseStationSet.readLine(): Read one station line

The .readLine() method is, however, an abstract method, to be supplied by a derived class that knows the format of the line.

baseclasses.py
# - - -   B a s e S t a t i o n S e t . r e a d L i n e  - -

    def readLine(self, scan):
        '''Process one line from the stations file.

          [ scan is a Scan object ->
              if the line in scan is not a valid station line ->
                scan  :=  scan advanced not beyond end of line
                raise IOError
              else if the line in scan contains a location code
              not in self.locCodeMap ->
                scan  :=  scan advanced to end of line
                self.locCodeMap  +:=  a new entry whose key is
                    that location code, uppercase, and whose
                    value is a new Location containing the
                    station from that line
              else if the line in scan contains a location code
              that is in self.locCodeMap ->
                scan  :=  scan advanced to end of line
                corresponding value  +:=  the station from
                    that line ]
        '''
        raise NotImplementedError

When writing a concrete method to replace this one, you'll probably want to look at Section 8.5, “BaseStationSet.addStation(): Add a new station”.