ReasonCode
class Reason: """A class that handles the reason for an event."""
def __init__(self, aName): """Construct the instance given the name of the aName."""
self.__aName = aName return
def getName(self): """Returns the name"""
return self.__aName
def __cmp__(self, other): """Compare the lhs instance with the rhs instance."""
if issubclass(self.__class__, AnyReason) or issubclass(other.__class__, AnyReason): return 0 elif issubclass(self.__class__, NoReason) or issubclass(other.__class__, NoReason): return -1 else: return cmp(self.__class__, other.__class__)
class AnyReason(Reason): """Match on all of the reasons."""
def __init__(self): """Construct the instance."""
Reason.__init__(self, "AnyReason") return
class NoReason(Reason): """Match on none of the reasons."""
def __init__(self): """Construct the instance."""
Reason.__init__(self, "NoReason") return