def get(self): # Transform 'cursor' into a number set result = NumberSet() K = len(self.__cursor) if K == 0: return None k = 0 end = 0 while k < K - 1: begin = end + self.__cursor[k] end = begin + self.__cursor[k + 1] if end > self.N: self.__cursor.pop() K -= 1 break if begin != end: result.quick_append_interval(Interval(begin, end)) k += 2 # Increment cursor k = 0 while k < K: if k == 0: self.__cursor[k] += 2 if self.__cursor[k] < 8: break else: self.__cursor[k] += 1 if self.__cursor[k] < 3: break self.__cursor[k] = 1 k += 1 return result
def get(self): # Transform 'cursor' into a number set result = NumberSet() K = len(self.__cursor) if K == 0: return None k = 0 end = 0 while k < K - 1: begin = end + self.__cursor[k] end = begin + self.__cursor[k+1] if end > self.N: self.__cursor.pop() K -= 1 break if begin != end: result.quick_append_interval(Interval(begin, end)) k += 2 # Increment cursor k = 0 while k < K: if k == 0: self.__cursor[k] += 2 if self.__cursor[k] < 8: break else: self.__cursor[k] += 1 if self.__cursor[k] < 3: break self.__cursor[k] = 1 k += 1 return result
def load_Composition_Exclusion(self): # Column 0 contains what is interesting ... table = parse_table("CompositionExclusions.txt", NumberColumnList=[0]) number_set = NumberSet() for row in table: begin = row[0] number_set.quick_append_interval(Interval(begin, begin + 1)) number_set.clean() self.db["CE"].code_point_db = number_set
def load_Composition_Exclusion(self): # Column 0 contains what is interesting ... table = parse_table("CompositionExclusions.txt", NumberColumnList=[0]) number_set = NumberSet() for row in table: begin = row[0] number_set.quick_append_interval(Interval(begin, begin + 1)) number_set.clean() self.db["CE"].code_point_db = number_set
def verify(A, TrafoInfo): result = NumberSet() for interval in A.get_intervals(): for x in range(interval.begin, interval.end): for source_begin, source_end, target_begin in TrafoInfo: if x >= source_begin and x < source_end: offset = x - source_begin y = target_begin + offset result.quick_append_interval(Interval(y)) result.clean() result.assert_consistency() return result
def create_random_number_set(): result = NumberSet() for begin, end in create_random_interval_list(False): result.quick_append_interval(Interval(begin, end)) result.clean() return result