X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FIntegerTopology.java;fp=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FIntegerTopology.java;h=71e9df9f6a1df4ce860772a34f1c623511cd3a0a;hp=ae99c083880cb7d2bda7ec5fa616422139fa66ba;hb=e42e16515f4392017a8109922d37dcd0926f915a;hpb=ad3d28238e215a2dee9224c146a1928671c2ba89 diff --git a/src/edu/berkeley/sbp/util/IntegerTopology.java b/src/edu/berkeley/sbp/util/IntegerTopology.java index ae99c08..71e9df9 100644 --- a/src/edu/berkeley/sbp/util/IntegerTopology.java +++ b/src/edu/berkeley/sbp/util/IntegerTopology.java @@ -23,8 +23,11 @@ public class IntegerTopology implements Topology { public IntegerTopology(Functor f, int a) { this(f, a, a); } public IntegerTopology(Functor f, int a, int b) { this(f, new Range(a, b)); } public IntegerTopology(Functor f, Range r) { this(f, new Range.Set(r)); } - public IntegerTopology(Functor f, Range.Set rs) { this.rs = rs; this.f = f; } - + public IntegerTopology(Functor f, Range.Set rs) { + this.rs = rs; + this.f = f==null?(this instanceof Functor ? (Functor)this : null):f; + } + public Topology empty() { return new IntegerTopology(f); } public boolean contains(V v) { return rs.contains(toInt(v)); }