import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import javax.swing.undo.UndoManager;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.awt.datatransfer.StringSelection;
import javax.imageio.metadata.*;
import javax.imageio.stream.*;
import java.text.SimpleDateFormat;
import java.awt.geom.*;
import java.text.NumberFormat;
class main {
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final VF1 onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF1() { public void get(final A a) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final IVF1 onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF1() { public void get(final A a) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final IVF2 onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF2() { public void get(A a, B b) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a, b);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a, b);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a, b);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final IVF3 onMessage) {
DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF3() { public void get(A a, B b, C c) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a, b, c);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a, b, c);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a, b, c);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final VF2 onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF2() { public void get(final A a, final B b) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a, b);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a, b);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a, b);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final VF3 onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF3() { public void get(final A a, final B b, final C c) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage, a, b, c);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage, a, b, c);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage, a, b, c);"; }});
}
static AutoCloseable dm_vmBus_onMessage_q(final String msg, final Runnable onMessage) {
final DynModule m = dm_current_mandatory();
return dm_vmBus_onMessage(msg, new VF1() { public void get(final A a) { try {
m.q().add(new Runnable() { public void run() { try {
callF(onMessage);
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "callF(onMessage);"; }}); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "switch to m.q();\r\n callF(onMessage);"; }});
}
static DynModule dm_current_mandatory() {
return assertNotNull("No module set!", dm_currentModule());
}
static AutoCloseable dm_vmBus_onMessage(final String msg, final VF1 onMessage) {
return dm_ownResource(vmBus_onMessage(msg, onMessage));
}
static AutoCloseable dm_vmBus_onMessage(final String msg, final IVF1 onMessage) {
return dm_ownResource(vmBus_onMessage(msg, ivf1ToVF1(onMessage)));
}
static AutoCloseable dm_vmBus_onMessage(final String msg, final IVF2 onMessage) {
return dm_ownResource(vmBus_onMessage(msg, ivf2ToVF2(onMessage)));
}
static AutoCloseable dm_vmBus_onMessage(String msg, final VF2 onMessage) {
return dm_ownResource(vmBus_onMessage(msg, onMessage));
}
static AutoCloseable dm_vmBus_onMessage(String msg, final VF3 onMessage) {
return dm_ownResource(vmBus_onMessage(msg, onMessage));
}
static AutoCloseable dm_vmBus_onMessage(String msg, Runnable onMessage) {
return dm_ownResource(vmBus_onMessage(msg, onMessage));
}
static Map> callF_cache = newDangerousWeakHashMap();
static A callF(F0 f) {
return f == null ? null : f.get();
}
static B callF(F1 f, A a) {
return f == null ? null : f.get(a);
}
static A callF(IF0 f) {
return f == null ? null : f.get();
}
static B callF(IF1 f, A a) {
return f == null ? null : f.get(a);
}
static C callF(F2 f, A a, B b) {
return f == null ? null : f.get(a, b);
}
static C callF(IF2 f, A a, B b) {
return f == null ? null : f.get(a, b);
}
static void callF(VF1 f, A a) {
if (f != null) f.get(a);
}
static Object callF(Object f, Object... args) { try {
if (f instanceof String)
return callMCWithVarArgs((String) f, args); // possible SLOWDOWN over callMC
if (f instanceof Runnable) {
((Runnable) f).run();
return null;
}
if (f == null) return null;
Class c = f.getClass();
ArrayList methods;
synchronized(callF_cache) {
methods = callF_cache.get(c);
if (methods == null)
methods = callF_makeCache(c);
}
int n = l(methods);
if (n == 0) {
throw fail("No get method in " + getClassName(c));
}
if (n == 1) return invokeMethod(methods.get(0), f, args);
for (int i = 0; i < n; i++) {
Method m = methods.get(i);
if (call_checkArgs(m, args, false))
return invokeMethod(m, f, args);
}
throw fail("No matching get method in " + getClassName(c));
} catch (Exception __e) { throw rethrow(__e); } }
// used internally
static ArrayList callF_makeCache(Class c) {
ArrayList l = new ArrayList();
Class _c = c;
do {
for (Method m : _c.getDeclaredMethods())
if (m.getName().equals("get")) {
makeAccessible(m);
l.add(m);
}
if (!l.isEmpty()) break;
_c = _c.getSuperclass();
} while (_c != null);
callF_cache.put(c, l);
return l;
}
static RuntimeException rethrow(Throwable t) {
if (t instanceof Error)
_handleError((Error) t);
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
}
static RuntimeException rethrow(String msg, Throwable t) {
throw new RuntimeException(msg, t);
}
static A assertNotNull(A a) {
assertTrue(a != null);
return a;
}
static A assertNotNull(String msg, A a) {
assertTrue(msg, a != null);
return a;
}
static DynModule dm_currentModule() {
return (DynModule) dm_current_generic();
}
static A dm_ownResource(A resource) {
dm_currentModuleMandatory().ownResource(resource);
return resource;
}
static AutoCloseable vmBus_onMessage(final String msg, final VF1 onMessage) {
Map map = vm_busListenersByMessage_live();
synchronized(map) {
Set listeners = map.get(msg);
if (listeners == null) map.put(msg, listeners = syncIdentityHashSet());
// We're technically violating the one-synchronized-object-per-thread rule,
// but it should be OK here.
// TODO: remove empty sets from map
return tempAdd(listeners, new VF2() { public void get(String _msg, Object arg) { try {
callF(onMessage, arg)
; } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "callF(onMessage, arg)"; }});
}
}
static AutoCloseable vmBus_onMessage(String msg, final VF2 onMessage) {
return vmBus_onMessage(msg, new VF1