本文整理汇总了Python中quex.engine.misc.interval_handling.NumberSet.quick_append_interval方法的典型用法代码示例。如果您正苦于以下问题:Python NumberSet.quick_append_interval方法的具体用法?Python NumberSet.quick_append_interval怎么用?Python NumberSet.quick_append_interval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quex.engine.misc.interval_handling.NumberSet
的用法示例。
在下文中一共展示了NumberSet.quick_append_interval方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from quex.engine.misc.interval_handling import NumberSet [as 别名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import quick_append_interval [as 别名]
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
示例2: load_Composition_Exclusion
# 需要导入模块: from quex.engine.misc.interval_handling import NumberSet [as 别名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import quick_append_interval [as 别名]
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
示例3: verify
# 需要导入模块: from quex.engine.misc.interval_handling import NumberSet [as 别名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import quick_append_interval [as 别名]
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
示例4: create_random_number_set
# 需要导入模块: from quex.engine.misc.interval_handling import NumberSet [as 别名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import quick_append_interval [as 别名]
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