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 java.awt.geom.*;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import static x30_pkg.x30_util.DynamicObject;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.Const;
import org.apache.bcel.generic.*;
import java.lang.reflect.Type;
import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*;
import org.fife.ui.autocomplete.*;
import org.fife.rsta.ui.CollapsibleSectionPanel;
import org.fife.rsta.ui.GoToDialog;
import org.fife.rsta.ui.SizeGripIcon;
import org.fife.rsta.ui.search.FindDialog;
import org.fife.rsta.ui.search.ReplaceDialog;
import org.fife.rsta.ui.search.ReplaceToolBar;
import org.fife.rsta.ui.search.SearchEvent;
import org.fife.rsta.ui.search.SearchListener;
import org.fife.rsta.ui.search.FindToolBar;
import org.fife.ui.rsyntaxtextarea.ErrorStrip;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.fife.ui.rtextarea.SearchContext;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
import org.fife.ui.rsyntaxtextarea.SyntaxScheme;
import java.util.jar.*;
import javax.swing.border.TitledBorder;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.text.*;
import java.nio.file.Path;
import javax.swing.event.AncestorListener;
import javax.swing.event.AncestorEvent;
import javax.swing.Timer;
import org.fife.ui.rsyntaxtextarea.*;
import javax.swing.border.*;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import javax.swing.undo.UndoManager;
import java.text.NumberFormat;
import javax.imageio.metadata.*;
import javax.imageio.stream.*;
import java.text.SimpleDateFormat;
import java.nio.charset.Charset;
import java.util.TimeZone;
import java.awt.datatransfer.UnsupportedFlavorException;
import javax.swing.Icon;
public class main {
static public void test_LeftArrowScriptAutoCompleter() {
GazelleV_LeftArrowScriptParser parser = new GazelleV_LeftArrowScriptParser();
LeftArrowScriptAutoCompleter completer = new LeftArrowScriptAutoCompleter(parser);
completer.globalMethodNames = () -> ll("add", "pat", "lol");
completer.parser.noImports();
assertEmpty(completer.parser.globalClassNames());
completer.seek("a", 1);
assertEqualsVerbose("a", completer.typedCharacters());
assertEqualsVerbose(ll("add", "pat", "false"), completer.getCompletions());
parser = new GazelleV_LeftArrowScriptParser();
completer = new LeftArrowScriptAutoCompleter(parser);
completer.globalMethodNames = () -> ll("add", "pat", "lol");
completer.parser.importedPackages = () -> null;
completer.seek("add", 3);
assertFalseVerbose(contains(completer.getCompletions(), "add"));
parser = new GazelleV_LeftArrowScriptParser();
completer = new LeftArrowScriptAutoCompleter(parser);
completer.globalMethodNames = () -> ll("add", "pat", "lol");
completer.parser.importedPackages = () -> null;
completer.seek("add ", 4);
assertContainsAll(completer.getCompletions(), ll("true", "false", "null"));
for (String text : ll("Mat", "Mat ")) {
parser = new GazelleV_LeftArrowScriptParser();
completer = new LeftArrowScriptAutoCompleter(parser);
completer.seek(printQuoted("text", text), 3);
var completions = completer.getCompletions();
pnlReversed(takeFirst(10, completions));
assertEquals(0, indexOf(completions, "Math"));
}
parser = new GazelleV_LeftArrowScriptParser();
completer = new LeftArrowScriptAutoCompleter(parser);
completer.seek(print("new Inte"), 8);
var completions = completer.getCompletions();
pnlReversed(takeFirst(10, completions));
assertEquals(0, indexOf(completions, "Integer"));
parser = new GazelleV_LeftArrowScriptParser();
parser.allowTheWorld(test_LeftArrowScriptAutoCompleter_FunctionContainer.class);
completer = new LeftArrowScriptAutoCompleter(parser);
completer.seek(print("MyN"), 3);
completions = completer.getCompletions();
pnlReversed(takeFirst(10, completions));
assertEquals(0, indexOf(completions, "MyName"));
parser = new GazelleV_LeftArrowScriptParser();
parser.functionDefs.put("hello", new GazelleV_LeftArrowScript.FunctionDef());
completer = new LeftArrowScriptAutoCompleter(parser);
completer.seekEnd("he");
completions = completer.getCompletions();
assertContains(completions, "hello");
test_LeftArrowScriptAutoCompleter_testVars();
test_LeftArrowScriptAutoCompleter_testMethodsOfNewInstance();
test_LeftArrowScriptAutoCompleter_testMethodsOfNewInstanceInVar();
test_LeftArrowScriptAutoCompleter_testMethodsOfFunctionResultInVar();
test_LeftArrowScriptAutoCompleter_testMethodsOfLambdaParameter();
printWithPrecedingNL("Auto-completer works!");
}
static public void test_LeftArrowScriptAutoCompleter_testVars() {
var parser = new GazelleV_LeftArrowScriptParser();
parser.noImports();
var completer = new LeftArrowScriptAutoCompleter(parser);
completer.seekEnd("a <- 1\n");
pnl("knowVarsByTokenIdx", completer.knownVarsByTokenIdx);
assertSetsEqual(print(listPlus(completer.predefinedExpressions(), "a")), print(completer.getCompletions()));
}
static public void test_LeftArrowScriptAutoCompleter_testMethodsOfNewInstance() {
var parser = enableScaffolding(new GazelleV_LeftArrowScriptParser());
var completer = enableScaffolding(new LeftArrowScriptAutoCompleter(parser));
completer.seekEnd("new Double, ");
assertContains(print(completer.getCompletions()), "doubleValue");
}
static public void test_LeftArrowScriptAutoCompleter_testMethodsOfNewInstanceInVar() {
var parser = enableScaffolding(new GazelleV_LeftArrowScriptParser());
parser.onTypeHook(type -> print("TypeHook at " + parser.t() + " (" + parser.tokIdx() + ": " + type));
var completer = (new LeftArrowScriptAutoCompleter(parser));
completer.seekEnd("x <- new Double; x ");
assertContains(print(completer.getCompletions()), "doubleValue");
}
static public void test_LeftArrowScriptAutoCompleter_testMethodsOfFunctionResultInVar() {
var parser = enableScaffolding(new GazelleV_LeftArrowScriptParser());
var completer = (new LeftArrowScriptAutoCompleter(parser));
completer.seekEnd(" def myFunc: S { \"\" }; x <- myFunc; x ");
assertContains(print(completer.getCompletions()), "length");
}
static public void test_LeftArrowScriptAutoCompleter_testMethodsOfLambdaParameter() {
var parser = enableScaffolding(new GazelleV_LeftArrowScriptParser());
parser.allowTheWorld(test_LeftArrowScriptAutoCompleter_FunctionContainer.class);
var completer = (new LeftArrowScriptAutoCompleter(parser));
completer.seekEnd(" IVF1 a: S -> a ");
assertContains(print(completer.getCompletions()), "length");
}
static public class test_LeftArrowScriptAutoCompleter_FunctionContainer {
public class MyName {
}
public interface IVF1 {
public void get(A a);
}
}
static public Method findMethod(Object o, String method, Object... args) {
return findMethod_cached(o, method, args);
}
static public boolean findMethod_checkArgs(Method m, Object[] args, boolean debug) {
Class>[] types = m.getParameterTypes();
if (types.length != args.length) {
if (debug)
System.out.println("Bad parameter length: " + args.length + " vs " + types.length);
return false;
}
for (int i = 0; i < types.length; i++) if (!(args[i] == null || isInstanceX(types[i], args[i]))) {
if (debug)
System.out.println("Bad parameter " + i + ": " + args[i] + " vs " + types[i]);
return false;
}
return true;
}
static public String concat(Object... l) {
return concatStrings(l);
}
static public String concat(Iterable l) {
return concatStrings(l);
}
static public Throwable getException(Runnable r) {
try {
callF(r);
return null;
} catch (Throwable e) {
return e;
}
}
static public RuntimeException fail() {
throw new RuntimeException("fail");
}
static public RuntimeException fail(Throwable e) {
throw asRuntimeException(e);
}
static public RuntimeException fail(Object msg) {
throw new RuntimeException(String.valueOf(msg));
}
static public RuntimeException fail(Object... objects) {
throw new Fail(objects);
}
static public RuntimeException fail(String msg) {
throw new RuntimeException(msg == null ? "" : msg);
}
static public RuntimeException fail(String msg, Throwable innerException) {
throw new RuntimeException(msg, innerException);
}
static public char[] chars(String s) {
return asChars(s);
}
static public Class _getClass2(Object o) {
return o == null ? null : o.getClass();
}
static public Duration daysToDuration(double days) {
return msToDuration(daysToMS(days));
}
static public A getVar(IF0 v) {
return v == null ? null : v.get();
}
static public A getVar(Optional v) {
return v == null ? null : v.orElse(null);
}
static public double[] litdoublearray(double... l) {
return cloneDoubleArray(l);
}
static public BigInteger mul(BigInteger a, BigInteger b) {
return a.multiply(b);
}
static public BigInteger mul(BigInteger a, long b) {
return a.multiply(bigint(b));
}
static public int mul(int a, int b) {
return a * b;
}
static public double mul(double a, double b) {
return a * b;
}
static public void nop() {
}
static public byte toByte(Object o) {
if (o == null)
return (byte) 0;
if (o instanceof Number)
return ((Number) o).byteValue();
if (o instanceof String)
return toByte(parseInt((String) o));
throw fail("not convertible to byte: " + getClassName(o));
}
static public byte toByte(int i) {
return (byte) i;
}
static public byte[] litbytearray(byte... l) {
return cloneByteArray(l);
}
static public List splitAtSpace(String s) {
return empty(s) ? emptyList() : asList(s.split("\\s+"));
}
static public Pt neg(Pt p) {
return p == null ? null : new Pt(-p.x, -p.y);
}
static public int neg(int i) {
return -i;
}
static public double neg(double i) {
return -i;
}
static public void sleepSeconds(double s) {
if (s > 0)
sleep(round(s * 1000));
}
static public float[] newFloatArray(int n) {
return new float[n];
}
static public long nanoTime() {
return System.nanoTime();
}
static public List reversed(Iterable l) {
return reversedList(l);
}
static public List reversed(A[] l) {
return reversedList(asList(l));
}
static public String reversed(String s) {
return reversedString(s);
}
static public AutoCloseable tempAdd(Collection l, A a) {
if (l == null || l.contains(a))
return null;
l.add(a);
return new tempAdd_undo(l, a);
}
static public class tempAdd_undo implements AutoCloseable, IFieldsToList {
public Collection l;
public A a;
public tempAdd_undo() {
}
public tempAdd_undo(Collection l, A a) {
this.a = a;
this.l = l;
}
public String toString() {
return shortClassName_dropNumberPrefix(this) + "(" + l + ", " + a + ")";
}
public Object[] _fieldsToList() {
return new Object[] { l, a };
}
public void close() {
try {
l.remove(a);
} catch (Exception __e) {
throw rethrow(__e);
}
}
}
static public AutoCloseable tempAdd(Container a, Component b) {
if (a == null || b == null)
return null;
{
return swing(() -> {
if (b.getParent() == a)
return null;
a.add(b);
return () -> {
swing(() -> {
if (b.getParent() == a)
removeFromParent(b);
});
};
});
}
}
static public String concatStrings(Object... l) {
return join("", l);
}
static public String concatStrings(Iterable l) {
return join("", l);
}
static public BigInteger plus(BigInteger a, BigInteger b) {
return a.add(b);
}
static public BigInteger plus(BigInteger a, long b) {
return a.add(bigint(b));
}
static public long plus(long a, long b) {
return a + b;
}
static public int plus(int a, int b) {
return a + b;
}
static public float plus(float a, float b) {
return a + b;
}
static public double plus(double a, double b) {
return a + b;
}
static public List minus(Collection a, Object... b) {
Set set = asSet(b);
List l = new ArrayList();
for (Object s : unnull(a)) if (!set.contains(s))
l.add(s);
return l;
}
static public BigInteger minus(BigInteger a, BigInteger b) {
return a.subtract(b);
}
static public Complex minus(Complex c) {
return c == null ? null : complex(-c.re(), -c.im());
}
static public int minus(int a, int b) {
return a - b;
}
static public int minus(int a) {
return -a;
}
static public double minus(double a, double b) {
return a - b;
}
static public double minus(double a) {
return -a;
}
static public long minus(long a, long b) {
return a - b;
}
static public long minus(long a) {
return -a;
}
static public boolean lessThan(int a, int b) {
return a < b;
}
static public boolean lessThan(double a, double b) {
return a < b;
}
static public boolean lessThan(Object a, Object b) {
return cmp(a, b) < 0;
}
static public boolean greaterThan(Object a, Object b) {
return cmp(a, b) > 0;
}
static public boolean greaterThan(int a, int b) {
return a > b;
}
static public boolean greaterThan(double a, double b) {
return a > b;
}
static public BufferedImage newImage(int w, int h) {
return whiteImage(w, h);
}
static public BufferedImage newImage(int w, Color color) {
return newImage(w, w, color);
}
static public BufferedImage newImage(int w, int h, Color color) {
return bufferedImage(w, h, color);
}
static public BufferedImage newImage(int size) {
return whiteImage(size);
}
static public BufferedImage newImage(Pt size) {
return whiteImage(size.x, size.y);
}
static public BufferedImage newImage(WidthAndHeight size) {
return whiteImage(size.w(), size.h());
}
static public BufferedImage newImage(Dimension size) {
return whiteImage(size.width, size.height);
}
static public Rect randomRect(Rect outer) {
var w = random_incl(outer.w);
var h = random_incl(outer.h);
return randomRect(w, h, outer);
}
static public Rect randomRect(int w, int h, Rect outer) {
return translateRect(outer.x, outer.y, randomRect(outer.w, outer.h, 0, w, h));
}
static public Rect randomRect(Rect outer, int w, int h) {
return randomRect(w, h, outer);
}
static public Rect randomRect(int w, int h, int rw, int rh) {
return randomRect(w, h, 0, rw, rh);
}
static public Rect randomRect(int w, int h, int border, int rw, int rh) {
if (rw > w - border * 2 || rh > h - border * 2)
return null;
int ww = random(border, w - border - rw);
int hh = random(border, h - border - rh);
return new Rect(ww, hh, rw, rh);
}
static public Rect randomRect(int w, int h) {
int rw = random(w);
int rh = random(h);
return randomRect(w, h, 0, rw, rh);
}
static public Rect randomRect(RGBImage img, int rw, int rh) {
return randomRect(img.w(), img.h(), 0, rw, rh);
}
static public Rect randomRect(RGBImage img) {
return randomRect(img.w(), img.h());
}
static public Rect randomRect() {
return randomRect(currentImage().getWidth(), currentImage().getHeight());
}
static public Rect randomRect(BufferedImage img, int rw, int rh) {
return randomRect(img.getWidth(), img.getHeight(), 0, rw, rh);
}
static public long longPlus(long a, long b) {
return a + b;
}
static public int intSum(Collection c, String field) {
int sum = 0;
for (Object o : unnull(c)) sum += toInt(getOpt(o, field));
return sum;
}
static public int intSum(Iterable l) {
int sum = 0;
for (Integer i : unnull(l)) if (i != null)
sum += i;
return sum;
}
static public int intSum(int... l) {
int sum = 0;
for (int i : unnull(l)) sum += i;
return sum;
}
static public List repF(int n, Object f, Object... args) {
List l = emptyList(n);
for (int i = 0; i < n; i++) l.add(callF(f, args));
return l;
}
static public List repF(Object f, int n) {
return repF(n, f);
}
static public List repF(int n, IF0 f) {
List l = emptyList(n);
for (int i = 0; i < n; i++) l.add(f.get());
return l;
}
static public List repF(IF0 f, int n) {
return repF(n, f);
}
static public IterableIterator iota(final int n) {
return new IterableIterator() {
public int i = 0;
public boolean hasNext() {
return i < n;
}
public Integer next() {
return ++i;
}
};
}
static public > C assertContains(C c, A y) {
return assertContains(null, c, y);
}
static public > C assertContains(String msg, C c, A y) {
if (!contains(c, y))
throw fail((msg != null ? msg + ": " : "") + y + " not contained in " + c);
return c;
}
static public String assertContains(String a, String b) {
if (!contains(a, b))
throw fail(quote(b) + " not contained in " + quote(a));
return a;
}
static public void assertNotEquals(String msg, Object a, Object b) {
if (eq(a, b))
throw fail(msg);
}
static public void assertNotEquals(Object a, Object b) {
if (eq(a, b))
throw fail(str(a));
}
static public File userDir() {
return new File(userHome());
}
static public File userDir(String path) {
return new File(userHome(), path);
}
static public String f2s(File f) {
return f == null ? null : f.getAbsolutePath();
}
static public String f2s(String s) {
return f2s(newFile(s));
}
static public String f2s(java.nio.file.Path p) {
return p == null ? null : f2s(p.toFile());
}
static public File newFile(File base, String... names) {
for (String name : names) base = new File(base, name);
return base;
}
static public File newFile(String name) {
return name == null ? null : new File(name);
}
static public File newFile(String base, String... names) {
return newFile(newFile(base), names);
}
static public List ll(A... a) {
ArrayList l = new ArrayList(a.length);
if (a != null)
for (A x : a) l.add(x);
return l;
}
static public void assertEmpty(Object o) {
if (!empty(o))
throw fail("not empty: " + o);
}
static public A assertEqualsVerbose(Object x, A y) {
assertEqualsVerbose((String) null, x, y);
return y;
}
static public A assertEqualsVerbose(String msg, Object x, A y) {
if (!eq(x, y)) {
throw fail((nempty(msg) ? msg + ": " : "") + "expected: " + x + ", got: " + y);
} else
print("OK" + (empty(msg) ? "" : " " + msg) + ": " + (x));
return y;
}
static public void assertEqualsVerbose(Scorer scorer, Object x, Object y) {
assertEqualsVerbose(scorer, "", x, y);
}
static public void assertEqualsVerbose(Scorer scorer, String msg, Object x, Object y) {
if (scorer == null) {
assertEqualsVerbose(x, y);
return;
}
if (!eq(x, y)) {
print(appendColonIfNempty(msg) + y + " != " + x);
scorer.add(false);
} else {
print("OK: " + appendColonIfNempty(msg) + x);
scorer.add(true);
}
}
static public void assertFalseVerbose(Object o) {
assertEqualsVerbose(false, o);
}
static public void assertFalseVerbose(String msg, Object o) {
assertEqualsVerbose(msg, false, o);
}
static public boolean contains(Collection c, Object o) {
return c != null && c.contains(o);
}
static public boolean contains(Iterable it, Object a) {
if (it != null)
for (Object o : it) if (eq(a, o))
return true;
return false;
}
static public boolean contains(Object[] x, Object o) {
if (x != null)
for (Object a : x) if (eq(a, o))
return true;
return false;
}
static public boolean contains(String s, char c) {
return s != null && s.indexOf(c) >= 0;
}
static public boolean contains(String s, String b) {
return s != null && s.indexOf(b) >= 0;
}
static public boolean contains(BitSet bs, int i) {
return bs != null && bs.get(i);
}
static public boolean contains(Producer p, A a) {
if (p != null && a != null)
while (true) {
A x = p.next();
if (x == null)
break;
if (eq(x, a))
return true;
}
return false;
}
static public boolean contains(Rect r, Pt p) {
return rectContains(r, p);
}
static public void assertContainsAll(Collection extends A> a, Collection b) {
for (var x : unnullForIteration(b)) if (!contains(a, x))
throw fail("Collection doesn't contain " + x + ": " + str_shorten(a));
}
static public A printQuoted(A a) {
return printQuoted("", a);
}
static public A printQuoted(String prefix, A a) {
return printQuote(prefix, a);
}
static public A pnlReversed(A l) {
return pnlReversed("", l);
}
static public A pnlReversed(String prefix, A l) {
if (l != null) {
List list = reversed(l);
int i = l(list);
for (Object a : list) print(prefix + (i--) + ". " + str(a));
}
return l;
}
static public List takeFirst(List l, int n) {
return l(l) <= n ? l : newSubListOrSame(l, 0, n);
}
static public List takeFirst(int n, List l) {
return takeFirst(l, n);
}
static public String takeFirst(int n, String s) {
return substring(s, 0, n);
}
static public String takeFirst(String s, int n) {
return substring(s, 0, n);
}
static public CharSequence takeFirst(int n, CharSequence s) {
return subCharSequence(s, 0, n);
}
static public List takeFirst(int n, Iterator it) {
if (it == null)
return null;
List l = new ArrayList();
for (int _repeat_0 = 0; _repeat_0 < n; _repeat_0++) {
if (it.hasNext())
l.add(it.next());
else
break;
}
return l;
}
static public List takeFirst(int n, Iterable i) {
if (i == null)
return null;
return i == null ? null : takeFirst(n, i.iterator());
}
static public List takeFirst(int n, IterableIterator i) {
return takeFirst(n, (Iterator) i);
}
static public int[] takeFirst(int n, int[] a) {
return takeFirstOfIntArray(n, a);
}
static public short[] takeFirst(int n, short[] a) {
return takeFirstOfShortArray(n, a);
}
static public byte[] takeFirst(int n, byte[] a) {
return takeFirstOfByteArray(n, a);
}
static public byte[] takeFirst(byte[] a, int n) {
return takeFirstOfByteArray(n, a);
}
static public double[] takeFirst(int n, double[] a) {
return takeFirstOfDoubleArray(n, a);
}
static public double[] takeFirst(double[] a, int n) {
return takeFirstOfDoubleArray(n, a);
}
static public A assertEquals(Object x, A y) {
return assertEquals("", x, y);
}
static public A assertEquals(String msg, Object x, A y) {
if (assertVerbose())
return assertEqualsVerbose(msg, x, y);
if (!(x == null ? y == null : x.equals(y)))
throw fail((msg != null ? msg + ": " : "") + y + " != " + x);
return y;
}
static public void assertEquals(Scorer scorer, Object x, Object y) {
assertEquals(scorer, "", x, y);
}
static public void assertEquals(Scorer scorer, String msg, Object x, Object y) {
if (scorer == null) {
assertEquals(msg, x, y);
return;
}
scorer.add(eq(x, y), nullIfEmpty(msg));
}
static public int indexOf(List l, A a, int startIndex) {
if (l == null)
return -1;
int n = l(l);
for (int i = startIndex; i < n; i++) if (eq(l.get(i), a))
return i;
return -1;
}
static public int indexOf(List l, int startIndex, A a) {
return indexOf(l, a, startIndex);
}
static public int indexOf(List l, A a) {
if (l == null)
return -1;
return l.indexOf(a);
}
static public int indexOf(String a, String b) {
return a == null || b == null ? -1 : a.indexOf(b);
}
static public int indexOf(String a, String b, int i) {
return a == null || b == null ? -1 : a.indexOf(b, i);
}
static public int indexOf(String a, char b) {
return a == null ? -1 : a.indexOf(b);
}
static public int indexOf(String a, int i, char b) {
return indexOf(a, b, i);
}
static public int indexOf(String a, char b, int i) {
return a == null ? -1 : a.indexOf(b, i);
}
static public int indexOf(String a, int i, String b) {
return a == null || b == null ? -1 : a.indexOf(b, i);
}
static public int indexOf(A[] x, A a) {
int n = l(x);
for (int i = 0; i < n; i++) if (eq(x[i], a))
return i;
return -1;
}
static public int indexOf(Iterable l, A a) {
if (l == null)
return -1;
int i = 0;
for (A x : l) {
if (eq(x, a))
return i;
i++;
}
return -1;
}
static volatile public StringBuffer local_log = new StringBuffer();
static public boolean printAlsoToSystemOut = true;
static volatile public Appendable print_log = local_log;
static volatile public int print_log_max = 1024 * 1024;
static volatile public int local_log_max = 100 * 1024;
static public boolean print_silent = false;
static public Object print_byThread_lock = new Object();
static volatile public ThreadLocal