mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
closing up Table work, moving functions a bit, hide unapproved
This commit is contained in:
@@ -2223,53 +2223,6 @@ public class Table {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Remove any of the specified characters from the entire table.
|
||||
*/
|
||||
public void removeTokens(String tokens) {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
removeTokens(tokens, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removed any of the specified characters from a column. For instance,
|
||||
* the following code removes dollar signs and commas from column 2:
|
||||
* <pre>
|
||||
* table.removeTokens(",$", 2);
|
||||
* </pre>
|
||||
*/
|
||||
public void removeTokens(String tokens, int column) {
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
String s = getString(row, column);
|
||||
if (s != null) {
|
||||
char[] c = s.toCharArray();
|
||||
int index = 0;
|
||||
for (int j = 0; j < c.length; j++) {
|
||||
if (tokens.indexOf(c[j]) == -1) {
|
||||
if (index != j) {
|
||||
c[index] = c[j];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (index != c.length) {
|
||||
setString(row, column, new String(c, 0, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeTokens(String tokens, String columnName) {
|
||||
removeTokens(tokens, getColumnIndex(columnName));
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Return the row that contains the first String that matches.
|
||||
* @param value the String to match
|
||||
@@ -2574,6 +2527,53 @@ public class Table {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Remove any of the specified characters from the entire table.
|
||||
*/
|
||||
public void removeTokens(String tokens) {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
removeTokens(tokens, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removed any of the specified characters from a column. For instance,
|
||||
* the following code removes dollar signs and commas from column 2:
|
||||
* <pre>
|
||||
* table.removeTokens(",$", 2);
|
||||
* </pre>
|
||||
*/
|
||||
public void removeTokens(String tokens, int column) {
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
String s = getString(row, column);
|
||||
if (s != null) {
|
||||
char[] c = s.toCharArray();
|
||||
int index = 0;
|
||||
for (int j = 0; j < c.length; j++) {
|
||||
if (tokens.indexOf(c[j]) == -1) {
|
||||
if (index != j) {
|
||||
c[index] = c[j];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (index != c.length) {
|
||||
setString(row, column, new String(c, 0, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeTokens(String tokens, String columnName) {
|
||||
removeTokens(tokens, getColumnIndex(columnName));
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
public void trim() {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
trim(col);
|
||||
|
||||
+29
-25
@@ -6,33 +6,37 @@ X heading2D()? weird.. changed to heading()
|
||||
X http://toxiclibs.org/docs/core/toxi/geom/Vec3D.html
|
||||
X http://code.google.com/p/processing/issues/detail?id=987
|
||||
|
||||
X lots of improvements/cleanups to Table class
|
||||
X added lastRowIndex()
|
||||
X rows() instead of getRows() (doesn't perform like our other get() functions)
|
||||
X it's more like keys() and values() in HashMap
|
||||
X addRow() returns TableRow object to be modified
|
||||
X lastRowIndex() (to avoid getRowCount() - 1)
|
||||
X not lastRow() because Row functions return TableRow object/intf
|
||||
table
|
||||
X added lastRowIndex()
|
||||
X rows() instead of getRows() (doesn't perform like our other get() functions)
|
||||
X it's more like keys() and values() in HashMap
|
||||
X addRow() returns TableRow object to be modified
|
||||
X lastRowIndex() (to avoid getRowCount() - 1)
|
||||
X not lastRow() because Row functions return TableRow object/intf
|
||||
X makeNullEmpty() -> replace(null, "");
|
||||
X makeEmptyNull() -> replace("", null);
|
||||
X saveTable("filename.tsv") or saveTable("filename.txt", "tsv")
|
||||
X createTable() method in PApplet
|
||||
X removed getUniqueXxxx() and some others, pending names
|
||||
|
||||
X makeNullEmpty() -> replace(null, "");
|
||||
X makeEmptyNull() -> replace("", null);
|
||||
more table
|
||||
_ naming for these (or whether to include hash)
|
||||
_ Table createSubset() -> leave out?
|
||||
_ String[] getUnique(col)
|
||||
_ HashMap<String,Integer> getUniqueCount(col)
|
||||
_ possible features
|
||||
_ create table from TableRow iterator...allows for subset and find
|
||||
_ downside is types are not included
|
||||
_ getMaxFloat() (whole table) or getMaxFloat(col)
|
||||
_ that's max(getFloatColumn(n))
|
||||
_ also important b/c can leave out missing values
|
||||
_ include SQL, HTML, ODS, binary?
|
||||
_ naming HTMLTable, TableHTML (ala PShapeSVG)
|
||||
_ or should it be HTMLTable / HtmlTable... then SVGShape / SvgShape
|
||||
_ dictionary support
|
||||
_ join tables together (static is kinda gross)
|
||||
|
||||
createTable()
|
||||
need option to save table
|
||||
|
||||
_ create table from TableRow iterator...allows for subset and find
|
||||
|
||||
naming for these (or whether to include hash)
|
||||
Table createSubset() -> leave out?
|
||||
String[] getUnique(col)
|
||||
HashMap<String,Integer> getUniqueCount(col)
|
||||
|
||||
features?
|
||||
getMaxFloat() (whole table) or getMaxFloat(col) (that's max(getFloatColumn(n))
|
||||
also important b/c can leave out missing values
|
||||
include SQL, HTML, ODS, binary?
|
||||
|
||||
join tables together (static is kinda gross)
|
||||
. . .
|
||||
|
||||
PShape s = createShape();
|
||||
s.beginShape(QUADS);
|
||||
|
||||
Reference in New Issue
Block a user