picrate 0.5.0-java → 0.6.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/Rakefile +8 -6
- data/docs/_editors/geany.md +5 -4
- data/docs/_editors/vim.md +6 -0
- data/docs/_includes/head.html +1 -0
- data/docs/_libraries/control_panel.md +2 -2
- data/docs/_libraries/gl_video.md +21 -0
- data/docs/_posts/2018-05-06-getting_started.md +10 -9
- data/docs/_posts/2018-05-06-install_jruby.md +19 -2
- data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
- data/docs/_posts/2018-11-18-building-gem.md +18 -0
- data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
- data/docs/about.md +21 -10
- data/docs/assets/android-chrome-192x192.png +0 -0
- data/docs/assets/android-chrome-512x512.png +0 -0
- data/docs/assets/favicon.ico +0 -0
- data/docs/assets/geany.png +0 -0
- data/docs/assets/jwishy_picrate.png +0 -0
- data/docs/assets/picrate.svg +251 -0
- data/docs/index.html +8 -14
- data/lib/picrate/runner.rb +6 -2
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +10 -13
- data/mvnw +234 -0
- data/picrate.gemspec +2 -1
- data/pom.rb +1 -1
- data/pom.xml +1 -1
- data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
- data/src/main/java/monkstone/ColorUtil.java +11 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -0
- data/src/main/java/monkstone/PicrateLibrary.java +1 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/Slider.java +3 -3
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
- data/src/main/java/monkstone/vecmath/JRender.java +1 -0
- data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
- data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
- data/src/main/java/processing/core/PApplet.java +18 -12
- data/src/main/java/processing/core/PShape.java +1182 -305
- data/src/main/java/processing/core/PStyle.java +1 -1
- data/src/main/java/processing/core/PSurface.java +1 -1
- data/src/main/java/processing/data/FloatDict.java +196 -54
- data/src/main/java/processing/data/FloatList.java +167 -54
- data/src/main/java/processing/data/IntDict.java +211 -56
- data/src/main/java/processing/data/IntList.java +185 -52
- data/src/main/java/processing/data/JSONArray.java +69 -20
- data/src/main/java/processing/data/JSONObject.java +53 -12
- data/src/main/java/processing/data/Sort.java +40 -10
- data/src/main/java/processing/data/StringDict.java +159 -49
- data/src/main/java/processing/data/StringList.java +147 -42
- data/src/main/java/processing/data/Table.java +778 -223
- data/src/main/java/processing/data/TableRow.java +26 -2
- data/src/main/java/processing/data/XML.java +190 -50
- data/src/main/java/processing/event/Event.java +93 -0
- data/src/main/java/processing/event/KeyEvent.java +55 -13
- data/src/main/java/processing/event/MouseEvent.java +77 -1
- data/src/main/java/processing/event/TouchEvent.java +14 -1
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
- data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
- data/src/main/java/processing/opengl/LinePath.java +131 -27
- data/src/main/java/processing/opengl/LineStroker.java +30 -5
- data/src/main/java/processing/opengl/PGL.java +4066 -865
- data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
- data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
- data/src/main/java/processing/opengl/PJOGL.java +1460 -248
- data/src/main/java/processing/opengl/PShader.java +904 -217
- data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
- data/src/main/java/processing/opengl/Texture.java +610 -135
- data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
- data/src/main/resources/icon/icon-1024.png +0 -0
- data/src/main/resources/icon/icon-128.png +0 -0
- data/src/main/resources/icon/icon-16.png +0 -0
- data/src/main/resources/icon/icon-256.png +0 -0
- data/src/main/resources/icon/icon-32.png +0 -0
- data/src/main/resources/icon/icon-48.png +0 -0
- data/src/main/resources/icon/icon-512.png +0 -0
- data/src/main/resources/icon/icon-64.png +0 -0
- data/vendors/Rakefile +1 -1
- metadata +13 -6
- data/docs/assets/circle_collisions.png +0 -0
- data/docs/favicon.ico +0 -0
@@ -19,14 +19,23 @@ public class FloatDict {
|
|
19
19
|
/** Number of elements in the table */
|
20
20
|
protected int count;
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
/**
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
protected String[] keys;
|
26
|
+
|
27
|
+
/**
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
protected float[] values;
|
24
31
|
|
25
32
|
/** Internal implementation for faster lookups */
|
26
33
|
private HashMap<String, Integer> indices = new HashMap<>();
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
/**
|
36
|
+
*
|
37
|
+
*/
|
38
|
+
public FloatDict() {
|
30
39
|
count = 0;
|
31
40
|
keys = new String[10];
|
32
41
|
values = new float[10];
|
@@ -34,9 +43,10 @@ public class FloatDict {
|
|
34
43
|
|
35
44
|
|
36
45
|
/**
|
37
|
-
* Create a new lookup with a specific size.
|
38
|
-
|
46
|
+
* Create a new lookup with a specific size.This is more efficient than not
|
47
|
+
specifying a size. Use it when you know the rough size of the thing you're creating.
|
39
48
|
*
|
49
|
+
* @param length
|
40
50
|
* @nowebref
|
41
51
|
*/
|
42
52
|
public FloatDict(int length) {
|
@@ -50,6 +60,7 @@ public class FloatDict {
|
|
50
60
|
* Read a set of entries from a Reader that has each key/value pair on
|
51
61
|
* a single line, separated by a tab.
|
52
62
|
*
|
63
|
+
* @param reader
|
53
64
|
* @nowebref
|
54
65
|
*/
|
55
66
|
public FloatDict(BufferedReader reader) {
|
@@ -70,6 +81,8 @@ public class FloatDict {
|
|
70
81
|
|
71
82
|
|
72
83
|
/**
|
84
|
+
* @param keys
|
85
|
+
* @param values
|
73
86
|
* @nowebref
|
74
87
|
*/
|
75
88
|
public FloatDict(String[] keys, float[] values) {
|
@@ -93,6 +106,7 @@ public class FloatDict {
|
|
93
106
|
* { "key2", 2 }
|
94
107
|
* });
|
95
108
|
* </pre>
|
109
|
+
* @param pairs
|
96
110
|
*/
|
97
111
|
public FloatDict(Object[][] pairs) {
|
98
112
|
count = pairs.length;
|
@@ -107,6 +121,7 @@ public class FloatDict {
|
|
107
121
|
|
108
122
|
|
109
123
|
/**
|
124
|
+
* @return
|
110
125
|
* @webref floatdict:method
|
111
126
|
* @brief Returns the number of key/value pairs
|
112
127
|
*/
|
@@ -116,8 +131,8 @@ public class FloatDict {
|
|
116
131
|
|
117
132
|
|
118
133
|
/**
|
119
|
-
* Resize the internal data, this can only be used to shrink the list.
|
120
|
-
|
134
|
+
* Resize the internal data, this can only be used to shrink the list.Helpful for situations like sorting and then grabbing the top 50 entries.
|
135
|
+
* @param arg0
|
121
136
|
*/
|
122
137
|
public void resize(int length) {
|
123
138
|
if (length == count) return;
|
@@ -162,10 +177,22 @@ public class FloatDict {
|
|
162
177
|
|
163
178
|
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
164
179
|
|
180
|
+
/**
|
181
|
+
*
|
182
|
+
*/
|
183
|
+
|
165
184
|
|
166
185
|
public class Entry {
|
167
|
-
|
168
|
-
|
186
|
+
|
187
|
+
/**
|
188
|
+
*
|
189
|
+
*/
|
190
|
+
public String key;
|
191
|
+
|
192
|
+
/**
|
193
|
+
*
|
194
|
+
*/
|
195
|
+
public float value;
|
169
196
|
|
170
197
|
Entry(String key, float value) {
|
171
198
|
this.key = key;
|
@@ -173,8 +200,11 @@ public class FloatDict {
|
|
173
200
|
}
|
174
201
|
}
|
175
202
|
|
176
|
-
|
177
|
-
|
203
|
+
/**
|
204
|
+
*
|
205
|
+
* @return
|
206
|
+
*/
|
207
|
+
public Iterable<Entry> entries() {
|
178
208
|
return new Iterable<Entry>() {
|
179
209
|
|
180
210
|
public Iterator<Entry> iterator() {
|
@@ -183,8 +213,11 @@ public class FloatDict {
|
|
183
213
|
};
|
184
214
|
}
|
185
215
|
|
186
|
-
|
187
|
-
|
216
|
+
/**
|
217
|
+
*
|
218
|
+
* @return
|
219
|
+
*/
|
220
|
+
public Iterator<Entry> entryIterator() {
|
188
221
|
return new Iterator<Entry>() {
|
189
222
|
int index = -1;
|
190
223
|
|
@@ -208,21 +241,32 @@ public class FloatDict {
|
|
208
241
|
|
209
242
|
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
210
243
|
|
244
|
+
/**
|
245
|
+
*
|
246
|
+
* @param index
|
247
|
+
* @return
|
248
|
+
*/
|
249
|
+
|
211
250
|
|
212
251
|
public String key(int index) {
|
213
252
|
return keys[index];
|
214
253
|
}
|
215
254
|
|
216
|
-
|
217
|
-
|
255
|
+
/**
|
256
|
+
*
|
257
|
+
*/
|
258
|
+
protected void crop() {
|
218
259
|
if (count != keys.length) {
|
219
260
|
keys = PApplet.subset(keys, 0, count);
|
220
261
|
values = PApplet.subset(values, 0, count);
|
221
262
|
}
|
222
263
|
}
|
223
264
|
|
224
|
-
|
225
|
-
|
265
|
+
/**
|
266
|
+
*
|
267
|
+
* @return
|
268
|
+
*/
|
269
|
+
public Iterable<String> keys() {
|
226
270
|
return new Iterable<String>() {
|
227
271
|
|
228
272
|
@Override
|
@@ -234,6 +278,11 @@ public class FloatDict {
|
|
234
278
|
|
235
279
|
|
236
280
|
// Use this to iterate when you want to be able to remove elements along the way
|
281
|
+
|
282
|
+
/**
|
283
|
+
*
|
284
|
+
* @return
|
285
|
+
*/
|
237
286
|
public Iterator<String> keyIterator() {
|
238
287
|
return new Iterator<String>() {
|
239
288
|
int index = -1;
|
@@ -255,8 +304,9 @@ public class FloatDict {
|
|
255
304
|
|
256
305
|
|
257
306
|
/**
|
258
|
-
* Return a copy of the internal keys array.
|
307
|
+
* Return a copy of the internal keys array.This array can be modified.
|
259
308
|
*
|
309
|
+
* @return
|
260
310
|
* @webref floatdict:method
|
261
311
|
* @brief Return a copy of the internal keys array
|
262
312
|
*/
|
@@ -265,8 +315,12 @@ public class FloatDict {
|
|
265
315
|
return keyArray(null);
|
266
316
|
}
|
267
317
|
|
268
|
-
|
269
|
-
|
318
|
+
/**
|
319
|
+
*
|
320
|
+
* @param outgoing
|
321
|
+
* @return
|
322
|
+
*/
|
323
|
+
public String[] keyArray(String[] outgoing) {
|
270
324
|
if (outgoing == null || outgoing.length != count) {
|
271
325
|
outgoing = new String[count];
|
272
326
|
}
|
@@ -274,13 +328,18 @@ public class FloatDict {
|
|
274
328
|
return outgoing;
|
275
329
|
}
|
276
330
|
|
277
|
-
|
278
|
-
|
331
|
+
/**
|
332
|
+
*
|
333
|
+
* @param index
|
334
|
+
* @return
|
335
|
+
*/
|
336
|
+
public float value(int index) {
|
279
337
|
return values[index];
|
280
338
|
}
|
281
339
|
|
282
340
|
|
283
341
|
/**
|
342
|
+
* @return
|
284
343
|
* @webref floatdict:method
|
285
344
|
* @brief Return the internal array being used to store the values
|
286
345
|
*/
|
@@ -294,8 +353,11 @@ public class FloatDict {
|
|
294
353
|
};
|
295
354
|
}
|
296
355
|
|
297
|
-
|
298
|
-
|
356
|
+
/**
|
357
|
+
*
|
358
|
+
* @return
|
359
|
+
*/
|
360
|
+
public Iterator<Float> valueIterator() {
|
299
361
|
return new Iterator<Float>() {
|
300
362
|
int index = -1;
|
301
363
|
|
@@ -318,6 +380,7 @@ public class FloatDict {
|
|
318
380
|
/**
|
319
381
|
* Create a new array and copy each of the values into it.
|
320
382
|
*
|
383
|
+
* @return
|
321
384
|
* @webref floatdict:method
|
322
385
|
* @brief Create a new array and copy each of the values into it
|
323
386
|
*/
|
@@ -329,8 +392,10 @@ public class FloatDict {
|
|
329
392
|
|
330
393
|
/**
|
331
394
|
* Fill an already-allocated array with the values (more efficient than
|
332
|
-
* creating a new array each time).
|
333
|
-
|
395
|
+
* creating a new array each time).If 'array' is null, or not the same
|
396
|
+
size as the number of values, a new array will be allocated and returned.
|
397
|
+
* @param array
|
398
|
+
* @return
|
334
399
|
*/
|
335
400
|
public float[] valueArray(float[] array) {
|
336
401
|
if (array == null || array.length != size()) {
|
@@ -344,6 +409,8 @@ public class FloatDict {
|
|
344
409
|
/**
|
345
410
|
* Return a value for the specified key.
|
346
411
|
*
|
412
|
+
* @param key
|
413
|
+
* @return
|
347
414
|
* @webref floatdict:method
|
348
415
|
* @brief Return a value for the specified key
|
349
416
|
*/
|
@@ -355,8 +422,13 @@ public class FloatDict {
|
|
355
422
|
return values[index];
|
356
423
|
}
|
357
424
|
|
358
|
-
|
359
|
-
|
425
|
+
/**
|
426
|
+
*
|
427
|
+
* @param key
|
428
|
+
* @param alternate
|
429
|
+
* @return
|
430
|
+
*/
|
431
|
+
public float get(String key, float alternate) {
|
360
432
|
int index = index(key);
|
361
433
|
if (index == -1) {
|
362
434
|
return alternate;
|
@@ -366,6 +438,8 @@ public class FloatDict {
|
|
366
438
|
|
367
439
|
|
368
440
|
/**
|
441
|
+
* @param key
|
442
|
+
* @param amount
|
369
443
|
* @webref floatdict:method
|
370
444
|
* @brief Create a new key/value pair or change the value of one
|
371
445
|
*/
|
@@ -378,8 +452,13 @@ public class FloatDict {
|
|
378
452
|
}
|
379
453
|
}
|
380
454
|
|
381
|
-
|
382
|
-
|
455
|
+
/**
|
456
|
+
*
|
457
|
+
* @param index
|
458
|
+
* @param key
|
459
|
+
* @param value
|
460
|
+
*/
|
461
|
+
public void setIndex(int index, String key, float value) {
|
383
462
|
if (index < 0 || index >= count) {
|
384
463
|
throw new ArrayIndexOutOfBoundsException(index);
|
385
464
|
}
|
@@ -389,6 +468,8 @@ public class FloatDict {
|
|
389
468
|
|
390
469
|
|
391
470
|
/**
|
471
|
+
* @param key
|
472
|
+
* @return
|
392
473
|
* @webref floatdict:method
|
393
474
|
* @brief Check if a key is a part of the data structure
|
394
475
|
*/
|
@@ -398,6 +479,8 @@ public class FloatDict {
|
|
398
479
|
|
399
480
|
|
400
481
|
/**
|
482
|
+
* @param key
|
483
|
+
* @param amount
|
401
484
|
* @webref floatdict:method
|
402
485
|
* @brief Add to a value
|
403
486
|
*/
|
@@ -412,6 +495,8 @@ public class FloatDict {
|
|
412
495
|
|
413
496
|
|
414
497
|
/**
|
498
|
+
* @param key
|
499
|
+
* @param amount
|
415
500
|
* @webref floatdict:method
|
416
501
|
* @brief Subtract from a value
|
417
502
|
*/
|
@@ -421,6 +506,8 @@ public class FloatDict {
|
|
421
506
|
|
422
507
|
|
423
508
|
/**
|
509
|
+
* @param key
|
510
|
+
* @param amount
|
424
511
|
* @webref floatdict:method
|
425
512
|
* @brief Multiply a value
|
426
513
|
*/
|
@@ -433,6 +520,8 @@ public class FloatDict {
|
|
433
520
|
|
434
521
|
|
435
522
|
/**
|
523
|
+
* @param key
|
524
|
+
* @param amount
|
436
525
|
* @webref floatdict:method
|
437
526
|
* @brief Divide a value
|
438
527
|
*/
|
@@ -455,6 +544,7 @@ public class FloatDict {
|
|
455
544
|
|
456
545
|
|
457
546
|
/**
|
547
|
+
* @return
|
458
548
|
* @webref floatlist:method
|
459
549
|
* @brief Return the smallest value
|
460
550
|
*/
|
@@ -487,6 +577,11 @@ public class FloatDict {
|
|
487
577
|
|
488
578
|
|
489
579
|
// return the key for the minimum value
|
580
|
+
|
581
|
+
/**
|
582
|
+
*
|
583
|
+
* @return
|
584
|
+
*/
|
490
585
|
public String minKey() {
|
491
586
|
checkMinMax("minKey");
|
492
587
|
int index = minIndex();
|
@@ -498,6 +593,11 @@ public class FloatDict {
|
|
498
593
|
|
499
594
|
|
500
595
|
// return the minimum value, or throw an error if there are no values
|
596
|
+
|
597
|
+
/**
|
598
|
+
*
|
599
|
+
* @return
|
600
|
+
*/
|
501
601
|
public float minValue() {
|
502
602
|
checkMinMax("minValue");
|
503
603
|
int index = minIndex();
|
@@ -509,6 +609,7 @@ public class FloatDict {
|
|
509
609
|
|
510
610
|
|
511
611
|
/**
|
612
|
+
* @return
|
512
613
|
* @webref floatlist:method
|
513
614
|
* @brief Return the largest value
|
514
615
|
*/
|
@@ -542,7 +643,8 @@ public class FloatDict {
|
|
542
643
|
}
|
543
644
|
|
544
645
|
|
545
|
-
/** The key for a max value; null if empty or everything is NaN (no max).
|
646
|
+
/** The key for a max value; null if empty or everything is NaN (no max).
|
647
|
+
* @return */
|
546
648
|
public String maxKey() {
|
547
649
|
//checkMinMax("maxKey");
|
548
650
|
int index = maxIndex();
|
@@ -553,7 +655,8 @@ public class FloatDict {
|
|
553
655
|
}
|
554
656
|
|
555
657
|
|
556
|
-
/** The max value.
|
658
|
+
/** * The max value.(Or NaN if no entries or they're all NaN.)
|
659
|
+
* @return */
|
557
660
|
public float maxValue() {
|
558
661
|
//checkMinMax("maxValue");
|
559
662
|
int index = maxIndex();
|
@@ -563,8 +666,11 @@ public class FloatDict {
|
|
563
666
|
return values[index];
|
564
667
|
}
|
565
668
|
|
566
|
-
|
567
|
-
|
669
|
+
/**
|
670
|
+
*
|
671
|
+
* @return
|
672
|
+
*/
|
673
|
+
public float sum() {
|
568
674
|
double amount = sumDouble();
|
569
675
|
if (amount > Float.MAX_VALUE) {
|
570
676
|
throw new RuntimeException("sum() exceeds " + Float.MAX_VALUE + ", use sumDouble()");
|
@@ -575,8 +681,11 @@ public class FloatDict {
|
|
575
681
|
return (float) amount;
|
576
682
|
}
|
577
683
|
|
578
|
-
|
579
|
-
|
684
|
+
/**
|
685
|
+
*
|
686
|
+
* @return
|
687
|
+
*/
|
688
|
+
public double sumDouble() {
|
580
689
|
double sum = 0;
|
581
690
|
for (int i = 0; i < count; i++) {
|
582
691
|
sum += values[i];
|
@@ -584,14 +693,22 @@ public class FloatDict {
|
|
584
693
|
return sum;
|
585
694
|
}
|
586
695
|
|
587
|
-
|
588
|
-
|
696
|
+
/**
|
697
|
+
*
|
698
|
+
* @param what
|
699
|
+
* @return
|
700
|
+
*/
|
701
|
+
public int index(String what) {
|
589
702
|
Integer found = indices.get(what);
|
590
703
|
return (found == null) ? -1 : found.intValue();
|
591
704
|
}
|
592
705
|
|
593
|
-
|
594
|
-
|
706
|
+
/**
|
707
|
+
*
|
708
|
+
* @param what
|
709
|
+
* @param much
|
710
|
+
*/
|
711
|
+
protected void create(String what, float much) {
|
595
712
|
if (count == keys.length) {
|
596
713
|
keys = PApplet.expand(keys);
|
597
714
|
values = PApplet.expand(values);
|
@@ -604,6 +721,8 @@ public class FloatDict {
|
|
604
721
|
|
605
722
|
|
606
723
|
/**
|
724
|
+
* @param key
|
725
|
+
* @return
|
607
726
|
* @webref floatdict:method
|
608
727
|
* @brief Remove a key/value pair
|
609
728
|
*/
|
@@ -615,8 +734,12 @@ public class FloatDict {
|
|
615
734
|
return index;
|
616
735
|
}
|
617
736
|
|
618
|
-
|
619
|
-
|
737
|
+
/**
|
738
|
+
*
|
739
|
+
* @param index
|
740
|
+
* @return
|
741
|
+
*/
|
742
|
+
public String removeIndex(int index) {
|
620
743
|
if (index < 0 || index >= count) {
|
621
744
|
throw new ArrayIndexOutOfBoundsException(index);
|
622
745
|
}
|
@@ -634,8 +757,12 @@ public class FloatDict {
|
|
634
757
|
return key;
|
635
758
|
}
|
636
759
|
|
637
|
-
|
638
|
-
|
760
|
+
/**
|
761
|
+
*
|
762
|
+
* @param a
|
763
|
+
* @param b
|
764
|
+
*/
|
765
|
+
public void swap(int a, int b) {
|
639
766
|
String tkey = keys[a];
|
640
767
|
float tvalue = values[a];
|
641
768
|
keys[a] = keys[b];
|
@@ -698,13 +825,21 @@ public class FloatDict {
|
|
698
825
|
sortValuesReverse(true);
|
699
826
|
}
|
700
827
|
|
701
|
-
|
702
|
-
|
828
|
+
/**
|
829
|
+
*
|
830
|
+
* @param stable
|
831
|
+
*/
|
832
|
+
public void sortValuesReverse(boolean stable) {
|
703
833
|
sortImpl(false, true, stable);
|
704
834
|
}
|
705
835
|
|
706
|
-
|
707
|
-
|
836
|
+
/**
|
837
|
+
*
|
838
|
+
* @param useKeys
|
839
|
+
* @param reverse
|
840
|
+
* @param stable
|
841
|
+
*/
|
842
|
+
protected void sortImpl(final boolean useKeys, final boolean reverse,
|
708
843
|
final boolean stable) {
|
709
844
|
Sort s = new Sort() {
|
710
845
|
@Override
|
@@ -778,7 +913,8 @@ public class FloatDict {
|
|
778
913
|
}
|
779
914
|
|
780
915
|
|
781
|
-
/** Returns a duplicate copy of this object.
|
916
|
+
/** Returns a duplicate copy of this object.
|
917
|
+
* @return */
|
782
918
|
public FloatDict copy() {
|
783
919
|
FloatDict outgoing = new FloatDict(count);
|
784
920
|
System.arraycopy(keys, 0, outgoing.keys, 0, count);
|
@@ -790,8 +926,10 @@ public class FloatDict {
|
|
790
926
|
return outgoing;
|
791
927
|
}
|
792
928
|
|
793
|
-
|
794
|
-
|
929
|
+
/**
|
930
|
+
*
|
931
|
+
*/
|
932
|
+
public void print() {
|
795
933
|
for (int i = 0; i < size(); i++) {
|
796
934
|
System.out.println(keys[i] + " = " + values[i]);
|
797
935
|
}
|
@@ -812,6 +950,7 @@ public class FloatDict {
|
|
812
950
|
|
813
951
|
/**
|
814
952
|
* Return this dictionary as a String in JSON format.
|
953
|
+
* @return
|
815
954
|
*/
|
816
955
|
public String toJSON() {
|
817
956
|
StringList items = new StringList();
|
@@ -821,8 +960,11 @@ public class FloatDict {
|
|
821
960
|
return "{ " + items.join(", ") + " }";
|
822
961
|
}
|
823
962
|
|
824
|
-
|
825
|
-
|
963
|
+
/**
|
964
|
+
*
|
965
|
+
* @return
|
966
|
+
*/
|
967
|
+
@Override
|
826
968
|
public String toString() {
|
827
969
|
return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
|
828
970
|
}
|