X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fbind%2FBindable.java;h=8f5cc86749efa2060ac98fda91c2bfb6ae308d1a;hb=f09d2abb95f106197aea99c345282c3bf0cd3717;hp=7c620c94bd4024717ac27123f1867dccf132a184;hpb=34202c7836b0f48a034f38e4477623d512d0b2d5;p=sbp.git diff --git a/src/edu/berkeley/sbp/bind/Bindable.java b/src/edu/berkeley/sbp/bind/Bindable.java index 7c620c9..8f5cc86 100644 --- a/src/edu/berkeley/sbp/bind/Bindable.java +++ b/src/edu/berkeley/sbp/bind/Bindable.java @@ -22,6 +22,11 @@ public abstract class Bindable implements ToJava { public abstract String[] getArgNames(); public abstract Class[] getArgTypes(); + public Binding createBinding() { return new SimpleBinding(); } + public Binding createBinding(final int[] map) { return new SimpleBinding(map); } + public Binding createBinding(final int[] map, Object prepend) { return new SimpleBinding(map, prepend); } + + public static Bindable create(Object o) { if (o instanceof Class) return new BindableClass((Class)o); if (o instanceof Method) return new BindableMethod((Method)o); @@ -29,24 +34,7 @@ public abstract class Bindable implements ToJava { return null; } - public Binding createBinding() { - return new Binding() { - public Object invoke(Object[] o) { - return impose(o); - } - }; - } - public Binding createBinding(final int[] map) { - return new Binding() { - public Object invoke(Object[] o) { - int max = 0; - for(int i=0; i