Next / Previous / Contents / Shipman's homepage

74.12. BaseEncounter.dispatchMap: Encounter record routing dictionary

This class attribute is a dictionary that relates the various encounter codes to the methods that process each type of encounter line. The method that uses this dictionary is Section 74.6, “BaseEncounter.scanLine(): Scan a raw encounter record”.

Each method in this table must conform to this generic intended function:
    # Generic intended function for all encounter-line parsers:
    #   [ scan is a Scan object ->
    #       if (self.captureCode) + (line in scan) is a valid
    #       encounter line in the context of self.compiler ->
    #         scan  :=  scan advanced to the end of the line
    #         self  :=  self with all fields from that line added
    #                   using names in self.OUT_FIELD_LIST
    #       else ->
    #         Log()  +:=  error messages
    #         scan   :=   scan advanced no further than end of line
    #         raise SyntaxError ]

For the various methods for each encounter type, see:
    # Methods for processing each encounter code
    dispatchMap = {
      CAPTURE_DESTROYED:  scanShort,
      CAPTURE_LOST:       scanShort,
      CAPTURE_UNBANDED:   scanUnbanded,
      CAPTURE_NEW_BAND:   scanNewBand,
      CAPTURE_LONG_NEW:   scanLongNew,
      CAPTURE_CHANGED:    scanRecap,
      CAPTURE_ADDED:      scanRecap,
      CAPTURE_RESIGHT:    scanRecap,
      CAPTURE_RECAP:      scanRecap }

The resight code (CAPTURE_RESIGHT) is allowed only in MAWS data. Assuming that it never occurs on the originals (and does not occur as a typo), there is no reason to check it. However, implementing it here, instead of in Maws2007Encounter, will save effort if the MAPS program ever starts using resighted records.