diff --git a/core/src/processing/data/FloatDict.java b/core/src/processing/data/FloatDict.java index cccfc17da..d300afc1d 100644 --- a/core/src/processing/data/FloatDict.java +++ b/core/src/processing/data/FloatDict.java @@ -744,12 +744,11 @@ public class FloatDict { } -// /** -// * Write tab-delimited entries out to the console. -// */ -// public void print() { -// write(new PrintWriter(System.out)); -// } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } /** diff --git a/core/src/processing/data/FloatList.java b/core/src/processing/data/FloatList.java index 3a00bbe05..1e4a85f19 100644 --- a/core/src/processing/data/FloatList.java +++ b/core/src/processing/data/FloatList.java @@ -779,6 +779,13 @@ public class FloatList implements Iterable { } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.format("[%d] %f%n", i, data[i]); + } + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/core/src/processing/data/IntDict.java b/core/src/processing/data/IntDict.java index b581eaecf..022d9195f 100644 --- a/core/src/processing/data/IntDict.java +++ b/core/src/processing/data/IntDict.java @@ -663,6 +663,13 @@ public class IntDict { } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/core/src/processing/data/StringDict.java b/core/src/processing/data/StringDict.java index 38b2175eb..becc5ee51 100644 --- a/core/src/processing/data/StringDict.java +++ b/core/src/processing/data/StringDict.java @@ -428,6 +428,13 @@ public class StringDict { } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index 10f564476..67e58a9ee 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -705,10 +705,11 @@ public class StringList implements Iterable { } -// static public StringList split(String value, char delim) { -// String[] array = PApplet.split(value, delim); -// return new StringList(array); -// } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.format("[%d] %s%n", i, data[i]); + } + } @Override diff --git a/core/todo.txt b/core/todo.txt index 72637a8b7..815e493fb 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -17,6 +17,10 @@ X nothing else to do here X FloatDict and FloatList should always put NaN values at the end on sort X same for the other list and dict classes X (this is part of the point of having these easier versions) +o 'collector' class.. Dict that points to a list +o String as a key, int/float/string list as values +X seems too much like a better place for HashMap +X add print() method to other data types (not just IntList) pulls X implement A and a (elliptical arcs) @@ -43,10 +47,6 @@ _ but for NaN values, it's a necessity _ get() methods in List/Dict shouldn't allow you to get bad values _ but set() methods can automatically resize the arrays _ though that means insert() should allow you to insert past the end -_ should we allow negative indices so that we can work relative to the end? -_ add print() method to other data types (not just IntList) -_ 'collector' class.. Dict that points to a list -_ String as a key, int/float/string list as values _ addRow() is not efficient, probably need to do the doubling o or have a setIncrement() function? _ it would default to 1 on tables loaded from a file @@ -56,7 +56,6 @@ _ match and iterators _ add match version that returns table that's only a pointer to original _ save the constructor for the version that actually copies data _ the table pointer version will be speedy and allow chaining -_ add Double and Long versions of the classes? later @@ -225,6 +224,8 @@ _ is this still true? _ decide how disconnectEvent should actually be handled (and name?) _ was disconnect always there? _ will need documentation +_ negative indices so that we can work relative to the end in data classes? +_ add Double and Long versions of the classes?