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 java.util.function.*;
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 java.awt.geom.*;
import javax.imageio.*;
import java.math.*;
import java.time.Duration;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import static x30_pkg.x30_util.DynamicObject;
import java.text.*;
import java.text.NumberFormat;
import java.util.TimeZone;
import java.awt.geom.*;
class main {
static JComponent jStruct(Object o) { return jStruct(new structure_Data(), o); }
static JComponent jStruct(structure_Data data, Object o) {
return uneditableWordWrappedTextArea(indentedStruct(o, data));
}
static JTextArea uneditableWordWrappedTextArea() { return uneditableWordWrappedTextArea(""); }
static JTextArea uneditableWordWrappedTextArea(String text) {
return enableWordWrapForTextArea(uneditableTextArea(text));
}
static String indentedStruct(Object o) {
return indentedStructure(o);
}
static String indentedStruct(Object o, structure_Data data) {
return indentedStructure(o, data);
}
static JTextArea enableWordWrapForTextArea(JTextArea ta) {
return enableWordWrapForTextArea(ta, true);
}
static JTextArea enableWordWrapForTextArea(JTextArea ta, boolean enabled) {
if (ta != null) { swing(() -> {
ta.setLineWrap(enabled);
ta.setWrapStyleWord(true);
// Haven't found a way to reliable enable word-wrapping for
// an already visible text area
//revalidate(enclosingScrollPane(ta));
}); }
return ta;
}
static JTextArea uneditableTextArea() { return uneditableTextArea(""); }
static JTextArea uneditableTextArea(String text) {
return uneditableBlackTextArea_noUndo(text);
}
static String indentedStructure(Object o) {
return indentStructureString(struct(o));
}
static String indentedStructure(Object o, structure_Data data) {
return indentStructureString(struct(o, data));
}
static Object swing(Object f) {
return swingAndWait(f);
}
static void swing(Runnable f) {
swingAndWait(f);
}
static A swing(F0 f) {
return (A) swingAndWait(f);
}
static A swing(IF0 f) {
return (A) swingAndWait(f);
}
static JTextArea uneditableBlackTextArea_noUndo() { return uneditableBlackTextArea_noUndo(""); }
static JTextArea uneditableBlackTextArea_noUndo(String text) {
return makeUneditableWithTextColor(Color.black, jTextArea_noUndo(text));
}
static String indentStructureString(String s) { return indentStructureString(100, s); }
static String indentStructureString(int levels, String s) {
if (s == null) return null;
return new StructureStringIndenter().levels(levels).get(s);
}
static String struct(Object o) {
return structure(o);
}
static String struct(Object o, structure_Data data) {
return structure(o, data);
}
static void swingAndWait(Runnable r) { try {
if (isAWTThread())
r.run();
else {
r = addThreadInfoToRunnable(r);
executingSwingCode(r);
EventQueue.invokeAndWait(r);
}
} catch (Exception __e) { throw rethrow(__e); } }
static Object swingAndWait(Object f) {
if (isAWTThread())
return callF(f);
else {
Var result = new Var();
swingAndWait(new Runnable() { public void run() { try {
result.set(callF(f));
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "result.set(callF(f));"; }});
return result.get();
}
}
static A makeUneditableWithTextColor(A a, Color color) {
if (a != null) { swing(() -> {
a.setEditable(false);
// prevent auto-scrolling when text is changed programmatically
DefaultCaret caret = (DefaultCaret) (a.getCaret());
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
a.setDisabledTextColor(color);
}); }
return a;
}
static A makeUneditableWithTextColor(Color color, A a) {
return makeUneditableWithTextColor(a, color);
}
static JTextArea jTextArea_noUndo() {
return jTextArea_noUndo("");
}
static JTextArea jTextArea_noUndo(final String text) {
return swingNu(JTextArea.class, text);
}
static boolean structure_showTiming, structure_checkTokenCount;
static String structure(Object o) {
return structure(o, new structure_Data());
}
static String structure(Object o, structure_Data d) {
StringWriter sw = new StringWriter();
d.out = new PrintWriter(sw);
structure_go(o, d);
String s = str(sw);
if (structure_checkTokenCount) {
print("token count=" + d.n);
assertEquals("token count", l(javaTokC(s)), d.n);
}
return s;
}
static void structure_go(Object o, structure_Data d) {
structure_1(o, d);
while (nempty(d.stack))
popLast(d.stack).run();
}
static void structureToPrintWriter(Object o, PrintWriter out) { structureToPrintWriter(o, out, new structure_Data()); }
static void structureToPrintWriter(Object o, PrintWriter out, structure_Data d) {
d.out = out;
structure_go(o, d);
}
// leave to false, unless unstructure() breaks
static boolean structure_allowShortening = false;
// info on how to serialize objects of a certain class
static class structure_ClassInfo {
Class c;
String shortName;
List fields;
Method customSerializer;
IVF1