From a891589ff2e280982cf86a4f7f71431291b706ad Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 9 Sep 2007 15:03:00 -0400 Subject: [PATCH] add a second parameter argument to Invokable (two params now) darcs-hash:20070909190300-5007d-f98570adb4512b0f7cf60d678e7001f6dcfdfecc.gz --- src/edu/berkeley/sbp/util/FastSet.java | 6 +++--- src/edu/berkeley/sbp/util/Invokable.java | 4 ++-- src/edu/berkeley/sbp/util/TopologicalBag.java | 8 ++++---- src/edu/berkeley/sbp/util/Visitable.java | 2 +- src/edu/berkeley/sbp/util/VisitableMap.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/edu/berkeley/sbp/util/FastSet.java b/src/edu/berkeley/sbp/util/FastSet.java index c8302b5..4e289cd 100644 --- a/src/edu/berkeley/sbp/util/FastSet.java +++ b/src/edu/berkeley/sbp/util/FastSet.java @@ -43,10 +43,10 @@ public /*final*/ class FastSet implements Iterator, Iterable, Visitable if (found) size--; } - public void visit(Invokable ivbc, B b) { - if (only!=null) ivbc.invoke(only, b); + public void visit(Invokable ivbc, B b, C c) { + if (only!=null) ivbc.invoke(only, b, c); else for(int j=0; j { - public void invoke(A a, B b); +public interface Invokable { + public void invoke(A a, B b, C c); } diff --git a/src/edu/berkeley/sbp/util/TopologicalBag.java b/src/edu/berkeley/sbp/util/TopologicalBag.java index b034baf..28166fb 100644 --- a/src/edu/berkeley/sbp/util/TopologicalBag.java +++ b/src/edu/berkeley/sbp/util/TopologicalBag.java @@ -103,11 +103,11 @@ public class TopologicalBag implements MapBag,V>, VisitableMap< private HashMap> cache = new HashMap>(); public Iterable getAll(Topology k) { return h.get(k); } - public void invoke(K k, Invokable ivbc, B b) { + public void invoke(K k, Invokable ivbc, B b, C c) { for(Topology t : h.keySet()) if (t.contains(k)) for(V v : h.get(t)) - ivbc.invoke(v, b); + ivbc.invoke(v, b, c); } public Iterable get(K k) { @@ -165,13 +165,13 @@ public class TopologicalBag implements MapBag,V>, VisitableMap< return true; return false; } - public void invoke(K k, Invokable ivbc, B b) { + public void invoke(K k, Invokable ivbc, B b, C c) { int asint = f.invoke(k); for(int i=0; i= asint) { Object[] arr = v[i]; for(int j=0; j { - public void visit(Invokable ivbc, B b); + public void visit(Invokable ivbc, B b, C c); } diff --git a/src/edu/berkeley/sbp/util/VisitableMap.java b/src/edu/berkeley/sbp/util/VisitableMap.java index c57b7c8..c5f1a56 100644 --- a/src/edu/berkeley/sbp/util/VisitableMap.java +++ b/src/edu/berkeley/sbp/util/VisitableMap.java @@ -8,7 +8,7 @@ import java.io.*; public interface VisitableMap extends Serializable { /** invokes ivbc on each element of this map, passing constant arguments b and c */ - public void invoke(K k, Invokable ivbc, B b); + public void invoke(K k, Invokable ivbc, B b, C c); /** returns true iff this map contains some value v for key k */ public boolean contains(K k); -- 1.7.10.4