projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed illegal use of double-star
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
Union.java
diff --git
a/src/edu/berkeley/sbp/Union.java
b/src/edu/berkeley/sbp/Union.java
index
7274dae
..
a7a7630
100644
(file)
--- a/
src/edu/berkeley/sbp/Union.java
+++ b/
src/edu/berkeley/sbp/Union.java
@@
-19,10
+19,11
@@
public class Union extends Element implements Iterable<Sequence> {
void reachable(HashSet<Sequence.Position> h) { for(Sequence s : alternatives) s.reachable(h); }
Topology toAtom() {
void reachable(HashSet<Sequence.Position> h) { for(Sequence s : alternatives) s.reachable(h); }
Topology toAtom() {
- if (alternatives.size()==0) return null;
+ if (alternatives.size()==0) throw new RuntimeException("cannot build an Atom from a Union with no productions");
Topology ret = null;
for(Sequence s : this) {
Topology a = s.toAtom();
Topology ret = null;
for(Sequence s : this) {
Topology a = s.toAtom();
+ if (a==null) continue;
if (ret==null) ret = a.dup();
else ret.add(a.dup());
}
if (ret==null) ret = a.dup();
else ret.add(a.dup());
}