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 StringDict {
|
|
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 String[] 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 StringDict() {
|
30
39
|
count = 0;
|
31
40
|
keys = new String[10];
|
32
41
|
values = new String[10];
|
@@ -34,10 +43,10 @@ public class StringDict {
|
|
34
43
|
|
35
44
|
|
36
45
|
/**
|
37
|
-
* Create a new lookup pre-allocated to a specific length.
|
38
|
-
|
39
|
-
* Use it when you know the rough size of the thing you're creating.
|
46
|
+
* Create a new lookup pre-allocated to a specific length.This will not
|
47
|
+
change the size(), but is more efficient than not specifying a length. Use it when you know the rough size of the thing you're creating.
|
40
48
|
*
|
49
|
+
* @param length
|
41
50
|
* @nowebref
|
42
51
|
*/
|
43
52
|
public StringDict(int length) {
|
@@ -51,6 +60,7 @@ public class StringDict {
|
|
51
60
|
* Read a set of entries from a Reader that has each key/value pair on
|
52
61
|
* a single line, separated by a tab.
|
53
62
|
*
|
63
|
+
* @param reader
|
54
64
|
* @nowebref
|
55
65
|
*/
|
56
66
|
public StringDict(BufferedReader reader) {
|
@@ -71,6 +81,8 @@ public class StringDict {
|
|
71
81
|
|
72
82
|
|
73
83
|
/**
|
84
|
+
* @param keys
|
85
|
+
* @param values
|
74
86
|
* @nowebref
|
75
87
|
*/
|
76
88
|
public StringDict(String[] keys, String[] values) {
|
@@ -95,6 +107,7 @@ public class StringDict {
|
|
95
107
|
* });
|
96
108
|
* </pre>
|
97
109
|
* It's no Python, but beats a static { } block with HashMap.put() statements.
|
110
|
+
* @param pairs
|
98
111
|
*/
|
99
112
|
public StringDict(String[][] pairs) {
|
100
113
|
count = pairs.length;
|
@@ -110,8 +123,9 @@ public class StringDict {
|
|
110
123
|
|
111
124
|
/**
|
112
125
|
* Create a dictionary that maps between column titles and cell entries
|
113
|
-
* in a TableRow.
|
114
|
-
|
126
|
+
* in a TableRow.If two columns have the same name, the later column's
|
127
|
+
values will override the earlier values.
|
128
|
+
* @param arg0
|
115
129
|
*/
|
116
130
|
public StringDict(TableRow row) {
|
117
131
|
this(row.getColumnCount());
|
@@ -129,6 +143,7 @@ public class StringDict {
|
|
129
143
|
|
130
144
|
|
131
145
|
/**
|
146
|
+
* @return
|
132
147
|
* @webref stringdict:method
|
133
148
|
* @brief Returns the number of key/value pairs
|
134
149
|
*/
|
@@ -138,8 +153,8 @@ public class StringDict {
|
|
138
153
|
|
139
154
|
|
140
155
|
/**
|
141
|
-
* Resize the internal data, this can only be used to shrink the list.
|
142
|
-
|
156
|
+
* 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.
|
157
|
+
* @param arg0
|
143
158
|
*/
|
144
159
|
public void resize(int length) {
|
145
160
|
if (length > count) {
|
@@ -182,10 +197,22 @@ public class StringDict {
|
|
182
197
|
|
183
198
|
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
184
199
|
|
200
|
+
/**
|
201
|
+
*
|
202
|
+
*/
|
203
|
+
|
185
204
|
|
186
205
|
public class Entry {
|
187
|
-
|
188
|
-
|
206
|
+
|
207
|
+
/**
|
208
|
+
*
|
209
|
+
*/
|
210
|
+
public String key;
|
211
|
+
|
212
|
+
/**
|
213
|
+
*
|
214
|
+
*/
|
215
|
+
public String value;
|
189
216
|
|
190
217
|
Entry(String key, String value) {
|
191
218
|
this.key = key;
|
@@ -193,8 +220,11 @@ public class StringDict {
|
|
193
220
|
}
|
194
221
|
}
|
195
222
|
|
196
|
-
|
197
|
-
|
223
|
+
/**
|
224
|
+
*
|
225
|
+
* @return
|
226
|
+
*/
|
227
|
+
public Iterable<Entry> entries() {
|
198
228
|
return new Iterable<Entry>() {
|
199
229
|
|
200
230
|
public Iterator<Entry> iterator() {
|
@@ -203,8 +233,11 @@ public class StringDict {
|
|
203
233
|
};
|
204
234
|
}
|
205
235
|
|
206
|
-
|
207
|
-
|
236
|
+
/**
|
237
|
+
*
|
238
|
+
* @return
|
239
|
+
*/
|
240
|
+
public Iterator<Entry> entryIterator() {
|
208
241
|
return new Iterator<Entry>() {
|
209
242
|
int index = -1;
|
210
243
|
|
@@ -228,21 +261,32 @@ public class StringDict {
|
|
228
261
|
|
229
262
|
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
230
263
|
|
264
|
+
/**
|
265
|
+
*
|
266
|
+
* @param index
|
267
|
+
* @return
|
268
|
+
*/
|
269
|
+
|
231
270
|
|
232
271
|
public String key(int index) {
|
233
272
|
return keys[index];
|
234
273
|
}
|
235
274
|
|
236
|
-
|
237
|
-
|
275
|
+
/**
|
276
|
+
*
|
277
|
+
*/
|
278
|
+
protected void crop() {
|
238
279
|
if (count != keys.length) {
|
239
280
|
keys = PApplet.subset(keys, 0, count);
|
240
281
|
values = PApplet.subset(values, 0, count);
|
241
282
|
}
|
242
283
|
}
|
243
284
|
|
244
|
-
|
245
|
-
|
285
|
+
/**
|
286
|
+
*
|
287
|
+
* @return
|
288
|
+
*/
|
289
|
+
public Iterable<String> keys() {
|
246
290
|
return new Iterable<String>() {
|
247
291
|
|
248
292
|
@Override
|
@@ -254,6 +298,11 @@ public class StringDict {
|
|
254
298
|
|
255
299
|
|
256
300
|
// Use this to iterate when you want to be able to remove elements along the way
|
301
|
+
|
302
|
+
/**
|
303
|
+
*
|
304
|
+
* @return
|
305
|
+
*/
|
257
306
|
public Iterator<String> keyIterator() {
|
258
307
|
return new Iterator<String>() {
|
259
308
|
int index = -1;
|
@@ -275,8 +324,9 @@ public class StringDict {
|
|
275
324
|
|
276
325
|
|
277
326
|
/**
|
278
|
-
* Return a copy of the internal keys array.
|
327
|
+
* Return a copy of the internal keys array.This array can be modified.
|
279
328
|
*
|
329
|
+
* @return
|
280
330
|
* @webref stringdict:method
|
281
331
|
* @brief Return a copy of the internal keys array
|
282
332
|
*/
|
@@ -285,8 +335,12 @@ public class StringDict {
|
|
285
335
|
return keyArray(null);
|
286
336
|
}
|
287
337
|
|
288
|
-
|
289
|
-
|
338
|
+
/**
|
339
|
+
*
|
340
|
+
* @param outgoing
|
341
|
+
* @return
|
342
|
+
*/
|
343
|
+
public String[] keyArray(String[] outgoing) {
|
290
344
|
if (outgoing == null || outgoing.length != count) {
|
291
345
|
outgoing = new String[count];
|
292
346
|
}
|
@@ -294,12 +348,17 @@ public class StringDict {
|
|
294
348
|
return outgoing;
|
295
349
|
}
|
296
350
|
|
297
|
-
|
298
|
-
|
351
|
+
/**
|
352
|
+
*
|
353
|
+
* @param index
|
354
|
+
* @return
|
355
|
+
*/
|
356
|
+
public String value(int index) {
|
299
357
|
return values[index];
|
300
358
|
}
|
301
359
|
|
302
360
|
/**
|
361
|
+
* @return
|
303
362
|
* @webref stringdict:method
|
304
363
|
* @brief Return the internal array being used to store the values
|
305
364
|
*/
|
@@ -313,8 +372,11 @@ public class StringDict {
|
|
313
372
|
};
|
314
373
|
}
|
315
374
|
|
316
|
-
|
317
|
-
|
375
|
+
/**
|
376
|
+
*
|
377
|
+
* @return
|
378
|
+
*/
|
379
|
+
public Iterator<String> valueIterator() {
|
318
380
|
return new Iterator<String>() {
|
319
381
|
int index = -1;
|
320
382
|
|
@@ -337,6 +399,7 @@ public class StringDict {
|
|
337
399
|
/**
|
338
400
|
* Create a new array and copy each of the values into it.
|
339
401
|
*
|
402
|
+
* @return
|
340
403
|
* @webref stringdict:method
|
341
404
|
* @brief Create a new array and copy each of the values into it
|
342
405
|
*/
|
@@ -348,8 +411,10 @@ public class StringDict {
|
|
348
411
|
|
349
412
|
/**
|
350
413
|
* Fill an already-allocated array with the values (more efficient than
|
351
|
-
* creating a new array each time).
|
352
|
-
|
414
|
+
* creating a new array each time).If 'array' is null, or not the same
|
415
|
+
size as the number of values, a new array will be allocated and returned.
|
416
|
+
* @param array
|
417
|
+
* @return
|
353
418
|
*/
|
354
419
|
public String[] valueArray(String[] array) {
|
355
420
|
if (array == null || array.length != size()) {
|
@@ -363,6 +428,8 @@ public class StringDict {
|
|
363
428
|
/**
|
364
429
|
* Return a value for the specified key.
|
365
430
|
*
|
431
|
+
* @param key
|
432
|
+
* @return
|
366
433
|
* @webref stringdict:method
|
367
434
|
* @brief Return a value for the specified key
|
368
435
|
*/
|
@@ -372,8 +439,13 @@ public class StringDict {
|
|
372
439
|
return values[index];
|
373
440
|
}
|
374
441
|
|
375
|
-
|
376
|
-
|
442
|
+
/**
|
443
|
+
*
|
444
|
+
* @param key
|
445
|
+
* @param alternate
|
446
|
+
* @return
|
447
|
+
*/
|
448
|
+
public String get(String key, String alternate) {
|
377
449
|
int index = index(key);
|
378
450
|
if (index == -1) return alternate;
|
379
451
|
return values[index];
|
@@ -381,6 +453,8 @@ public class StringDict {
|
|
381
453
|
|
382
454
|
|
383
455
|
/**
|
456
|
+
* @param key
|
457
|
+
* @param value
|
384
458
|
* @webref stringdict:method
|
385
459
|
* @brief Create a new key/value pair or change the value of one
|
386
460
|
*/
|
@@ -393,8 +467,13 @@ public class StringDict {
|
|
393
467
|
}
|
394
468
|
}
|
395
469
|
|
396
|
-
|
397
|
-
|
470
|
+
/**
|
471
|
+
*
|
472
|
+
* @param index
|
473
|
+
* @param key
|
474
|
+
* @param value
|
475
|
+
*/
|
476
|
+
public void setIndex(int index, String key, String value) {
|
398
477
|
if (index < 0 || index >= count) {
|
399
478
|
throw new ArrayIndexOutOfBoundsException(index);
|
400
479
|
}
|
@@ -402,14 +481,20 @@ public class StringDict {
|
|
402
481
|
values[index] = value;
|
403
482
|
}
|
404
483
|
|
405
|
-
|
406
|
-
|
484
|
+
/**
|
485
|
+
*
|
486
|
+
* @param what
|
487
|
+
* @return
|
488
|
+
*/
|
489
|
+
public int index(String what) {
|
407
490
|
Integer found = indices.get(what);
|
408
491
|
return (found == null) ? -1 : found.intValue();
|
409
492
|
}
|
410
493
|
|
411
494
|
|
412
495
|
/**
|
496
|
+
* @param key
|
497
|
+
* @return
|
413
498
|
* @webref stringdict:method
|
414
499
|
* @brief Check if a key is a part of the data structure
|
415
500
|
*/
|
@@ -417,8 +502,12 @@ public class StringDict {
|
|
417
502
|
return index(key) != -1;
|
418
503
|
}
|
419
504
|
|
420
|
-
|
421
|
-
|
505
|
+
/**
|
506
|
+
*
|
507
|
+
* @param key
|
508
|
+
* @param value
|
509
|
+
*/
|
510
|
+
protected void create(String key, String value) {
|
422
511
|
if (count == keys.length) {
|
423
512
|
keys = PApplet.expand(keys);
|
424
513
|
values = PApplet.expand(values);
|
@@ -430,6 +519,8 @@ public class StringDict {
|
|
430
519
|
}
|
431
520
|
|
432
521
|
/**
|
522
|
+
* @param key
|
523
|
+
* @return
|
433
524
|
* @webref stringdict:method
|
434
525
|
* @brief Remove a key/value pair
|
435
526
|
*/
|
@@ -441,8 +532,12 @@ public class StringDict {
|
|
441
532
|
return index;
|
442
533
|
}
|
443
534
|
|
444
|
-
|
445
|
-
|
535
|
+
/**
|
536
|
+
*
|
537
|
+
* @param index
|
538
|
+
* @return
|
539
|
+
*/
|
540
|
+
public String removeIndex(int index) {
|
446
541
|
if (index < 0 || index >= count) {
|
447
542
|
throw new ArrayIndexOutOfBoundsException(index);
|
448
543
|
}
|
@@ -460,8 +555,12 @@ public class StringDict {
|
|
460
555
|
return key;
|
461
556
|
}
|
462
557
|
|
463
|
-
|
464
|
-
|
558
|
+
/**
|
559
|
+
*
|
560
|
+
* @param a
|
561
|
+
* @param b
|
562
|
+
*/
|
563
|
+
public void swap(int a, int b) {
|
465
564
|
String tkey = keys[a];
|
466
565
|
String tvalue = values[a];
|
467
566
|
keys[a] = keys[b];
|
@@ -513,8 +612,12 @@ public class StringDict {
|
|
513
612
|
sortImpl(false, true);
|
514
613
|
}
|
515
614
|
|
516
|
-
|
517
|
-
|
615
|
+
/**
|
616
|
+
*
|
617
|
+
* @param useKeys
|
618
|
+
* @param reverse
|
619
|
+
*/
|
620
|
+
protected void sortImpl(final boolean useKeys, final boolean reverse) {
|
518
621
|
Sort s = new Sort() {
|
519
622
|
@Override
|
520
623
|
public int size() {
|
@@ -550,7 +653,8 @@ public class StringDict {
|
|
550
653
|
}
|
551
654
|
|
552
655
|
|
553
|
-
/** Returns a duplicate copy of this object.
|
656
|
+
/** Returns a duplicate copy of this object.
|
657
|
+
* @return */
|
554
658
|
public StringDict copy() {
|
555
659
|
StringDict outgoing = new StringDict(count);
|
556
660
|
System.arraycopy(keys, 0, outgoing.keys, 0, count);
|
@@ -562,8 +666,10 @@ public class StringDict {
|
|
562
666
|
return outgoing;
|
563
667
|
}
|
564
668
|
|
565
|
-
|
566
|
-
|
669
|
+
/**
|
670
|
+
*
|
671
|
+
*/
|
672
|
+
public void print() {
|
567
673
|
for (int i = 0; i < size(); i++) {
|
568
674
|
System.out.println(keys[i] + " = " + values[i]);
|
569
675
|
}
|
@@ -584,6 +690,7 @@ public class StringDict {
|
|
584
690
|
|
585
691
|
/**
|
586
692
|
* Return this dictionary as a String in JSON format.
|
693
|
+
* @return
|
587
694
|
*/
|
588
695
|
public String toJSON() {
|
589
696
|
StringList items = new StringList();
|
@@ -593,8 +700,11 @@ public class StringDict {
|
|
593
700
|
return "{ " + items.join(", ") + " }";
|
594
701
|
}
|
595
702
|
|
596
|
-
|
597
|
-
|
703
|
+
/**
|
704
|
+
*
|
705
|
+
* @return
|
706
|
+
*/
|
707
|
+
@Override
|
598
708
|
public String toString() {
|
599
709
|
return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
|
600
710
|
}
|