| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ | |||
| 10 | 10 | /** | |
| 11 | 11 | * A simple table class to use a String as a lookup for an float value. | |
| 12 | 12 | */ | |
| 13 | - public class FloatHash { | ||
| 13 | + public class FloatDict { | ||
| 14 | 14 | ||
| 15 | 15 | /** Number of elements in the table */ | |
| 16 | 16 | protected int count; | |
@@ -22,7 +22,7 @@ public class FloatHash { | |||
| 22 | 22 | private HashMap<String, Integer> indices = new HashMap<String, Integer>(); | |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | - public FloatHash() { | ||
| 25 | + public FloatDict() { | ||
| 26 | 26 | count = 0; | |
| 27 | 27 | keys = new String[10]; | |
| 28 | 28 | values = new float[10]; | |
@@ -33,7 +33,7 @@ public FloatHash() { | |||
| 33 | 33 | * Create a new lookup with a specific size. This is more efficient than not | |
| 34 | 34 | * specifying a size. Use it when you know the rough size of the thing you're creating. | |
| 35 | 35 | */ | |
| 36 | - public FloatHash(int length) { | ||
| 36 | + public FloatDict(int length) { | ||
| 37 | 37 | count = 0; | |
| 38 | 38 | keys = new String[length]; | |
| 39 | 39 | values = new float[length]; | |
@@ -44,7 +44,7 @@ public FloatHash(int length) { | |||
| 44 | 44 | * Read a set of entries from a Reader that has each key/value pair on | |
| 45 | 45 | * a single line, separated by a tab. | |
| 46 | 46 | */ | |
| 47 | - public FloatHash(BufferedReader reader) { | ||
| 47 | + public FloatDict(BufferedReader reader) { | ||
| 48 | 48 | // public FloatHash(PApplet parent, String filename) { | |
| 49 | 49 | String[] lines = PApplet.loadStrings(reader); | |
| 50 | 50 | keys = new String[lines.length]; | |
@@ -485,16 +485,16 @@ public float compare(int a, int b) { | |||
| 485 | 485 | ||
| 486 | 486 | @Override | |
| 487 | 487 | public void swap(int a, int b) { | |
| 488 | - FloatHash.this.swap(a, b); | ||
| 488 | + FloatDict.this.swap(a, b); | ||
| 489 | 489 | } | |
| 490 | 490 | }; | |
| 491 | 491 | s.run(); | |
| 492 | 492 | } | |
| 493 | 493 | ||
| 494 | 494 | ||
| 495 | 495 | /** 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); | ||
| 498 | 498 | System.arraycopy(keys, 0, outgoing.keys, 0, count); | |
| 499 | 499 | System.arraycopy(values, 0, outgoing.values, 0, count); | |
| 500 | 500 | for (int i = 0; i < count; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ | |||
| 10 | 10 | /** | |
| 11 | 11 | * A simple class to use a String as a lookup for an int value. | |
| 12 | 12 | */ | |
| 13 | - public class IntHash { | ||
| 13 | + public class IntDict { | ||
| 14 | 14 | ||
| 15 | 15 | /** Number of elements in the table */ | |
| 16 | 16 | protected int count; | |
@@ -45,7 +45,7 @@ public class IntHash { | |||
| 45 | 45 | // } | |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | - public IntHash() { | ||
| 48 | + public IntDict() { | ||
| 49 | 49 | count = 0; | |
| 50 | 50 | keys = new String[10]; | |
| 51 | 51 | values = new int[10]; | |
@@ -56,7 +56,7 @@ public IntHash() { | |||
| 56 | 56 | * Create a new lookup with a specific size. This is more efficient than not | |
| 57 | 57 | * specifying a size. Use it when you know the rough size of the thing you're creating. | |
| 58 | 58 | */ | |
| 59 | - public IntHash(int length) { | ||
| 59 | + public IntDict(int length) { | ||
| 60 | 60 | count = 0; | |
| 61 | 61 | keys = new String[length]; | |
| 62 | 62 | values = new int[length]; | |
@@ -67,7 +67,7 @@ public IntHash(int length) { | |||
| 67 | 67 | * Read a set of entries from a Reader that has each key/value pair on | |
| 68 | 68 | * a single line, separated by a tab. | |
| 69 | 69 | */ | |
| 70 | - public IntHash(BufferedReader reader) { | ||
| 70 | + public IntDict(BufferedReader reader) { | ||
| 71 | 71 | // public IntHash(PApplet parent, String filename) { | |
| 72 | 72 | String[] lines = PApplet.loadStrings(reader); | |
| 73 | 73 | keys = new String[lines.length]; | |
@@ -375,16 +375,16 @@ public float compare(int a, int b) { | |||
| 375 | 375 | ||
| 376 | 376 | @Override | |
| 377 | 377 | public void swap(int a, int b) { | |
| 378 | - IntHash.this.swap(a, b); | ||
| 378 | + IntDict.this.swap(a, b); | ||
| 379 | 379 | } | |
| 380 | 380 | }; | |
| 381 | 381 | s.run(); | |
| 382 | 382 | } | |
| 383 | 383 | ||
| 384 | 384 | ||
| 385 | 385 | /** 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); | ||
| 388 | 388 | System.arraycopy(keys, 0, outgoing.keys, 0, count); | |
| 389 | 389 | System.arraycopy(values, 0, outgoing.values, 0, count); | |
| 390 | 390 | for (int i = 0; i < count; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -299,23 +299,23 @@ protected JSONObject(HashMap<String, Object> map) { | |||
| 299 | 299 | } | |
| 300 | 300 | ||
| 301 | 301 | ||
| 302 | - public JSONObject(IntHash dict) { | ||
| 302 | + public JSONObject(IntDict dict) { | ||
| 303 | 303 | map = new HashMap<String, Object>(); | |
| 304 | 304 | for (int i = 0; i < dict.size(); i++) { | |
| 305 | 305 | setInt(dict.key(i), dict.value(i)); | |
| 306 | 306 | } | |
| 307 | 307 | } | |
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | - public JSONObject(FloatHash dict) { | ||
| 310 | + public JSONObject(FloatDict dict) { | ||
| 311 | 311 | map = new HashMap<String, Object>(); | |
| 312 | 312 | for (int i = 0; i < dict.size(); i++) { | |
| 313 | 313 | setFloat(dict.key(i), dict.value(i)); | |
| 314 | 314 | } | |
| 315 | 315 | } | |
| 316 | 316 | ||
| 317 | 317 | ||
| 318 | - public JSONObject(StringHash dict) { | ||
| 318 | + public JSONObject(StringDict dict) { | ||
| 319 | 319 | map = new HashMap<String, Object>(); | |
| 320 | 320 | for (int i = 0; i < dict.size(); i++) { | |
| 321 | 321 | setString(dict.key(i), dict.value(i)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ | |||
| 10 | 10 | /** | |
| 11 | 11 | * A simple table class to use a String as a lookup for another String value. | |
| 12 | 12 | */ | |
| 13 | - public class StringHash { | ||
| 13 | + public class StringDict { | ||
| 14 | 14 | ||
| 15 | 15 | /** Number of elements in the table */ | |
| 16 | 16 | protected int count; | |
@@ -22,7 +22,7 @@ public class StringHash { | |||
| 22 | 22 | private HashMap<String, Integer> indices = new HashMap<String, Integer>(); | |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | - public StringHash() { | ||
| 25 | + public StringDict() { | ||
| 26 | 26 | count = 0; | |
| 27 | 27 | keys = new String[10]; | |
| 28 | 28 | values = new String[10]; | |
@@ -34,7 +34,7 @@ public StringHash() { | |||
| 34 | 34 | * change the size(), but is more efficient than not specifying a length. | |
| 35 | 35 | * Use it when you know the rough size of the thing you're creating. | |
| 36 | 36 | */ | |
| 37 | - public StringHash(int length) { | ||
| 37 | + public StringDict(int length) { | ||
| 38 | 38 | count = 0; | |
| 39 | 39 | keys = new String[length]; | |
| 40 | 40 | values = new String[length]; | |
@@ -45,7 +45,7 @@ public StringHash(int length) { | |||
| 45 | 45 | * Read a set of entries from a Reader that has each key/value pair on | |
| 46 | 46 | * a single line, separated by a tab. | |
| 47 | 47 | */ | |
| 48 | - public StringHash(BufferedReader reader) { | ||
| 48 | + public StringDict(BufferedReader reader) { | ||
| 49 | 49 | String[] lines = PApplet.loadStrings(reader); | |
| 50 | 50 | keys = new String[lines.length]; | |
| 51 | 51 | values = new String[lines.length]; | |
@@ -312,16 +312,16 @@ public float compare(int a, int b) { | |||
| 312 | 312 | ||
| 313 | 313 | @Override | |
| 314 | 314 | public void swap(int a, int b) { | |
| 315 | - StringHash.this.swap(a, b); | ||
| 315 | + StringDict.this.swap(a, b); | ||
| 316 | 316 | } | |
| 317 | 317 | }; | |
| 318 | 318 | s.run(); | |
| 319 | 319 | } | |
| 320 | 320 | ||
| 321 | 321 | ||
| 322 | 322 | /** 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); | ||
| 325 | 325 | System.arraycopy(keys, 0, outgoing.keys, 0, count); | |
| 326 | 326 | System.arraycopy(values, 0, outgoing.values, 0, count); | |
| 327 | 327 | for (int i = 0; i < count; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -601,15 +601,15 @@ public String[] array(String[] array) { | |||
| 601 | 601 | ||
| 602 | 602 | /** Remove all non-unique entries. */ | |
| 603 | 603 | public void unique() { | |
| 604 | - IntHash cheat = getTally(); | ||
| 604 | + IntDict cheat = getTally(); | ||
| 605 | 605 | data = cheat.keyArray(); | |
| 606 | 606 | count = cheat.size(); | |
| 607 | 607 | } | |
| 608 | 608 | ||
| 609 | 609 | ||
| 610 | 610 | /** 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(); | ||
| 613 | 613 | for (int i = 0; i < count; i++) { | |
| 614 | 614 | outgoing.increment(data[i]); | |
| 615 | 615 | } | |
@@ -618,8 +618,8 @@ public IntHash getTally() { | |||
| 618 | 618 | ||
| 619 | 619 | ||
| 620 | 620 | /** 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(); | ||
| 623 | 623 | for (int i = 0; i < count; i++) { | |
| 624 | 624 | outgoing.set(data[i], i); | |
| 625 | 625 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments