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)
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)
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
def first(self): return self.functionCall(BInteger(1))
def _size(self) -> 'BInteger': return BInteger(self.size())
def card(self) -> 'BInteger': return BInteger(self.size())
def size(self) -> 'BInteger': return BInteger(len(self.__set))
def card(self) -> 'BInteger': return BInteger(len(self.__set))