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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +8 -6
  6. data/docs/_editors/geany.md +5 -4
  7. data/docs/_editors/vim.md +6 -0
  8. data/docs/_includes/head.html +1 -0
  9. data/docs/_libraries/control_panel.md +2 -2
  10. data/docs/_libraries/gl_video.md +21 -0
  11. data/docs/_posts/2018-05-06-getting_started.md +10 -9
  12. data/docs/_posts/2018-05-06-install_jruby.md +19 -2
  13. data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
  14. data/docs/_posts/2018-11-18-building-gem.md +18 -0
  15. data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
  16. data/docs/about.md +21 -10
  17. data/docs/assets/android-chrome-192x192.png +0 -0
  18. data/docs/assets/android-chrome-512x512.png +0 -0
  19. data/docs/assets/favicon.ico +0 -0
  20. data/docs/assets/geany.png +0 -0
  21. data/docs/assets/jwishy_picrate.png +0 -0
  22. data/docs/assets/picrate.svg +251 -0
  23. data/docs/index.html +8 -14
  24. data/lib/picrate/runner.rb +6 -2
  25. data/lib/picrate/version.rb +1 -1
  26. data/library/boids/boids.rb +10 -13
  27. data/mvnw +234 -0
  28. data/picrate.gemspec +2 -1
  29. data/pom.rb +1 -1
  30. data/pom.xml +1 -1
  31. data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
  32. data/src/main/java/monkstone/ColorUtil.java +11 -1
  33. data/src/main/java/monkstone/MathToolModule.java +1 -0
  34. data/src/main/java/monkstone/PicrateLibrary.java +1 -0
  35. data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
  36. data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
  37. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  38. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  39. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  40. data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
  41. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  42. data/src/main/java/monkstone/slider/Slider.java +3 -3
  43. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  44. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  45. data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
  46. data/src/main/java/monkstone/vecmath/JRender.java +1 -0
  47. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
  48. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
  49. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
  50. data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
  51. data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
  52. data/src/main/java/processing/core/PApplet.java +18 -12
  53. data/src/main/java/processing/core/PShape.java +1182 -305
  54. data/src/main/java/processing/core/PStyle.java +1 -1
  55. data/src/main/java/processing/core/PSurface.java +1 -1
  56. data/src/main/java/processing/data/FloatDict.java +196 -54
  57. data/src/main/java/processing/data/FloatList.java +167 -54
  58. data/src/main/java/processing/data/IntDict.java +211 -56
  59. data/src/main/java/processing/data/IntList.java +185 -52
  60. data/src/main/java/processing/data/JSONArray.java +69 -20
  61. data/src/main/java/processing/data/JSONObject.java +53 -12
  62. data/src/main/java/processing/data/Sort.java +40 -10
  63. data/src/main/java/processing/data/StringDict.java +159 -49
  64. data/src/main/java/processing/data/StringList.java +147 -42
  65. data/src/main/java/processing/data/Table.java +778 -223
  66. data/src/main/java/processing/data/TableRow.java +26 -2
  67. data/src/main/java/processing/data/XML.java +190 -50
  68. data/src/main/java/processing/event/Event.java +93 -0
  69. data/src/main/java/processing/event/KeyEvent.java +55 -13
  70. data/src/main/java/processing/event/MouseEvent.java +77 -1
  71. data/src/main/java/processing/event/TouchEvent.java +14 -1
  72. data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
  73. data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
  74. data/src/main/java/processing/opengl/LinePath.java +131 -27
  75. data/src/main/java/processing/opengl/LineStroker.java +30 -5
  76. data/src/main/java/processing/opengl/PGL.java +4066 -865
  77. data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
  78. data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
  79. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
  80. data/src/main/java/processing/opengl/PJOGL.java +1460 -248
  81. data/src/main/java/processing/opengl/PShader.java +904 -217
  82. data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
  83. data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
  84. data/src/main/java/processing/opengl/Texture.java +610 -135
  85. data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
  86. data/src/main/resources/icon/icon-1024.png +0 -0
  87. data/src/main/resources/icon/icon-128.png +0 -0
  88. data/src/main/resources/icon/icon-16.png +0 -0
  89. data/src/main/resources/icon/icon-256.png +0 -0
  90. data/src/main/resources/icon/icon-32.png +0 -0
  91. data/src/main/resources/icon/icon-48.png +0 -0
  92. data/src/main/resources/icon/icon-512.png +0 -0
  93. data/src/main/resources/icon/icon-64.png +0 -0
  94. data/vendors/Rakefile +1 -1
  95. metadata +13 -6
  96. data/docs/assets/circle_collisions.png +0 -0
  97. data/docs/favicon.ico +0 -0
@@ -25,7 +25,7 @@ package processing.core;
25
25
 
26
26
  /**
27
27
  *
28
- * @author tux
28
+ * @author Martin Prout
29
29
  */
30
30
  public class PStyle implements PConstants {
31
31
 
@@ -24,7 +24,7 @@ package processing.core;
24
24
 
25
25
  /**
26
26
  *
27
- * @author tux
27
+ * @author Martin Prout
28
28
  */
29
29
  public interface PSurface {
30
30
  /**
@@ -19,14 +19,23 @@ public class FloatDict {
19
19
  /** Number of elements in the table */
20
20
  protected int count;
21
21
 
22
- protected String[] keys;
23
- protected float[] values;
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
- public FloatDict() {
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. This is more efficient than not
38
- * specifying a size. Use it when you know the rough size of the thing you're creating.
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
- * Helpful for situations like sorting and then grabbing the top 50 entries.
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
- public String key;
168
- public float value;
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
- public Iterable<Entry> entries() {
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
- public Iterator<Entry> entryIterator() {
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
- protected void crop() {
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
- public Iterable<String> keys() {
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. This array can be modified.
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
- public String[] keyArray(String[] outgoing) {
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
- public float value(int index) {
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
- public Iterator<Float> valueIterator() {
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). If 'array' is null, or not the same
333
- * size as the number of values, a new array will be allocated and returned.
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
- public float get(String key, float alternate) {
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
- public void setIndex(int index, String key, float value) {
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. (Or NaN if no entries or they're all NaN.) */
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
- public float sum() {
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
- public double sumDouble() {
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
- public int index(String what) {
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
- protected void create(String what, float much) {
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
- public String removeIndex(int index) {
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
- public void swap(int a, int b) {
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
- public void sortValuesReverse(boolean stable) {
828
+ /**
829
+ *
830
+ * @param stable
831
+ */
832
+ public void sortValuesReverse(boolean stable) {
703
833
  sortImpl(false, true, stable);
704
834
  }
705
835
 
706
-
707
- protected void sortImpl(final boolean useKeys, final boolean reverse,
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
- public void print() {
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
- @Override
963
+ /**
964
+ *
965
+ * @return
966
+ */
967
+ @Override
826
968
  public String toString() {
827
969
  return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
828
970
  }