public int getColumnType(int column) { if (dateColumns[column]) return DATE; else return super.getColumnType(column); }
public int getColumnType(String columnName) { return table.getColumnType(columnName); }
public int getColumnType(int column) { return table.getColumnType(column); }
public int getColumnType(String columnName) { return table.getColumnType(columnName); }
public int getColumnType(int column) { return table.getColumnType(column); }
public int getColumnType(String columnName) { return getColumnType(getColumnIndex(columnName)); }
public int getColumnType(String columnName) { return getColumnType(getColumnIndex(columnName)); }
static protected boolean isDateColumn(Table table, int i, String missing) { if (table.getColumnType(i) == Table.STRING || table.getColumnType(i) == Table.CATEGORY) { int totCount = 0; int dateCount = 0; for (int n = 0; n < table.getRowCount(); n++) { TableRow row = table.getRow(n); String value = row.getString(i); if (value == null || value.equals(missing)) continue; if (supportedDateString(value)) dateCount++; totCount++; if (totCount == 10) break; } float frac = (float)dateCount / (float)totCount; return 0.5f < frac; } else { return false; } }
static protected int guessColumnType(Table table, int i, String missing) { int type0 = table.getColumnType(i); if (table.getColumnType(i) != Table.STRING) return type0;
@Override public float compare(int index1, int index2) { int a = reverse ? order[index2] : order[index1]; int b = reverse ? order[index1] : order[index2]; switch (getColumnType(column)) { case INT: return getInt(a, column) - getInt(b, column); case LONG: return getLong(a, column) - getLong(b, column); case FLOAT: return getFloat(a, column) - getFloat(b, column); case DOUBLE: return (float) (getDouble(a, column) - getDouble(b, column)); case STRING: return getString(a, column).compareToIgnoreCase(getString(b, column)); case CATEGORY: return getInt(a, column) - getInt(b, column); default: throw new IllegalArgumentException("Invalid column type: " + getColumnType(column)); } }
@Override public float compare(int index1, int index2) { int a = reverse ? order[index2] : order[index1]; int b = reverse ? order[index1] : order[index2]; switch (getColumnType(column)) { case INT: return getInt(a, column) - getInt(b, column); case LONG: return getLong(a, column) - getLong(b, column); case FLOAT: return getFloat(a, column) - getFloat(b, column); case DOUBLE: return (float) (getDouble(a, column) - getDouble(b, column)); case STRING: return getString(a, column).compareToIgnoreCase(getString(b, column)); case CATEGORY: return getInt(a, column) - getInt(b, column); default: throw new IllegalArgumentException("Invalid column type: " + getColumnType(column)); } }
switch (getColumnType(col)) { case INT: case CATEGORY:
switch (getColumnType(col)) { case INT: case CATEGORY: