See the discussion of
the band prefix line in the specification for the
logic to be used to form a full band number when the last two
digits are zero. It is not all that simple! We effectively
add 100 to the band number in that case. However, there are
two more wrinkles. We propagate the carry, but not all the
way to the top of the band number—just through the
“odometer portion,” the low-order five digits.
Also, a question mark (?) may occur anywhere in
the odometer portion, and we stop propagating the carry there
also.
# - - - B a n d N o F i e l d . a t t a c h S u f f i x - - -
@staticmethod
def attachSuffix(encounter, prefix, suffix):
'''Join band number prefix+suffix with rollover
[ (prefix is a seven-character band number prefix) and
(suffix is a two-character band number suffix) ->
return a new BandNoField object representing those two
strings joined, with 100 added if the suffix is '00' ]
'''
First we naively concatenate the two strings, and make
them into a BandNoField object.
#-- 1 --
bandNoField = BandNoField(encounter, prefix + suffix)
Then we test for the rollover case. If the suffix is
'00', we call a method in the BandNoField object that knows how to add 100 and
correctly propagate the carry.
#-- 2 -
# [ if suffix is '00' ->
# bandNoField := bandNoField with 100 added to it
# else -> I ]
if suffix == '00':
bandNoField = BandNoField(encounter,
bandNoField.incrementPrefix() + suffix)
#-- 3 --
return bandNoField