public void post_message(int from_id, int data) { class Bind implements Runnable { public int from_id, data; public Component subject; public void run() { subject.do_post_message(from_id, data); } } Bind pm = new Bind(); pm.from_id = from_id; pm.data = data; pm.subject = this; thread.dispatch(pm); }
public void post_marker(int from_id) { // The C++ coder wonders why Java sucks so much! // thread->dispatch(boost::bind(&Component::do_post_marker, this, from_id)); class Bind implements Runnable { public int from_id; public Component subject; public void run() { subject.do_post_marker(from_id); } } Bind pm = new Bind(); pm.from_id = from_id; pm.subject = this; thread.dispatch(pm); }
/** * Records the fact that instances of <code>rel</code> are available via <code>bind</code> (which * may be eager or lazy). */ private void bind(RelNode rel, Bind bind) { tracer.log(Level.FINE, "Bind " + rel.toString() + " to " + bind); JavaFrame frame = (JavaFrame) mapRel2Frame.get(rel); frame.bind = bind; boolean stupid = SaffronProperties.instance().stupid.get(); if (stupid) { // trigger the declaration of the variable, even though it // may not be used Util.discard(bind.getVariable()); } }
public static Bind newSet(String resource) { Bind bind = new Bind(resource, null); bind.setType(Type.set); return bind; }