System.out.println("PARSE FAILED");
System.out.print("\033[0m");
} else {
- System.out.println("\r \r");
+ System.out.print("\r \r");
}
HashSet<String> outs = new HashSet<String>();
if (output != null) for(String s : output) outs.add(s.trim());
for (Tree<String> r : results) {
String s = r.toString().trim();
if (outs.contains(s)) { outs.remove(s); continue; }
+ if (!bad) System.out.println(input);
System.out.print("\033[33m");
System.out.println(" GOT: " + s);
bad = true;
}
for(String s : outs) {
+ if (!bad) System.out.println(input);
System.out.print("\033[31m");
System.out.println("EXPECTED: " + s);
bad = true;
}
if (bad) {
- System.out.print("\033[0m");
+ System.out.println("\033[0m");
return true;
}
- System.out.println("\033[32mPASS\033[0m");
+ System.out.println("\r\033[32mPASS\033[0m ");
return false;
}
}
/** implementation of <tt>Topology</tt> for any class for which there is a mapping to the <tt>int</tt>s */
public class IntegerTopology<V extends IntegerTopology.IntegerMappable> implements Topology<V> {
private final Range.Set rs;
-
- public Range.Set getRanges() { return rs; /*FIXME: copy?*/ }
+
+ public Range.Set getRanges() { return new Range.Set(rs); }
public IntegerTopology() { this(new Range.Set()); }
public IntegerTopology(V v) { this(v.toInt()); }
for(Range r : ranges) add(r);
}
+ public Set(Iterable<Range> it) {
+ this();
+ for(Range r : it) add(r);
+ }
+
/**
* @param rs The set with which to union with this set.
* @return A new set that represents the union of this and the passed set.
public Topology<V> intersect(Topology<V> t);
public Topology<V> minus(Topology<V> t);
public Topology<V> union(Topology<V> t);
+ public Topology<V> complement();
public boolean disjoint(Topology<V> t);
public boolean containsAll(Topology<V> t);