");
for (int col = 0; col < getColumnCount(); col++) {
- String entry = getString(row, col);
+ String entry = get(row, col);
writer.print(" ");
writeEntryHTML(writer, entry);
// String clean = (entry == null) ? "" : HTMLFairy.encodeEntities(entry);
@@ -819,7 +819,7 @@ public class Table implements Iterable {
public void setColumnType(String columnName, String columnType) {
- setColumnType(getColumnIndex(columnName), columnType);
+ setColumnType(checkColumnIndex(columnName), columnType);
}
@@ -850,7 +850,7 @@ public class Table implements Iterable {
protected void setColumnType(String columnName, int newType) {
- setColumnType(getColumnIndex(columnName), newType);
+ setColumnType(checkColumnIndex(columnName), newType);
}
@@ -865,7 +865,7 @@ public class Table implements Iterable {
case INT: {
int[] intData = new int[rowCount];
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
intData[row] = PApplet.parseInt(s, missingInt);
}
columns[column] = intData;
@@ -874,7 +874,7 @@ public class Table implements Iterable {
case LONG: {
long[] longData = new long[rowCount];
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
try {
longData[row] = Long.parseLong(s);
} catch (NumberFormatException nfe) {
@@ -887,7 +887,7 @@ public class Table implements Iterable {
case FLOAT: {
float[] floatData = new float[rowCount];
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
floatData[row] = PApplet.parseFloat(s, missingFloat);
}
columns[column] = floatData;
@@ -896,7 +896,7 @@ public class Table implements Iterable {
case DOUBLE: {
double[] doubleData = new double[rowCount];
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
try {
doubleData[row] = Double.parseDouble(s);
} catch (NumberFormatException nfe) {
@@ -910,7 +910,7 @@ public class Table implements Iterable {
if (columnTypes[column] != STRING) {
String[] stringData = new String[rowCount];
for (int row = 0; row < rowCount; row++) {
- stringData[row] = getString(row, column);
+ stringData[row] = get(row, column);
}
columns[column] = stringData;
}
@@ -920,7 +920,7 @@ public class Table implements Iterable {
int[] indexData = new int[rowCount];
HashMapBlows categories = new HashMapBlows();
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
indexData[row] = categories.index(s);
}
columnCategories[column] = categories;
@@ -955,7 +955,7 @@ public class Table implements Iterable {
setColumnTitles(dictionary.getStringColumn(0));
if (dictionary.getColumnCount() > 1) {
for (int i = 0; i < dictionary.getRowCount(); i++) {
- setColumnType(i, dictionary.getString(i, 1));
+ setColumnType(i, dictionary.get(i, 1));
}
}
}
@@ -1017,7 +1017,9 @@ public class Table implements Iterable {
*/
protected int getColumnIndex(String name, boolean report) {
if (columnTitles == null) {
- System.err.println("Can't get column indices because no column titles are set.");
+ if (report) {
+ System.err.println("Can't get column indices because no column titles are set.");
+ }
return -1;
}
// only create this on first get(). subsequent calls to set the title will
@@ -1359,21 +1361,6 @@ public class Table implements Iterable {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- public interface Row {
-
- public String getString(int column);
- public String getString(String columnName);
- public int getInt(int column);
- public int getInt(String columnName);
- public long getLong(int column);
- public long getLong(String columnName);
- public float getFloat(int column);
- public float getFloat(String columnName);
- public double getDouble(int column);
- public double getDouble(String columnName);
- }
-
-
protected RowIterator rowIterator;
/**
@@ -1381,7 +1368,7 @@ public class Table implements Iterable {
* rows of this table. This is very efficient, but not very thread-safe. If
* you want to iterate in a multi-threaded manner, use createIterator().
*/
- public Iterator iterator() {
+ public Iterator iterator() {
if (rowIterator == null) {
rowIterator = new RowIterator();
}
@@ -1390,7 +1377,7 @@ public class Table implements Iterable {
}
- public Iterator createIterator() {
+ public Iterator createIterator() {
return new RowIterator();
}
@@ -1401,15 +1388,15 @@ public class Table implements Iterable {
// }
- class RowIterator implements Iterator {
+ class RowIterator implements Iterator {
int row;
- Row tableRow = new Row() {
- public String getString(int column) {
- return Table.this.getString(row, column);
+ TableRow tableRow = new TableRow() {
+ public String get(int column) {
+ return Table.this.get(row, column);
}
- public String getString(String columnName) {
- return Table.this.getString(row, columnName);
+ public String get(String columnName) {
+ return Table.this.get(row, columnName);
}
public int getInt(int column) {
@@ -1449,7 +1436,7 @@ public class Table implements Iterable {
removeRow(row);
}
- public Row next() {
+ public TableRow next() {
++row;
// iteratorRow.setRow(row);
// return iteratorRow;
@@ -1466,8 +1453,8 @@ public class Table implements Iterable {
}
- static public Iterator createIterator(final ResultSet rs) {
- return new Iterator() {
+ static public Iterator createIterator(final ResultSet rs) {
+ return new Iterator() {
boolean already;
public boolean hasNext() {
@@ -1480,7 +1467,7 @@ public class Table implements Iterable {
}
- public Row next() {
+ public TableRow next() {
if (!already) {
try {
rs.next();
@@ -1491,7 +1478,7 @@ public class Table implements Iterable {
already = false;
}
- return new Row() {
+ return new TableRow() {
public double getDouble(int column) {
try {
return rs.getDouble(column);
@@ -1556,7 +1543,7 @@ public class Table implements Iterable {
}
}
- public String getString(int column) {
+ public String get(int column) {
try {
return rs.getString(column);
} catch (SQLException e) {
@@ -1564,7 +1551,7 @@ public class Table implements Iterable {
}
}
- public String getString(String columnName) {
+ public String get(String columnName) {
try {
return rs.getString(columnName);
} catch (SQLException e) {
@@ -1590,7 +1577,7 @@ public class Table implements Iterable {
int[] intData = (int[]) columns[column];
return intData[row];
}
- String str = getString(row, column);
+ String str = get(row, column);
return (str == null || str.equals(missingString)) ?
missingInt : PApplet.parseInt(str, missingInt);
}
@@ -1608,7 +1595,7 @@ public class Table implements Iterable {
public void setInt(int row, int column, int what) {
if (columnTypes[column] == STRING) {
- setString(row, column, String.valueOf(what));
+ set(row, column, String.valueOf(what));
} else {
checkSize(row, column);
@@ -1654,7 +1641,7 @@ public class Table implements Iterable {
long[] longData = (long[]) columns[column];
return longData[row];
}
- String str = getString(row, column);
+ String str = get(row, column);
if (str == null || str.equals(missingString)) {
return missingLong;
}
@@ -1678,7 +1665,7 @@ public class Table implements Iterable {
public void setLong(int row, int column, long what) {
if (columnTypes[column] == STRING) {
- setString(row, column, String.valueOf(what));
+ set(row, column, String.valueOf(what));
} else {
checkSize(row, column);
@@ -1729,7 +1716,7 @@ public class Table implements Iterable {
float[] floatData = (float[]) columns[column];
return floatData[row];
}
- String str = getString(row, column);
+ String str = get(row, column);
if (str == null || str.equals(missingString)) {
return missingFloat;
}
@@ -1749,7 +1736,7 @@ public class Table implements Iterable {
public void setFloat(int row, int column, float what) {
if (columnTypes[column] == STRING) {
- setString(row, column, String.valueOf(what));
+ set(row, column, String.valueOf(what));
} else {
checkSize(row, column);
@@ -1795,7 +1782,7 @@ public class Table implements Iterable {
double[] doubleData = (double[]) columns[column];
return doubleData[row];
}
- String str = getString(row, column);
+ String str = get(row, column);
if (str == null || str.equals(missingString)) {
return missingDouble;
}
@@ -1819,7 +1806,7 @@ public class Table implements Iterable {
public void setDouble(int row, int column, double what) {
if (columnTypes[column] == STRING) {
- setString(row, column, String.valueOf(what));
+ set(row, column, String.valueOf(what));
} else {
checkSize(row, column);
@@ -1868,14 +1855,14 @@ public class Table implements Iterable {
* Returns the time in milliseconds by parsing a SQL Timestamp at this cell.
*/
// public long getTimestamp(int row, int column) {
-// String str = getString(row, column);
+// String str = get(row, column);
// java.sql.Timestamp timestamp = java.sql.Timestamp.valueOf(str);
// return timestamp.getTime();
// }
// public long getExcelTimestamp(int row, int column) {
-// return parseExcelTimestamp(getString(row, column));
+// return parseExcelTimestamp(get(row, column));
// }
@@ -1901,13 +1888,13 @@ public class Table implements Iterable {
// if (value == null) {
// data[row][column] = null;
// } else if (value instanceof String) {
-// setString(row, column, (String) value);
+// set(row, column, (String) value);
// } else if (value instanceof Float) {
// setFloat(row, column, ((Float) value).floatValue());
// } else if (value instanceof Integer) {
// setInt(row, column, ((Integer) value).intValue());
// } else {
-// setString(row, column, value.toString());
+// set(row, column, value.toString());
// }
// }
@@ -1921,7 +1908,7 @@ public class Table implements Iterable {
* @param col
* @return
*/
- public String getString(int row, int col) {
+ public String get(int row, int col) {
checkBounds(row, col);
if (columnTypes[col] == STRING) {
String[] stringData = (String[]) columns[col];
@@ -1935,8 +1922,8 @@ public class Table implements Iterable {
}
- public String getString(int row, String columnName) {
- return getString(row, getColumnIndex(columnName));
+ public String get(int row, String columnName) {
+ return get(row, getColumnIndex(columnName));
}
@@ -1945,7 +1932,7 @@ public class Table implements Iterable {
}
- public void setString(int row, int column, String what) {
+ public void set(int row, int column, String what) {
checkSize(row, column);
if (columnTypes[column] != STRING) {
throw new IllegalArgumentException("Column " + column + " is not a String column.");
@@ -1955,9 +1942,9 @@ public class Table implements Iterable {
}
- public void setString(int row, String columnName, String what) {
- int column = getColumnIndex(columnName);
- setString(row, column, what);
+ public void set(int row, String columnName, String what) {
+ int column = checkColumnIndex(columnName);
+ set(row, column, what);
}
@@ -1970,7 +1957,7 @@ public class Table implements Iterable {
public String[] getStringColumn(int col) {
String[] outgoing = new String[rowCount];
for (int i = 0; i < rowCount; i++) {
- outgoing[i] = getString(i, col);
+ outgoing[i] = get(i, col);
}
return outgoing;
}
@@ -1979,7 +1966,7 @@ public class Table implements Iterable {
public String[] getStringRow(int row) {
String[] outgoing = new String[columns.length];
for (int col = 0; col < columns.length; col++) {
- outgoing[col] = getString(row, col);
+ outgoing[col] = get(row, col);
}
return outgoing;
}
@@ -2073,7 +2060,7 @@ public class Table implements Iterable {
*/
public void removeTokens(String tokens, int column) {
for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
+ String s = get(row, column);
if (s != null) {
char[] c = s.toCharArray();
int index = 0;
@@ -2086,7 +2073,7 @@ public class Table implements Iterable {
}
}
if (index != c.length) {
- setString(row, column, new String(c, 0, index));
+ set(row, column, new String(c, 0, index));
}
}
}
@@ -2130,7 +2117,7 @@ public class Table implements Iterable {
}
} else { // less efficient, includes conversion as necessary
for (int row = 0; row < rowCount; row++) {
- String str = getString(row, column);
+ String str = get(row, column);
if (str == null) {
if (what == null) {
return row;
@@ -2182,7 +2169,7 @@ public class Table implements Iterable {
}
} else { // less efficient, includes conversion as necessary
for (int row = 0; row < rowCount; row++) {
- String str = getString(row, column);
+ String str = get(row, column);
if (str == null) {
if (what == null) {
outgoing[count++] = row;
@@ -2227,7 +2214,7 @@ public class Table implements Iterable {
}
} else { // less efficient, includes conversion as necessary
for (int row = 0; row < rowCount; row++) {
- String str = getString(row, column);
+ String str = get(row, column);
if (str != null &&
PApplet.match(str, regexp) != null) {
return row;
@@ -2269,7 +2256,7 @@ public class Table implements Iterable {
}
} else { // less efficient, includes conversion as necessary
for (int row = 0; row < rowCount; row++) {
- String str = getString(row, column);
+ String str = get(row, column);
if (str != null &&
PApplet.match(str, regexp) != null) {
outgoing[count++] = row;
@@ -2372,7 +2359,7 @@ public class Table implements Iterable {
int row = rowSubset[i];
for (int col = 0; col < columns.length; col++) {
switch (columnTypes[col]) {
- case STRING: newbie.setString(i, col, getString(row, col)); break;
+ case STRING: newbie.set(i, col, get(row, col)); break;
case INT: newbie.setInt(i, col, getInt(row, col)); break;
case LONG: newbie.setLong(i, col, getLong(row, col)); break;
case FLOAT: newbie.setFloat(i, col, getFloat(row, col)); break;
@@ -2387,11 +2374,6 @@ public class Table implements Iterable {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- public String[] getUniqueEntries(String column) {
- return getUniqueEntries(getColumnIndex(column));
- }
-
-
class HashMapBlows {
HashMap dataToIndex = new HashMap();
ArrayList indexToData = new ArrayList();
@@ -2476,10 +2458,15 @@ public class Table implements Iterable {
}
- public String[] getUniqueEntries(int column) {
+ public String[] getUnique(String column) {
+ return getUnique(getColumnIndex(column));
+ }
+
+
+ public String[] getUnique(int column) {
HashMapSucks found = new HashMapSucks();
for (int row = 0; row < getRowCount(); row++) {
- found.check(getString(row, column));
+ found.check(get(row, column));
}
String[] outgoing = new String[found.size()];
found.keySet().toArray(outgoing);
@@ -2487,15 +2474,15 @@ public class Table implements Iterable {
}
- public HashMap getStringCount(String columnName) {
- return getStringCount(getColumnIndex(columnName));
+ public HashMap getUniqueCount(String columnName) {
+ return getUniqueCount(getColumnIndex(columnName));
}
- public HashMap getStringCount(int column) {
+ public HashMap getUniqueCount(int column) {
HashMapSucks outgoing = new HashMapSucks();
for (int row = 0; row < rowCount; row++) {
- String entry = getString(row, column);
+ String entry = get(row, column);
if (entry != null) {
outgoing.increment(entry);
}
@@ -2513,7 +2500,7 @@ public class Table implements Iterable {
public HashMap getRowLookup(int col) {
HashMap outgoing = new HashMap();
for (int row = 0; row < getRowCount(); row++) {
- outgoing.put(getString(row, col), row);
+ outgoing.put(get(row, col), row);
}
return outgoing;
}
@@ -2553,7 +2540,7 @@ public class Table implements Iterable {
// } else if (columnTypes[col2] == STRING) {
// outgoing = new HashMap();
// for (int row = 0; row < getRowCount(); row++) {
-// outgoing.put(getInt(row, col1), getString(row, col2));
+// outgoing.put(getInt(row, col1), get(row, col2));
// }
// }
// break;
diff --git a/android/core/src/processing/data/XML.java b/android/core/src/processing/data/XML.java
index 5699d0808..60cabfe03 100644
--- a/android/core/src/processing/data/XML.java
+++ b/android/core/src/processing/data/XML.java
@@ -68,6 +68,11 @@ public class XML implements Serializable {
}
+ public XML(File file) {
+ this(PApplet.createReader(file));
+ }
+
+
public XML(Reader reader) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
diff --git a/android/todo.txt b/android/todo.txt
index d34d996a0..8d276ad71 100644
--- a/android/todo.txt
+++ b/android/todo.txt
@@ -9,8 +9,13 @@ _ docs: P2D and P3D are now OpenGL variations
andres
A GL2 specific code in Processing 2.0a5 break P3D on GLES2 hardware
A http://code.google.com/p/processing/issues/detail?id=1029
-X OpenGL/ES requires precision specifier on float types
-X http://code.google.com/p/processing/issues/detail?id=1035
+A OpenGL/ES requires precision specifier on float types
+A http://code.google.com/p/processing/issues/detail?id=1035
+A loadshape with obj file broken in 2.05a android mode.
+A http://code.google.com/p/processing/issues/detail?id=1048
+A camera() and arc() don't work together
+A http://code.google.com/p/processing/issues/detail?id=751
+
_ Android OPENGL renderer + JAVA2D PGraphics results in PTexture exception
_ http://code.google.com/p/processing/issues/detail?id=1019
@@ -20,6 +25,8 @@ X http://code.google.com/p/processing/issues/detail?id=214
X remove unnecessary processing.xml.* code from android-core
X http://code.google.com/p/processing/issues/detail?id=214
+_ sketch names cannot start with underscore
+_ http://code.google.com/p/processing/issues/detail?id=1047
_ Android mode is broken on Windows in Processing 2.0a5
_ file a bug for this w/ Google
|