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 android.view.View;
import android.app.Activity;
import android.widget.*;
import android.graphics.*;
import android.app.Activity;
import android.view.*;
import android.widget.*;
import android.content.*;
public class main {
public static void main(final String[] args) throws Exception {
androidUI(new Runnable() { public void run() { try {
AndroidList l;
androidShow((l = new AndroidList(flattenList(repeat(ll("yo", "there", "boy"), 10)))).view());
l.onClick = new Object() { void get(int i) { try {
androidShowText (i);
} catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }}
public String toString() { return "androidShowText (i);"; }};
} catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); } } public String toString() { return "AndroidList l;\n androidShow((l = new AndroidList(flattenList(repeat(ll(\"yo\", \"there\", \"boy\"), 10)))).view());\n l.onClick = new Object { void get(int i) { try {\n \n androidShowText (i);\n \n} catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }}\n public String toString() { return \"androidShowText (i);\"; }};"; }});
}
static List ll(A... a) {
return litlist(a);
}
static void androidUI( final Runnable r) {
androidActivity ().runOnUiThread(r);
}
static String repeat(char c, int n) {
n = max(n, 0);
char[] chars = new char[n];
for (int i = 0; i < n; i++)
chars[i] = c;
return new String(chars);
}
static List repeat(A a, int n) {
List l = new ArrayList();
for (int i = 0; i < n; i++)
l.add(a);
return l;
}
static void androidShow(final View view) {
androidActivity().runOnUiThread(new Runnable() { public void run() { try {
androidActivity().setContentView(view);
} catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); } } public String toString() { return "androidActivity().setContentView(view);"; }});
}
static List flattenList(List a) {
List l = new ArrayList();
for (Object x : a)
if (x instanceof List)
l.addAll(flattenList((List) x));
else
l.add(x);
return l;
}
static void androidShowText(Object o) {
final String s = str(o);
androidUI(new Runnable() { public void run() { try {
TextView tv = (new TextView (androidActivity ()));
tv.setText (s);
androidShow(tv);
} catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); } } public String toString() { return "TextView tv = (new TextView (androidActivity ()));\r\n tv.setText (s);\r\nandroidShow(tv);"; }});
}
static String str(Object o) {
return String.valueOf(o);
}
static String str(char[] c) {
return new String(c);
}
static int max(int a, int b) {
return Math.max(a, b);
}
static int max(int a, int b, int c) {
return max(max(a, b), c);
}
static long max(int a, long b) {
return Math.max((long) a, b);
}
static long max(long a, long b) {
return Math.max(a, b);
}
static double max(int a, double b) {
return Math.max((double) a, b);
}
static float max(float a, float b) {
return Math.max(a, b);
}
static int max(Collection c) {
int x = Integer.MIN_VALUE;
for (int i : c) x = max(x, i);
return x;
}
static double max(double[] c) {
if (c.length == 0) return Double.MIN_VALUE;
double x = c[0];
for (int i = 1; i < c.length; i++) x = Math.max(x, c[i]);
return x;
}
static float max(float[] c) {
if (c.length == 0) return Float.MAX_VALUE;
float x = c[0];
for (int i = 1; i < c.length; i++) x = Math.max(x, c[i]);
return x;
}
static byte max(byte[] c) {
byte x = -128;
for (byte d : c) if (d > x) x = d;
return x;
}
static ArrayList litlist(A... a) {
return new ArrayList(Arrays.asList(a));
}
static Activity androidActivity() {
return (Activity) androidContext_gen();
}
static Object androidContext_gen() {
return getAndroidContext_gen();
}
static Object androidContext;
static Object getAndroidContext_gen() {
return androidContext;
}
static class AndroidList {
ListView lv;
Object onClick;
View view() { return lv; }
AndroidList(List l) {
lv = new ListView(androidActivity());
lv.setAdapter(new MyAdapter(androidActivity (), toStringArray(l)));
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> arg0, View arg1,
int position, long id) {
callF(onClick, position);
}
});
}
class MyAdapter extends ArrayAdapter {
public MyAdapter(Context context, String[] strings) {
super(context, -1, -1, strings);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout listLayout = new LinearLayout(getContext ());
listLayout.setLayoutParams(new AbsListView.LayoutParams(
AbsListView.LayoutParams.FILL_PARENT,
AbsListView.LayoutParams.WRAP_CONTENT));
listLayout.setId(View.generateViewId());
TextView listText = new TextView(getContext());
listText.setId(View.generateViewId());
listLayout.addView(listText);
listText.setText(super.getItem(position));
return listLayout;
}
}
}
static Object callF(Object f, Object... args) {
return callFunction(f, args);
}
static String[] toStringArray(Collection c) {
String[] a = new String[l(c)];
Iterator it = c.iterator();
for (int i = 0; i < l(a); i++)
a[i] = it.next();
return a;
}
static String[] toStringArray(Object o) {
if (o instanceof String[])
return (String[]) o;
else if (o instanceof Collection)
return toStringArray((Collection) o);
else
throw fail("Not a collection or array: " + structure(o));
}
static int getContext_n = 3;
static String getContext(String text, int lineNr) {
List l = new ArrayList();
List lines = toLines(text);
int from = max(0, lineNr-1-getContext_n);
int to = min(l(lines), lineNr+getContext_n);
for (int i = from; i < to; i++)
l.add((i == lineNr-1 ? "* " : ". ") + lines.get(i));
return fromLines(l);
}
static Object callFunction(Object f, Object... args) {
if (f == null) return null;
if (f instanceof Runnable) {
((Runnable) f).run();
return null;
} else if (f instanceof String)
return call(mc(), (String) f, args);
else
return call(f, "get", args);
//else throw fail("Can't call a " + getClassName(f));
}
static String fromLines(List lines) {
StringBuilder buf = new StringBuilder();
if (lines != null)
for (String line : lines)
buf.append(line).append('\n');
return buf.toString();
}
static String fromLines(String... lines) {
return fromLines(asList(lines));
}
static int l(Object[] a) { return a == null ? 0 : a.length; }
static int l(boolean[] a) { return a == null ? 0 : a.length; }
static int l(byte[] a) { return a == null ? 0 : a.length; }
static int l(int[] a) { return a == null ? 0 : a.length; }
static int l(float[] a) { return a == null ? 0 : a.length; }
static int l(char[] a) { return a == null ? 0 : a.length; }
static int l(Collection c) { return c == null ? 0 : c.size(); }
static int l(Map m) { return m == null ? 0 : m.size(); }
static int l(CharSequence s) { return s == null ? 0 : s.length(); } static long l(File f) { return f == null ? 0 : f.length(); }
static int l(Object o) {
return o instanceof String ? l((String) o)
: l((Collection) o); // incomplete
}
static int l(MultiSet ms) { return ms == null ? 0 : ms.size(); }
static boolean structure_showTiming, structure_checkTokenCount;
static String structure(Object o) {
structure_Data d = new structure_Data();
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;
static int structure_shareStringsLongerThan = 20;
static class structure_Data {
PrintWriter out;
int stringSizeLimit;
IdentityHashMap