change Invokable from two arguments to 3
authoradam <adam@megacz.com>
Mon, 26 Mar 2007 05:37:01 +0000 (01:37 -0400)
committeradam <adam@megacz.com>
Mon, 26 Mar 2007 05:37:01 +0000 (01:37 -0400)
darcs-hash:20070326053701-5007d-be67355344d42e4a93f85788274e29ed9c3f695c.gz

src/edu/berkeley/sbp/util/FastSet.java
src/edu/berkeley/sbp/util/Invokable.java
src/edu/berkeley/sbp/util/TopologicalBag.java
src/edu/berkeley/sbp/util/Visitable.java
src/edu/berkeley/sbp/util/VisitableMap.java

index 711c984..88475e2 100644 (file)
@@ -43,10 +43,10 @@ public /*final*/ class FastSet<T> implements Iterator<T>, Iterable<T>, Visitable
         if (found) size--;
     }
 
-    public <B,C> void visit(Invokable<T,B,C> ivbc, B b, C c) {
-        if (only!=null) ivbc.invoke(only, b, c);
+    public <B> void visit(Invokable<T,B> ivbc, B b) {
+        if (only!=null) ivbc.invoke(only, b);
         else for(int j=0; j<size; j++)
-            ivbc.invoke((T)array[j], b, c);
+            ivbc.invoke((T)array[j], b);
     }
 
     public int size() { return only==null ? size : 1; }
index 43415e8..0d16ea9 100644 (file)
@@ -8,6 +8,6 @@ import java.util.*;
 import java.lang.reflect.*;
 import java.lang.ref.*;
 
-public interface Invokable<A,B,C> {
-    public void invoke(A a, B b, C c);
+public interface Invokable<A,B> {
+    public void invoke(A a, B b);
 }
index f7ce6e7..eb71cdc 100644 (file)
@@ -103,11 +103,11 @@ public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<
     private HashMap<K,Iterable<V>> cache = new HashMap<K,Iterable<V>>();
     public Iterable<V> getAll(Topology<K> k) { return h.get(k); }
 
-    public <B,C> void invoke(K k, Invokable<V,B,C> ivbc, B b, C c) {
+    public <B> void invoke(K k, Invokable<V,B> ivbc, B b) {
         for(Topology<K> t : h.keySet())
             if (t.contains(k))
                 for(V v : h.get(t))
-                    ivbc.invoke(v, b, c);
+                    ivbc.invoke(v, b);
     }
 
     public Iterable<V> get(K k) {
@@ -165,13 +165,13 @@ public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<
                         return true;
                 return false;
             }
-            public <B,C> void invoke(K k, Invokable<V,B,C> ivbc, B b, C c) {
+            public <B> void invoke(K k, Invokable<V,B> ivbc, B b) {
                 int asint = f.invoke(k);
                 for(int i=0; i<size; i++) {
                     if (min[i] <= asint && max[i] >= asint) {
                         Object[] arr = v[i];
                         for(int j=0; j<arr.length; j++)
-                            ivbc.invoke((V)arr[j], b, c);
+                            ivbc.invoke((V)arr[j], b);
                     }
                 }
             }
index 017cab7..911e1b9 100644 (file)
@@ -5,6 +5,6 @@ import java.util.*;
 
 public interface Visitable<V> {
 
-    public <B,C> void visit(Invokable<V,B,C> ivbc, B b, C c);
+    public <B> void visit(Invokable<V,B> ivbc, B b);
 
 }
index 8ede7f4..314f55e 100644 (file)
@@ -7,7 +7,7 @@ import java.util.*;
 public interface VisitableMap<K,V> {
 
     /** invokes <tt>ivbc</tt> on each element of this map, passing constant arguments <tt>b</tt> and <tt>c</tt> */
-    public <B,C> void invoke(K k, Invokable<V,B,C> ivbc, B b, C c);
+    public <B> void invoke(K k, Invokable<V,B> ivbc, B b);
 
     /** returns true iff this map contains some value <tt>v</tt> for key <tt>k</tt> */
     public boolean contains(K k);