10from .observersubject_numberproducer
import IObserverNumberChanged, INumberProducer
23 def __init__(self, numberProducer : INumberProducer) ->
None:
24 if not numberProducer:
25 raise ValueError(
"The ObserverForDecimal constructor requires a valid INumberProducer object.")
40 print(
" Decimal : {0}".format(number))
57 def __init__(self, numberProducer : INumberProducer) ->
None:
58 if not numberProducer:
59 raise ValueError(
"The ObserverForHexaDecimal constructor requires a valid INumberProducer object.")
74 print(
" Hexadecimal: {0:#08X}".format(number))
91 def __init__(self, numberProducer : INumberProducer) ->
None:
92 if not numberProducer:
93 raise ValueError(
"The ObserverForBinary constructor requires a valid INumberProducer object.")
108 print(
" Binary : {0:#032b}".format(number))
Represents an observer that prints out the current number from the Subject in binary.
_numberProducer
The number producer from which to get the current number.
None __init__(self, INumberProducer numberProducer)
Constructor.
None NumberChanged(self)
Called whenever the number is changed in the number producer.
Represents an observer that prints out the current number from the Subject in decimal.
_numberProducer
The number producer from which to get the current number.
None __init__(self, INumberProducer numberProducer)
Constructor.
None NumberChanged(self)
Called whenever the number is changed in the number producer.
Represents an observer that prints out the current number from the Subject in hexadecimal.
_numberProducer
The number producer from which to get the current number.
None __init__(self, INumberProducer numberProducer)
Constructor.
None NumberChanged(self)
Called whenever the number is changed in the number producer.
Represents an observer to the Subject class.