diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 1ce98dd73..9f3762fe1 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -12136,7 +12136,7 @@ public class PApplet extends Applet * @param fovy field-of-view angle (in radians) for vertical direction * @param aspect ratio of width to height * @param zNear z-position of nearest clipping plane - * @param zFar z-position of farthest clipping plane + * @param zFar z-position of nearest farthest plane */ public void perspective(float fovy, float aspect, float zNear, float zFar) { if (recorder != null) recorder.perspective(fovy, aspect, zNear, zFar); diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java index 7bcfbb8d4..cb1d98215 100644 --- a/core/src/processing/core/PConstants.java +++ b/core/src/processing/core/PConstants.java @@ -142,7 +142,7 @@ public interface PConstants { static final String DXF = "processing.dxf.RawDXF"; static final String LWJGL = "processing.lwjgl.PGraphicsLWJGL"; - + // platform IDs for PApplet.platform static final int OTHER = 0; diff --git a/core/src/processing/core/Table.java b/core/src/processing/core/Table.java index df929b630..290beccce 100644 --- a/core/src/processing/core/Table.java +++ b/core/src/processing/core/Table.java @@ -49,7 +49,6 @@ import processing.core.PApplet; //

By default, empty rows are skipped and so are lines that start with the // # character. Using # at the beginning of a line indicates a comment.

-//TODO: handling categorical, time /** *

Generic class for handling tabular data, typically from a CSV, TSV, or @@ -91,14 +90,13 @@ public class Table implements Iterable { protected Object[] columns; // [column] // typed data - public static final int UNSUPPORTED = -1; - public static final int STRING = 0; - public static final int INT = 1; - public static final int LONG = 2; - public static final int FLOAT = 3; - public static final int DOUBLE = 4; - public static final int CATEGORICAL = 5; - public static final int TIME = 6; + static final int STRING = 0; + static final int INT = 1; + static final int LONG = 2; + static final int FLOAT = 3; + static final int DOUBLE = 4; + static final int CATEGORICAL = 5; +// static final int TIME = 5; int[] columnTypes; // int[][] intData; // [column][row] @@ -772,7 +770,6 @@ public class Table implements Iterable { case DOUBLE: columns[index] = new double[rowCount]; break; case STRING: columns[index] = new String[rowCount]; break; case CATEGORICAL: columns[index] = new int[rowCount]; break; - case TIME: columns[index] = new long[rowCount]; break; } } @@ -819,14 +816,7 @@ public class Table implements Iterable { } } - public int getColumnType(String columnName) { - return getColumnType(getColumnIndex(columnName)); - } - - public int getColumnType(int col) { - return columnTypes[col]; - } - + public void setColumnType(String columnName, String columnType) { setColumnType(getColumnIndex(columnName), columnType); } @@ -2401,19 +2391,11 @@ public class Table implements Iterable { } - static public class HashMapBlows { - protected HashMap dataToIndex = new HashMap(); - protected ArrayList indexToData = new ArrayList(); + class HashMapBlows { + HashMap dataToIndex = new HashMap(); + ArrayList indexToData = new ArrayList(); - public boolean containsKey(String key) { - return dataToIndex.containsKey(key); - } - - public boolean containsIndex(int index) { - return dataToIndex.containsValue(index); - } - - public int index(String key) { + int index(String key) { Integer value = dataToIndex.get(key); if (value != null) { return value; @@ -2425,29 +2407,22 @@ public class Table implements Iterable { return v; } - public String key(int index) { + String key(int index) { return indexToData.get(index); } - public int size() { + int size() { return dataToIndex.size(); } - public void put(HashMapBlows src) { - this.dataToIndex.clear(); - this.dataToIndex.putAll(src.dataToIndex); - this.indexToData.clear(); - this.indexToData.addAll(src.indexToData); - } - - public void write(DataOutputStream output) throws IOException { + void write(DataOutputStream output) throws IOException { output.writeInt(size()); for (String str : indexToData) { output.writeUTF(str); } } - public void writeln(PrintWriter writer) throws IOException { + void writeln(PrintWriter writer) throws IOException { for (String str : indexToData) { writer.println(str); } @@ -2455,7 +2430,7 @@ public class Table implements Iterable { writer.close(); } - public void read(DataInputStream input) throws IOException { + void read(DataInputStream input) throws IOException { int count = input.readInt(); dataToIndex = new HashMap(count); for (int i = 0; i < count; i++) { @@ -2481,7 +2456,7 @@ public class Table implements Iterable { // } - public class HashMapSucks extends HashMap { + class HashMapSucks extends HashMap { void increment(String what) { Integer value = get(what); @@ -2653,142 +2628,4 @@ public class Table implements Iterable { } } } - - //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - - static public final int min(int[] list) { - return PApplet.min(list); - } - - - static public final long min(long[] list) { - if (list.length == 0) { - throw new ArrayIndexOutOfBoundsException(PApplet.ERROR_MIN_MAX); - } - long min = list[0]; - for (int i = 1; i < list.length; i++) { - if (list[i] < min) min = list[i]; - } - return min; - } - - - static public final float min(float[] list) { - return PApplet.min(list); - } - - - static public final double min(double[] list) { - if (list.length == 0) { - throw new ArrayIndexOutOfBoundsException(PApplet.ERROR_MIN_MAX); - } - double min = list[0]; - for (int i = 1; i < list.length; i++) { - if (list[i] < min) min = list[i]; - } - return min; - } - - - static public final int max(int[] list) { - return PApplet.max(list); - } - - - static public final long max(long[] list) { - if (list.length == 0) { - throw new ArrayIndexOutOfBoundsException(PApplet.ERROR_MIN_MAX); - } - long max = list[0]; - for (int i = 1; i < list.length; i++) { - if (max < list[i]) max = list[i]; - } - return max; - } - - - static public final float max(float[] list) { - return PApplet.max(list); - } - - - static public final double max(double[] list) { - if (list.length == 0) { - throw new ArrayIndexOutOfBoundsException(PApplet.ERROR_MIN_MAX); - } - double max = list[0]; - for (int i = 1; i < list.length; i++) { - if (max < list[i]) max = list[i]; - } - return max; - } - - static public int getType(int mysqlType) { - int tableType = UNSUPPORTED; - - switch (mysqlType) { - case Types.TINYINT: - case Types.SMALLINT: - case Types.INTEGER: - tableType = INT; - break; - case Types.BIGINT: - tableType = LONG; - break; - case Types.FLOAT: - tableType = FLOAT; - break; - case Types.DECIMAL: - case Types.DOUBLE: - case Types.REAL: - tableType = DOUBLE; - break; - case Types.CHAR: - case Types.VARCHAR: - tableType = STRING; - break; - case Types.DATE: - case Types.TIME: - tableType = TIME; - break; - } - - return tableType; - } - - - static public int getType(String mysqlType) { - mysqlType = mysqlType.toUpperCase(); - - int type = UNSUPPORTED; - - if (mysqlType.indexOf("INT") == 0 || - mysqlType.equals("INTEGER") || - mysqlType.equals("TINYINT") || - mysqlType.equals("SMALLINT")) { - type = INT; - } else if (mysqlType.equals("BIGINT")) { - type = LONG; - } else if (mysqlType.equals("FLOAT")) { - type = FLOAT; - } else if (mysqlType.equals("DECIMAL") || - mysqlType.equals("DOUBLE") || - mysqlType.equals("REAL")) { - type = DOUBLE; - } else if (mysqlType.indexOf("CHAR") == 0 || - mysqlType.indexOf("VARCHAR") == 0) { - type = STRING; - } else if (mysqlType.indexOf("ENUM") == 0) { - type = CATEGORICAL; - } else if (mysqlType.equals("DATE") || - mysqlType.equals("DATETIME") || - mysqlType.equals("TIMESTAMP") || - mysqlType.equals("TIME") || - mysqlType.equals("YEAR")) { - type = TIME; - } - - return type; - } }