summaryrefslogtreecommitdiffstats
path: root/src/act4e_solutions/sets_representation.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2023-10-17 15:03:23 +0200
committerNao Pross <np@0hm.ch>2023-10-17 15:03:23 +0200
commitda2e878bf982ea2a0fe7727b68dfa211409973bb (patch)
tree4031f5794976911c96ba36742c0c32156a73c0b0 /src/act4e_solutions/sets_representation.py
parentSketch TestFiniteMapRepresentation (diff)
downloadact4e-impl_fail.tar.gz
act4e-impl_fail.zip
Something weird is going on hereimpl_fail
Diffstat (limited to 'src/act4e_solutions/sets_representation.py')
-rw-r--r--src/act4e_solutions/sets_representation.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py
index 9e231c1..627b408 100644
--- a/src/act4e_solutions/sets_representation.py
+++ b/src/act4e_solutions/sets_representation.py
@@ -61,5 +61,12 @@ class SolFiniteSetRepresentation(I.FiniteSetRepresentation):
raise I.InvalidFormat()
def save(self, h: I.IOHelper, f: I.FiniteSet[Any]) -> I.FiniteSet_desc:
- all_elements = [f.save(h, e) for e in f.elements()]
- return {"elements": all_elements}
+ if isinstance(f, MyFiniteSetProduct):
+ return {"product": [{"elements": c.elements()} for c in f.components()]}
+
+ elif isinstance(f, MyFiniteSet):
+ all_elements = [f.save(h, e) for e in f.elements()]
+ return {"elements": all_elements}
+
+ else:
+ raise I.InvalidFormat()