def get_swap_subset(self, subset, other):
# get a copy of subset!
subset = subset.copy()
# print "will check", self.name, other.name, "in", subset
for lifetime in itertools.cycle((self, other)):
old_size = subset.size
for sg in lifetime.subsets:
if sg.intersects(subset):
# print "\t", sg, "intersects", subset
if sg.no_swap:
# print "\tsg is no swap .. bail out"
return None
# print "\tmerging them!"
subset.merge(sg)
if subset.size == old_size:
# print "\tsize did not change, done!"
break
return subset
评论列表
文章目录