This repository was archived by the owner on Jun 27, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,8 @@ def __invert__(self):
140
140
### PARALLEL COMPOSITION
141
141
142
142
def __add__ (c1 , c2 ):
143
+ from pyretic .core .language import drop , identity
143
144
def _cross (r1 ,r2 ):
144
- from pyretic .core .language import drop
145
145
intersection = r1 .match .intersect (r2 .match )
146
146
if intersection != drop :
147
147
# TODO (josh) logic for detecting when sets of actions can't be combined
@@ -156,17 +156,19 @@ def _cross(r1,r2):
156
156
157
157
# start with an empty set of rules for the output classifier
158
158
c3 = Classifier ()
159
- # JOSH - this check shouldn't be needed (I think)
160
- if c2 is None :
161
- return None
159
+ assert (not (c1 is None and c2 is None ))
162
160
# then cross all pairs of rules in the first and second classifiers
163
161
for r1 in c1 .rules :
164
162
for r2 in c2 .rules :
165
163
crossed_r = _cross (r1 ,r2 )
166
164
if crossed_r :
167
165
c3 .append (crossed_r )
166
+ # if the classifier is empty, add a drop-all rule
167
+ if len (c3 ) == 0 :
168
+ c3 .append (Rule (identity ,[drop ]))
168
169
# and optimize the classifier
169
- c3 = c3 .optimize ()
170
+ else :
171
+ c3 = c3 .optimize ()
170
172
return c3
171
173
172
174
You can’t perform that action at this time.
0 commit comments