Пример #1
0
 def prepend(self, arg) -> 'BRelation':
     result_map = immutables.Map()
     this_map = self.map
     size = self._size().intValue()
     for i in map(BInteger, range(1, size + 1)):
         result_map = result_map.set(i.succ(), this_map.get(i))
     result_map = result_map.set(BInteger(1), frozenset([arg]))
     return BRelation(result_map)
Пример #2
0
	def prepend(self, arg) -> 'BRelation':
		result_map = {}
		this_map = self.map
		size = self._size().intValue()
		for i in map(BInteger, range(1, size + 1)):
			result_map[i.succ()] = this_map[i]
		result_map[BInteger(1)] = {arg}
		return BRelation(result_map)
Пример #3
0
	def closure(self) -> 'BRelation':
		this_relation = self
		result = self.iterate(BInteger(0))
		next_result = result.composition(this_relation)
		while True:
			last_result = deepcopy(result)
			result = result.union(next_result)
			next_result = result.composition(this_relation)
			if result.equal(last_result).booleanValue():
				break
		return result
Пример #4
0
 def first(self):
     return self.functionCall(BInteger(1))
Пример #5
0
 def _size(self) -> 'BInteger':
     return BInteger(self.size())
Пример #6
0
 def card(self) -> 'BInteger':
     return BInteger(self.size())
Пример #7
0
 def size(self) -> 'BInteger':
     return BInteger(len(self.__set))
Пример #8
0
 def card(self) -> 'BInteger':
     return BInteger(len(self.__set))