From 171195426d60587f16367326b6c3aea5bbd17cb5 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sun, 8 May 2016 14:31:29 -0400 Subject: [PATCH] add print() and write() to Table and TableRow (fixes #4396) --- core/src/processing/data/Table.java | 23 +++++++++++++++++++++++ core/src/processing/data/TableRow.java | 5 +++++ core/todo.txt | 3 +++ todo.txt | 5 +++++ 4 files changed, 36 insertions(+) diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index d60e9ede5..da4cd9f4b 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -2590,6 +2590,19 @@ public class Table { public String[] getColumnTitles() { return table.getColumnTitles(); } + + public void print() { + write(new PrintWriter(System.out)); + } + + public void write(PrintWriter writer) { + for (int i = 0 ; i < getColumnCount(); i++) { + if (i != 0) { + writer.print('\t'); + } + writer.print(getString(i)); + } + } } @@ -4571,4 +4584,14 @@ public class Table { public Table copy() { return new Table(rows()); } + + + public void write(PrintWriter writer) { + writeTSV(writer); + } + + + public void print() { + writeTSV(new PrintWriter(System.out)); + } } diff --git a/core/src/processing/data/TableRow.java b/core/src/processing/data/TableRow.java index 87e288825..0c2ae79da 100644 --- a/core/src/processing/data/TableRow.java +++ b/core/src/processing/data/TableRow.java @@ -1,5 +1,7 @@ package processing.data; +import java.io.PrintWriter; + /** * @webref data:composite * @see Table @@ -112,4 +114,7 @@ public interface TableRow { public String getColumnTitle(int column); public String[] getColumnTitles(); + + public void write(PrintWriter writer); + public void print(); } diff --git a/core/todo.txt b/core/todo.txt index 1238c68df..969bad3df 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -9,6 +9,9 @@ X call crop() in keyArray() and valueArray() functions X they're duplicates, their length is an implementation detail X normalize features and error handling between all of them +X add print() and write(PrintWriter) methods to Table/TableRow +X https://github.com/processing/processing/issues/4396 + _ JSONObject get() method is private _ https://github.com/processing/processing/issues/4334 _ https://github.com/processing/processing/pull/4336 diff --git a/todo.txt b/todo.txt index b5171a507..335a106e9 100644 --- a/todo.txt +++ b/todo.txt @@ -48,6 +48,11 @@ X "Show usage..." does not locate keywords on correct line X https://github.com/processing/processing/issues/3988 X PPS: threading enhancement X https://github.com/processing/processing/pull/4442 +X Move PDEX listeners from JavaEditor to PDEX +X https://github.com/processing/processing/pull/4446 +X https://github.com/processing/processing/pull/4447 +X handleCtrlClick misbehaving +X https://github.com/processing/processing/issues/4281 gottfried X Add automatic mipmap support to GLES2