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.*;
// list contains strings or pairs (item + reasoning) or WithReasoning
// optional parameter: S computerNotes
// optional parameter: O info - an object that will be struct()ed and appended to the computerNotes field
// This version uses str(makeList) for "code" field
class main {
static String dm_showListWithFeedback(F0 extends Collection> makeList, Object... __) {
String code = str(makeList);
String computerNotes = (String) (optPar("computerNotes",__));
Object info = optPar("info",__);
if (info != null)
computerNotes = joinNemptiesWithEmptyLines(computerNotes, struct(info));
return dm_showListWithFeedback(makeList.get(), paramsPlus_noOverwrite(__, "code", code, "computerNotes", computerNotes));
}
static String dm_showListWithFeedback(String description, Collection list, Object... __) {
String module = dm_showNewModule("#1026559/ListWithFeedback");
dm_setAll(module,
"description", description,
"code" , optParam("code",__),
"computerNotes" , optParam("computerNotes",__));
dm_callModule(module, "importItems", list);
return module;
}
static String dm_showListWithFeedback(Collection list, Object... __) {
return dm_showListWithFeedback(null, list, __);
}
static String str(Object o) {
return o == null ? "null" : o.toString();
}
static String str(char[] c) {
return new String(c);
}
static A optPar(ThreadLocal tl, A defaultValue) {
A a = tl.get();
if (a != null) {
tl.set(null);
return a;
}
return defaultValue;
}
static A optPar(ThreadLocal tl) {
return optPar(tl, null);
}
static Object optPar(Object[] params, String name) {
return optParam(params, name);
}
static Object optPar(String name, Object[] params) {
return optParam(params, name);
}
static Object optPar(String name, Map params) {
return optParam(name, params);
}
static A optPar(Object[] params, String name, A defaultValue) {
return optParam(params, name, defaultValue);
}
static A optPar(String name, Object[] params, A defaultValue) {
return optParam(params, name, defaultValue);
}
static String joinNemptiesWithEmptyLines(List l) {
return joinWithEmptyLines(nempties(l));
}
static String joinNemptiesWithEmptyLines(String... l) {
return joinNemptiesWithEmptyLines(asList(l));
}
static String struct(Object o) {
return structure(o);
}
static String struct(Object o, structure_Data data) {
return structure(o, data);
}
static Object[] paramsPlus_noOverwrite(Object[] a1, Object... a2) {
if (a2 == null) return a1;
if (a1 == null) return a2;
if (l(a1) == 1 && a1[0] instanceof Map)
return new Object[] { mapPlus((Map) a1[0], a2) };
assertEvenLength(a1);
assertEvenLength(a2);
Map map = paramsToOrderedMap(a1);
int n = l(a2);
for (int i = 0; i < n; i += 2)
mapPut_noOverwrite(map, a2[i], a2[i+1]);
return mapToParams(map);
}
// makes dynamic & static modules
static String dm_showNewModule(String moduleLibID) {
return (String) dm_callOS("makeNewModule", moduleLibID, true);
}
static Object dm_setAll(Object moduleOrID, Object... values) {
failIfOddCount(values);
for (int i = 0; i+1 < l(values); i += 2) {
String field = (String) values[i];
Object value = values[i+1];
dm_set(moduleOrID, field, value);
}
return moduleOrID;
}
static A optParam(ThreadLocal tl, A defaultValue) {
return optPar(tl, defaultValue);
}
static A optParam(ThreadLocal tl) {
return optPar(tl);
}
static Object optParam(String name, Map params) {
return mapGet(params, name);
}
// now also takes a map as single array entry
static A optParam(Object[] opt, String name, A defaultValue) {
int n = l(opt);
if (n == 1 && opt[0] instanceof Map) {
Map map = (Map) (opt[0]);
return map.containsKey(name) ? (A) map.get(name) : defaultValue;
}
if (!even(l(opt))) throw fail("Odd parameter length");
for (int i = 0; i < l(opt); i += 2)
if (eq(opt[i], name))
return (A) opt[i+1];
return defaultValue;
}
static Object optParam(Object[] opt, String name) {
return optParam(opt, name, null);
}
static Object optParam(String name, Object[] params) {
return optParam(params, name);
}
static Object dm_callModule(Object moduleOrID, String method, Object... args) {
Object mod = dm_getModule(moduleOrID);
if (mod == null) return null;
AutoCloseable __1 = dm_enter(mod); try {
return call(mod, method, args);
} finally { _close(__1); }}
static String joinWithEmptyLines(List l) {
return join("\n\n", map("rtrim",l));
}
static String joinWithEmptyLines(String... l) {
return joinWithEmptyLines(asList(l));
}
static List nempties(Collection c) {
return filterNempty(c);
}
static ArrayList asList(A[] a) {
return a == null ? new ArrayList() : new ArrayList(Arrays.asList(a));
}
static ArrayList asList(int[] a) {
if (a == null) return null;
ArrayList l = emptyList(a.length);
for (int i : a) l.add(i);
return l;
}
static ArrayList asList(float[] a) {
if (a == null) return null;
ArrayList l = emptyList(a.length);
for (float i : a) l.add(i);
return l;
}
static ArrayList asList(double[] a) {
if (a == null) return null;
ArrayList l = emptyList(a.length);
for (double i : a) l.add(i);
return l;
}
static ArrayList asList(Iterable s) {
if (s instanceof ArrayList) return (ArrayList) s;
ArrayList l = new ArrayList();
if (s != null)
for (A a : s)
l.add(a);
return l;
}
static ArrayList asList(Enumeration e) {
ArrayList l = new ArrayList();
if (e != null)
while (e.hasMoreElements())
l.add(e.nextElement());
return l;
}
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) {
structure_Data d = new structure_Data();
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 {
List fields;
Method customSerializer;
boolean special, nullInstances;
}
static class structure_Data {
PrintWriter out;
int stringSizeLimit;
int shareStringsLongerThan = 20;
boolean noStringSharing = false;
IdentityHashMap