checkpoint
[sbp.git] / src / edu / berkeley / sbp / util / IntegerTopology.java
index ae99c08..71e9df9 100644 (file)
@@ -23,8 +23,11 @@ public class IntegerTopology<V> implements Topology<V> {
     public IntegerTopology(Functor<V,Integer> f, int a)        { this(f, a, a); }
     public IntegerTopology(Functor<V,Integer> f, int a, int b) { this(f, new Range(a, b)); }
     public IntegerTopology(Functor<V,Integer> f, Range r)      { this(f, new Range.Set(r)); }
-    public IntegerTopology(Functor<V,Integer> f, Range.Set rs) { this.rs = rs; this.f = f; }
-
+    public IntegerTopology(Functor<V,Integer> f, Range.Set rs) {
+        this.rs = rs;
+        this.f = f==null?(this instanceof Functor ? (Functor)this : null):f;
+    }
+    
     public Topology<V> empty()              { return new IntegerTopology<V>(f);   }
         
     public boolean          contains(V v)              { return rs.contains(toInt(v)); }