Next / Previous / Contents / Shipman's homepage

32. class BandNoField: Band number field

An instance of this class represents one band number. For the format of this field, see the specification.

baseclasses.py
# - - - - -   c l a s s   B a n d N o F i e l d   - - - - -

class BandNoField(FieldItem):
    '''Represents a band number.

      Exports:
        BandNoField(encounter, s):
          [ s is a string of 9 characters ->
              return a BandNoField object with band number s ]
        .encounter:  [ as passed to constructor, read-only ]
        .s:          [ as passed to constructor, read-only ]
        .prefix():   [ return the prefix part of self ]
        .suffix():   [ return the suffix part of self ]
        .incrementPrefix():
          [ return the prefix part of self, with 1 added,
            allowing for rollover ]
        BandNoField.scanField():  [ as in class FieldItem ]
        BandNoField.flatten():    [ as in class FieldItem ]
        BandNoField.attachSuffix(encounter, prefix, suffix):  # Static
          [ (prefix is a band prefix) and (suffix is a band suffix) ->
              return a new BandNoField object representing the
              concatenation of those strings, allowing for
              rollover in the 00 case ]
    '''

32.1. BandNoField.prefix(): Extract band number prefix

Returns the prefix portion of self's band number.

baseclasses.py
# - - -   B a n d N o F i e l d . p r e f i x   - - -

    def prefix(self):
        '''Return self's prefix portion.
        '''
        return  self.s[:L_BAND_NO_PREFIX]