def __init__(self, itemType, left, right): super().__init__(RangeType(itemType)) # can't just use T extends Comparable<T> because LocalDate and LocalTime extend Comparable<R> if left < right: self.low = left self.high = right else: self.low = right self.high = left
def __init__(self, itemType, left, right): from prompto.type.RangeType import RangeType super(RangeValue, self).__init__(RangeType(itemType)) # can't just use T extends Comparable<T> because LocalDate and LocalTime extend Comparable<R> cmp_ = self.compare(left, right) if cmp_ < 0: self.low = left self.high = right else: self.low = right self.high = left
def checkRange(self, context, other): if isinstance(other, CharacterType): from prompto.type.RangeType import RangeType return RangeType(self) return super(CharacterType, self).checkRange(context, other)
def checkRange(self, context, other): if isinstance(other, DateType): return RangeType(self) else: return super(DateType, self).checkRange(context, other)
def checkRange(self, context, other): if isinstance(other, IntegerType): return RangeType(self) return super().checkRange(context, other)