Skip to content

Commit 2d28c00

Browse files
committed
Reference additions for IntDict
1 parent 4664f7e commit 2d28c00

4 files changed

Lines changed: 29 additions & 18 deletions

File tree

build/shared/lib/about-2x.jpg

4.34 KB
Loading

build/shared/lib/about.jpg

2.18 KB
Loading

core/src/processing/data/FloatDict.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public boolean hasKey(String key) {
312312

313313
/**
314314
* @webref floatdict:method
315-
* @brief To come...
315+
* @brief Add to a value
316316
*/
317317
public void add(String key, float amount) {
318318
int index = index(key);
@@ -332,7 +332,7 @@ public void add(String key, float amount) {
332332

333333
/**
334334
* @webref floatdict:method
335-
* @brief To come...
335+
* @brief Subtract from a value
336336
*/
337337
public void sub(String key, float amount) {
338338
add(key, -amount);
@@ -341,7 +341,7 @@ public void sub(String key, float amount) {
341341

342342
/**
343343
* @webref floatdict:method
344-
* @brief To come...
344+
* @brief Multiply a value
345345
*/
346346
public void mult(String key, float amount) {
347347
int index = index(key);
@@ -353,7 +353,7 @@ public void mult(String key, float amount) {
353353

354354
/**
355355
* @webref floatdict:method
356-
* @brief To come...
356+
* @brief Divide a value
357357
*/
358358
public void div(String key, float amount) {
359359
int index = index(key);

core/src/processing/data/IntDict.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ public IntDict(String[] keys, int[] values) {
101101
}
102102

103103
/**
104+
* Returns the number of key/value pairs
105+
*
104106
* @webref intdict:method
105-
* @brief To come...
107+
* @brief Returns the number of key/value pairs
106108
*/
107109
public int size() {
108110
return count;
@@ -241,6 +243,8 @@ public int[] valueArray() {
241243
* Fill an already-allocated array with the values (more efficient than
242244
* creating a new array each time). If 'array' is null, or not the same
243245
* size as the number of values, a new array will be allocated and returned.
246+
*
247+
* @param array values to copy into the array
244248
*/
245249
public int[] valueArray(int[] array) {
246250
if (array == null || array.length != size()) {
@@ -264,8 +268,10 @@ public int get(String key) {
264268
}
265269

266270
/**
271+
* Create a new key/value pair or change the value of one.
272+
*
267273
* @webref intdict:method
268-
* @brief To come...
274+
* @brief Create a new key/value pair or change the value of one
269275
*/
270276
public void set(String key, int amount) {
271277
int index = index(key);
@@ -278,26 +284,26 @@ public void set(String key, int amount) {
278284

279285
/**
280286
* @webref intdict:method
281-
* @brief To come...
287+
* @brief Check if a key is a part of the data structure
282288
*/
283289
public boolean hasKey(String key) {
284290
return index(key) != -1;
285291
}
286292

287293

288294
/**
289-
* Increase the value of a specific key by 1.
295+
* Increase the value of a specific key value by 1.
290296
*
291297
* @webref intdict:method
292-
* @brief Increase the value of a specific key by 1
298+
* @brief Increase the value of a specific key value by 1
293299
*/
294300
public void increment(String key) {
295301
add(key, 1);
296302
}
297303

298304
/**
299305
* @webref intdict:method
300-
* @brief To come...
306+
* @brief Add to a value
301307
*/
302308
public void add(String key, int amount) {
303309
int index = index(key);
@@ -310,15 +316,15 @@ public void add(String key, int amount) {
310316

311317
/**
312318
* @webref intdict:method
313-
* @brief To come...
319+
* @brief Subtract from a value
314320
*/
315321
public void sub(String key, int amount) {
316322
add(key, -amount);
317323
}
318324

319325
/**
320326
* @webref intdict:method
321-
* @brief To come...
327+
* @brief Multiply a value
322328
*/
323329
public void mult(String key, int amount) {
324330
int index = index(key);
@@ -329,7 +335,7 @@ public void mult(String key, int amount) {
329335

330336
/**
331337
* @webref intdict:method
332-
* @brief To come...
338+
* @brief Divide a value
333339
*/
334340
public void div(String key, int amount) {
335341
int index = index(key);
@@ -358,7 +364,7 @@ protected void create(String what, int much) {
358364

359365
/**
360366
* @webref intdict:method
361-
* @brief To come...
367+
* @brief Remove a key/value pair
362368
*/
363369
public void remove(String key) {
364370
removeIndex(index(key));
@@ -404,27 +410,32 @@ public void sortKeys() {
404410
}
405411

406412
/**
413+
* Sort the keys alphabetically in reverse (ignoring case). Uses the value as a
414+
* tie-breaker (only really possible with a key that has a case change).
415+
*
407416
* @webref intdict:method
408-
* @brief To come...
417+
* @brief Sort the keys alphabetially in reverse
409418
*/
410419
public void sortKeysReverse() {
411420
sortImpl(true, true);
412421
}
413422

414423

415424
/**
416-
* Sort by values in descending order (largest value will be at [0]).
425+
* Sort by values in ascending order. The smallest value will be at [0].
417426
*
418427
* @webref intdict:method
419-
* @brief Sort by values in descending order
428+
* @brief Sort by values in ascending order
420429
*/
421430
public void sortValues() {
422431
sortImpl(false, false);
423432
}
424433

425434
/**
435+
* Sort by values in descending order. The largest value will be at [0].
436+
*
426437
* @webref intdict:method
427-
* @brief To come...
438+
* @brief Sort by values in descending order
428439
*/
429440
public void sortValuesReverse() {
430441
sortImpl(false, true);

0 commit comments

Comments
 (0)