FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rename to use Dict instead of Hash, remove HTML and ODS tables · dimr/processing@9986be5 · GitHub

Repository navigation

Commit 9986be5

Browse files
committed
rename to use Dict instead of Hash, remove HTML and ODS tables
1 parent c82cdc2 commit 9986be5

10 files changed

Lines changed: 53 additions & 525 deletions

File tree

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* A simple table class to use a String as a lookup for an float value.
1212
*/
13-
public class FloatHash {
13+
public class FloatDict {
1414

1515
/** Number of elements in the table */
1616
protected int count;
@@ -22,7 +22,7 @@ public class FloatHash {
2222
private HashMap<String, Integer> indices = new HashMap<String, Integer>();
2323

2424

25-
public FloatHash() {
25+
public FloatDict() {
2626
count = 0;
2727
keys = new String[10];
2828
values = new float[10];
@@ -33,7 +33,7 @@ public FloatHash() {
3333
* Create a new lookup with a specific size. This is more efficient than not
3434
* specifying a size. Use it when you know the rough size of the thing you're creating.
3535
*/
36-
public FloatHash(int length) {
36+
public FloatDict(int length) {
3737
count = 0;
3838
keys = new String[length];
3939
values = new float[length];
@@ -44,7 +44,7 @@ public FloatHash(int length) {
4444
* Read a set of entries from a Reader that has each key/value pair on
4545
* a single line, separated by a tab.
4646
*/
47-
public FloatHash(BufferedReader reader) {
47+
public FloatDict(BufferedReader reader) {
4848
// public FloatHash(PApplet parent, String filename) {
4949
String[] lines = PApplet.loadStrings(reader);
5050
keys = new String[lines.length];
@@ -485,16 +485,16 @@ public float compare(int a, int b) {
485485

486486
@Override
487487
public void swap(int a, int b) {
488-
FloatHash.this.swap(a, b);
488+
FloatDict.this.swap(a, b);
489489
}
490490
};
491491
s.run();
492492
}
493493

494494

495495
/** Returns a duplicate copy of this object. */
496-
public FloatHash copy() {
497-
FloatHash outgoing = new FloatHash(count);
496+
public FloatDict copy() {
497+
FloatDict outgoing = new FloatDict(count);
498498
System.arraycopy(keys, 0, outgoing.keys, 0, count);
499499
System.arraycopy(values, 0, outgoing.values, 0, count);
500500
for (int i = 0; i < count; i++) {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* A simple class to use a String as a lookup for an int value.
1212
*/
13-
public class IntHash {
13+
public class IntDict {
1414

1515
/** Number of elements in the table */
1616
protected int count;
@@ -45,7 +45,7 @@ public class IntHash {
4545
// }
4646

4747

48-
public IntHash() {
48+
public IntDict() {
4949
count = 0;
5050
keys = new String[10];
5151
values = new int[10];
@@ -56,7 +56,7 @@ public IntHash() {
5656
* Create a new lookup with a specific size. This is more efficient than not
5757
* specifying a size. Use it when you know the rough size of the thing you're creating.
5858
*/
59-
public IntHash(int length) {
59+
public IntDict(int length) {
6060
count = 0;
6161
keys = new String[length];
6262
values = new int[length];
@@ -67,7 +67,7 @@ public IntHash(int length) {
6767
* Read a set of entries from a Reader that has each key/value pair on
6868
* a single line, separated by a tab.
6969
*/
70-
public IntHash(BufferedReader reader) {
70+
public IntDict(BufferedReader reader) {
7171
// public IntHash(PApplet parent, String filename) {
7272
String[] lines = PApplet.loadStrings(reader);
7373
keys = new String[lines.length];
@@ -375,16 +375,16 @@ public float compare(int a, int b) {
375375

376376
@Override
377377
public void swap(int a, int b) {
378-
IntHash.this.swap(a, b);
378+
IntDict.this.swap(a, b);
379379
}
380380
};
381381
s.run();
382382
}
383383

384384

385385
/** Returns a duplicate copy of this object. */
386-
public IntHash copy() {
387-
IntHash outgoing = new IntHash(count);
386+
public IntDict copy() {
387+
IntDict outgoing = new IntDict(count);
388388
System.arraycopy(keys, 0, outgoing.keys, 0, count);
389389
System.arraycopy(values, 0, outgoing.values, 0, count);
390390
for (int i = 0; i < count; i++) {

‎core/src/processing/data/JSONObject.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,23 +299,23 @@ protected JSONObject(HashMap<String, Object> map) {
299299
}
300300

301301

302-
public JSONObject(IntHash dict) {
302+
public JSONObject(IntDict dict) {
303303
map = new HashMap<String, Object>();
304304
for (int i = 0; i < dict.size(); i++) {
305305
setInt(dict.key(i), dict.value(i));
306306
}
307307
}
308308

309309

310-
public JSONObject(FloatHash dict) {
310+
public JSONObject(FloatDict dict) {
311311
map = new HashMap<String, Object>();
312312
for (int i = 0; i < dict.size(); i++) {
313313
setFloat(dict.key(i), dict.value(i));
314314
}
315315
}
316316

317317

318-
public JSONObject(StringHash dict) {
318+
public JSONObject(StringDict dict) {
319319
map = new HashMap<String, Object>();
320320
for (int i = 0; i < dict.size(); i++) {
321321
setString(dict.key(i), dict.value(i));
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* A simple table class to use a String as a lookup for another String value.
1212
*/
13-
public class StringHash {
13+
public class StringDict {
1414

1515
/** Number of elements in the table */
1616
protected int count;
@@ -22,7 +22,7 @@ public class StringHash {
2222
private HashMap<String, Integer> indices = new HashMap<String, Integer>();
2323

2424

25-
public StringHash() {
25+
public StringDict() {
2626
count = 0;
2727
keys = new String[10];
2828
values = new String[10];
@@ -34,7 +34,7 @@ public StringHash() {
3434
* change the size(), but is more efficient than not specifying a length.
3535
* Use it when you know the rough size of the thing you're creating.
3636
*/
37-
public StringHash(int length) {
37+
public StringDict(int length) {
3838
count = 0;
3939
keys = new String[length];
4040
values = new String[length];
@@ -45,7 +45,7 @@ public StringHash(int length) {
4545
* Read a set of entries from a Reader that has each key/value pair on
4646
* a single line, separated by a tab.
4747
*/
48-
public StringHash(BufferedReader reader) {
48+
public StringDict(BufferedReader reader) {
4949
String[] lines = PApplet.loadStrings(reader);
5050
keys = new String[lines.length];
5151
values = new String[lines.length];
@@ -312,16 +312,16 @@ public float compare(int a, int b) {
312312

313313
@Override
314314
public void swap(int a, int b) {
315-
StringHash.this.swap(a, b);
315+
StringDict.this.swap(a, b);
316316
}
317317
};
318318
s.run();
319319
}
320320

321321

322322
/** Returns a duplicate copy of this object. */
323-
public StringHash copy() {
324-
StringHash outgoing = new StringHash(count);
323+
public StringDict copy() {
324+
StringDict outgoing = new StringDict(count);
325325
System.arraycopy(keys, 0, outgoing.keys, 0, count);
326326
System.arraycopy(values, 0, outgoing.values, 0, count);
327327
for (int i = 0; i < count; i++) {

‎core/src/processing/data/StringList.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,15 +601,15 @@ public String[] array(String[] array) {
601601

602602
/** Remove all non-unique entries. */
603603
public void unique() {
604-
IntHash cheat = getTally();
604+
IntDict cheat = getTally();
605605
data = cheat.keyArray();
606606
count = cheat.size();
607607
}
608608

609609

610610
/** Count the number of times each String entry is found in this list. */
611-
public IntHash getTally() {
612-
IntHash outgoing = new IntHash();
611+
public IntDict getTally() {
612+
IntDict outgoing = new IntDict();
613613
for (int i = 0; i < count; i++) {
614614
outgoing.increment(data[i]);
615615
}
@@ -618,8 +618,8 @@ public IntHash getTally() {
618618

619619

620620
/** Create a dictionary associating each entry in this list to its index. */
621-
public IntHash getOrder() {
622-
IntHash outgoing = new IntHash();
621+
public IntDict getOrder() {
622+
IntDict outgoing = new IntDict();
623623
for (int i = 0; i < count; i++) {
624624
outgoing.set(data[i], i);
625625
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL