| 95 | self.constructions = constructions |
| 96 | |
| 97 | def translate(self, mapping: dict[str, str]) -> Clause: |
| 98 | points0 = [] |
| 99 | for p in self.points: |
| 100 | pcount = len(mapping) + 1 |
| 101 | name = chr(96 + pcount) |
| 102 | if name > 'z': # pcount = 26 -> name = 'z' |
| 103 | name = chr(97 + (pcount - 1) % 26) + str((pcount - 1) // 26) |
| 104 | |
| 105 | p0 = mapping.get(p, name) |
| 106 | mapping[p] = p0 |
| 107 | points0.append(p0) |
| 108 | return Clause(points0, [c.translate(mapping) for c in self.constructions]) |
| 109 | |
| 110 | def add(self, name: str, args: list[str]) -> None: |
| 111 | self.constructions.append(Construction(name, args)) |