1.1 --- a/EventAggregatorSupport.py Tue Apr 12 00:01:28 2011 +0200
1.2 +++ b/EventAggregatorSupport.py Wed Apr 13 00:31:45 2011 +0200
1.3 @@ -16,6 +16,7 @@
1.4 import time
1.5 import re
1.6 import bisect
1.7 +import operator
1.8
1.9 try:
1.10 set
1.11 @@ -1818,6 +1819,30 @@
1.12 else:
1.13 return self.__add__(Reference(-other.degrees, other.minutes, other.seconds))
1.14
1.15 + def _compare(self, op, other):
1.16 + if not isinstance(other, Reference):
1.17 + return NotImplemented
1.18 + else:
1.19 + return op(self.to_degrees(), other.to_degrees())
1.20 +
1.21 + def __eq__(self, other):
1.22 + return self._compare(operator.eq, other)
1.23 +
1.24 + def __ne__(self, other):
1.25 + return self._compare(operator.ne, other)
1.26 +
1.27 + def __lt__(self, other):
1.28 + return self._compare(operator.lt, other)
1.29 +
1.30 + def __le__(self, other):
1.31 + return self._compare(operator.le, other)
1.32 +
1.33 + def __gt__(self, other):
1.34 + return self._compare(operator.gt, other)
1.35 +
1.36 + def __ge__(self, other):
1.37 + return self._compare(operator.ge, other)
1.38 +
1.39 def to_degrees(self):
1.40 return sign(self.degrees) * (abs(self.degrees) + self.minutes / 60.0 + self.seconds / 3600.0)
1.41