Next / Previous / Contents / Shipman's homepage

13.5. BaseSpeciesSet.readLine()

This virtual method breaks out the fields of a species line and adds them to the internal structures of self. The generic intended function is given here, but we use the standard Python convention for a virtual function, raising NotImplementedError.

The concrete class will probably want to call Section 13.6, “BaseSpeciesSet.addSpecies(): Add a new species line” to add the fields to the internal tables.

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

    def readLine(self, scan):
        '''Virtual method for the concrete line-reading method.

          [ scan is a Scan object ->
              if the line in scan is not a valid species code line ->
                scan  :=  scan located somewhere in the same line
                Log()  +:=  error message(s)
                raise IOError
              else ->
                self.spec4Map  +:=  an entry mapping the uppercased
                    4-letter species code from that line |-> a
                    Species object representing that line
                self.spec6Map  +:=  an entry mapping the uppercased
                    6-letter species code from that line |-> a
                    Species object representing that line
                self.engMap  +:=  an entry mapping the English name
                    from that line |-> a Species object
                    representing that line ]
        '''
        raise NotImplementedError

A line that has a 4-letter or 6-letter code already used in self is not considered valid.