propane 3.4.1-java → 3.7.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +2 -2
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG.md +9 -1
  7. data/Gemfile +2 -0
  8. data/README.md +9 -5
  9. data/Rakefile +10 -11
  10. data/bin/propane +3 -1
  11. data/lib/propane.rb +4 -2
  12. data/lib/propane/app.rb +2 -1
  13. data/lib/propane/creators/sketch_class.rb +7 -1
  14. data/lib/propane/creators/sketch_factory.rb +4 -2
  15. data/lib/propane/creators/sketch_writer.rb +1 -0
  16. data/lib/propane/helper_methods.rb +22 -23
  17. data/lib/propane/helpers/numeric.rb +2 -0
  18. data/lib/propane/helpers/version_error.rb +1 -0
  19. data/lib/propane/library.rb +5 -1
  20. data/lib/propane/library_loader.rb +2 -0
  21. data/lib/propane/native_folder.rb +10 -9
  22. data/lib/propane/native_loader.rb +3 -0
  23. data/lib/propane/runner.rb +20 -14
  24. data/lib/propane/version.rb +2 -1
  25. data/library/boids/boids.rb +21 -11
  26. data/library/color_group/color_group.rb +2 -0
  27. data/library/control_panel/control_panel.rb +8 -5
  28. data/library/dxf/dxf.rb +2 -0
  29. data/library/file_chooser/chooser.rb +10 -9
  30. data/library/file_chooser/file_chooser.rb +10 -9
  31. data/library/library_proxy/library_proxy.rb +2 -0
  32. data/library/net/net.rb +2 -0
  33. data/library/simplex_noise/simplex_noise.rb +2 -0
  34. data/library/slider/slider.rb +23 -22
  35. data/library/vector_utils/vector_utils.rb +4 -0
  36. data/library/video_event/video_event.rb +2 -0
  37. data/pom.rb +37 -36
  38. data/pom.xml +6 -6
  39. data/propane.gemspec +12 -10
  40. data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
  41. data/src/main/java/monkstone/ColorUtil.java +1 -3
  42. data/src/main/java/monkstone/MathToolModule.java +10 -9
  43. data/src/main/java/monkstone/PropaneLibrary.java +2 -2
  44. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  45. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  46. data/src/main/java/monkstone/noise/SimplexNoise.java +2 -2
  47. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  48. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  49. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  50. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  51. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  52. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  53. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  54. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  55. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  56. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -2
  57. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  58. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  59. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  60. data/src/main/java/processing/awt/PGraphicsJava2D.java +781 -285
  61. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  62. data/src/main/java/processing/awt/PShapeJava2D.java +56 -52
  63. data/src/main/java/processing/awt/PSurfaceAWT.java +308 -208
  64. data/src/main/java/processing/awt/ShimAWT.java +581 -0
  65. data/src/main/java/processing/core/PApplet.java +4225 -4855
  66. data/src/main/java/processing/core/PConstants.java +477 -447
  67. data/src/main/java/processing/core/PFont.java +914 -880
  68. data/src/main/java/processing/core/PGraphics.java +150 -134
  69. data/src/main/java/processing/core/PImage.java +275 -372
  70. data/src/main/java/processing/core/PMatrix.java +172 -159
  71. data/src/main/java/processing/core/PMatrix2D.java +478 -415
  72. data/src/main/java/processing/core/PMatrix3D.java +762 -735
  73. data/src/main/java/processing/core/PShape.java +2887 -2651
  74. data/src/main/java/processing/core/PShapeOBJ.java +97 -92
  75. data/src/main/java/processing/core/PShapeSVG.java +1705 -1490
  76. data/src/main/java/processing/core/PStyle.java +40 -37
  77. data/src/main/java/processing/core/PSurface.java +139 -97
  78. data/src/main/java/processing/core/PSurfaceNone.java +296 -218
  79. data/src/main/java/processing/core/PVector.java +995 -963
  80. data/src/main/java/processing/core/ThinkDifferent.java +12 -8
  81. data/src/main/java/processing/data/DoubleDict.java +756 -710
  82. data/src/main/java/processing/data/DoubleList.java +749 -696
  83. data/src/main/java/processing/data/FloatDict.java +748 -702
  84. data/src/main/java/processing/data/FloatList.java +751 -697
  85. data/src/main/java/processing/data/IntDict.java +720 -673
  86. data/src/main/java/processing/data/IntList.java +699 -633
  87. data/src/main/java/processing/data/JSONArray.java +931 -873
  88. data/src/main/java/processing/data/JSONObject.java +1262 -1165
  89. data/src/main/java/processing/data/JSONTokener.java +351 -341
  90. data/src/main/java/processing/data/LongDict.java +710 -663
  91. data/src/main/java/processing/data/LongList.java +701 -635
  92. data/src/main/java/processing/data/Sort.java +37 -41
  93. data/src/main/java/processing/data/StringDict.java +525 -486
  94. data/src/main/java/processing/data/StringList.java +626 -580
  95. data/src/main/java/processing/data/Table.java +3690 -3510
  96. data/src/main/java/processing/data/TableRow.java +182 -183
  97. data/src/main/java/processing/data/XML.java +957 -883
  98. data/src/main/java/processing/event/Event.java +87 -67
  99. data/src/main/java/processing/event/KeyEvent.java +48 -41
  100. data/src/main/java/processing/event/MouseEvent.java +88 -113
  101. data/src/main/java/processing/event/TouchEvent.java +10 -6
  102. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  103. data/src/main/java/processing/javafx/PSurfaceFX.java +149 -121
  104. data/src/main/java/processing/net/Client.java +20 -20
  105. data/src/main/java/processing/net/Server.java +9 -9
  106. data/src/main/java/processing/opengl/FontTexture.java +286 -266
  107. data/src/main/java/processing/opengl/FrameBuffer.java +389 -377
  108. data/src/main/java/processing/opengl/LinePath.java +132 -89
  109. data/src/main/java/processing/opengl/LineStroker.java +588 -581
  110. data/src/main/java/processing/opengl/PGL.java +660 -567
  111. data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
  112. data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
  113. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12378 -12075
  114. data/src/main/java/processing/opengl/PJOGL.java +1753 -1670
  115. data/src/main/java/processing/opengl/PShader.java +369 -461
  116. data/src/main/java/processing/opengl/PShapeOpenGL.java +4678 -4580
  117. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1114 -1027
  118. data/src/main/java/processing/opengl/Texture.java +1492 -1401
  119. data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
  120. data/test/create_test.rb +21 -20
  121. data/test/deglut_spec_test.rb +4 -2
  122. data/test/helper_methods_test.rb +49 -20
  123. data/test/math_tool_test.rb +39 -32
  124. data/test/native_folder.rb +47 -0
  125. data/test/respond_to_test.rb +3 -2
  126. data/test/sketches/key_event.rb +2 -2
  127. data/test/sketches/library/my_library/my_library.rb +3 -0
  128. data/test/test_helper.rb +2 -0
  129. data/test/vecmath_spec_test.rb +35 -22
  130. data/vendors/Rakefile +35 -40
  131. metadata +42 -22
  132. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  133. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  134. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  135. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
@@ -30,396 +30,406 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
30
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
31
  SOFTWARE.
32
32
  */
33
+
33
34
  /**
34
35
  * A JSONTokener takes a source string and extracts characters and tokens from
35
- * it. It is used by the JSONObject and JSONArray constructors to parse JSON
36
- * source strings.
37
- *
36
+ * it. It is used by the JSONObject and JSONArray constructors to parse
37
+ * JSON source strings.
38
38
  * @author JSON.org
39
39
  * @version 2012-02-16
40
40
  */
41
41
  class JSONTokener {
42
42
 
43
- private long character;
44
- private boolean eof;
45
- private long index;
46
- private long line;
47
- private char previous;
48
- private Reader reader;
49
- private boolean usePrevious;
43
+ private long character;
44
+ private boolean eof;
45
+ private long index;
46
+ private long line;
47
+ private char previous;
48
+ private Reader reader;
49
+ private boolean usePrevious;
50
50
 
51
- /**
52
- * Construct a JSONTokener from a Reader.
53
- *
54
- * @param reader A reader.
55
- */
56
- public JSONTokener(Reader reader) {
57
- this.reader = reader.markSupported()
58
- ? reader
59
- : new BufferedReader(reader);
60
- this.eof = false;
61
- this.usePrevious = false;
62
- this.previous = 0;
63
- this.index = 0;
64
- this.character = 1;
65
- this.line = 1;
66
- }
67
51
 
68
- /**
69
- * Construct a JSONTokener from an InputStream.
70
- */
71
- public JSONTokener(InputStream inputStream) {
72
- this(new InputStreamReader(inputStream));
73
- }
52
+ /**
53
+ * Construct a JSONTokener from a Reader.
54
+ *
55
+ * @param reader A reader.
56
+ */
57
+ public JSONTokener(Reader reader) {
58
+ this.reader = reader.markSupported()
59
+ ? reader
60
+ : new BufferedReader(reader);
61
+ this.eof = false;
62
+ this.usePrevious = false;
63
+ this.previous = 0;
64
+ this.index = 0;
65
+ this.character = 1;
66
+ this.line = 1;
67
+ }
74
68
 
75
- /**
76
- * Construct a JSONTokener from a string.
77
- *
78
- * @param s A source string.
79
- */
80
- public JSONTokener(String s) {
81
- this(new StringReader(s));
82
- }
83
69
 
84
- /**
85
- * Back up one character. This provides a sort of lookahead capability, so
86
- * that you can test for a digit or letter before attempting to parse the
87
- * next number or identifier.
88
- */
89
- public void back() {
90
- if (this.usePrevious || this.index <= 0) {
91
- throw new RuntimeException("Stepping back two steps is not supported");
92
- }
93
- this.index -= 1;
94
- this.character -= 1;
95
- this.usePrevious = true;
96
- this.eof = false;
97
- }
70
+ /**
71
+ * Construct a JSONTokener from an InputStream.
72
+ */
73
+ public JSONTokener(InputStream inputStream) {
74
+ this(new InputStreamReader(inputStream));
75
+ }
98
76
 
99
- /**
100
- * Get the hex value of a character (base16).
101
- *
102
- * @param c A character between '0' and '9' or between 'A' and 'F' or
103
- * between 'a' and 'f'.
104
- * @return An int between 0 and 15, or -1 if c was not a hex digit.
105
- */
106
- public static int dehexchar(char c) {
107
- if (c >= '0' && c <= '9') {
108
- return c - '0';
109
- }
110
- if (c >= 'A' && c <= 'F') {
111
- return c - ('A' - 10);
112
- }
113
- if (c >= 'a' && c <= 'f') {
114
- return c - ('a' - 10);
115
- }
116
- return -1;
77
+
78
+ /**
79
+ * Construct a JSONTokener from a string.
80
+ *
81
+ * @param s A source string.
82
+ */
83
+ public JSONTokener(String s) {
84
+ this(new StringReader(s));
85
+ }
86
+
87
+
88
+ /**
89
+ * Back up one character. This provides a sort of lookahead capability,
90
+ * so that you can test for a digit or letter before attempting to parse
91
+ * the next number or identifier.
92
+ */
93
+ public void back() {
94
+ if (this.usePrevious || this.index <= 0) {
95
+ throw new RuntimeException("Stepping back two steps is not supported");
117
96
  }
97
+ this.index -= 1;
98
+ this.character -= 1;
99
+ this.usePrevious = true;
100
+ this.eof = false;
101
+ }
102
+
118
103
 
119
- public boolean end() {
120
- return this.eof && !this.usePrevious;
104
+ /**
105
+ * Get the hex value of a character (base16).
106
+ * @param c A character between '0' and '9' or between 'A' and 'F' or
107
+ * between 'a' and 'f'.
108
+ * @return An int between 0 and 15, or -1 if c was not a hex digit.
109
+ */
110
+ public static int dehexchar(char c) {
111
+ if (c >= '0' && c <= '9') {
112
+ return c - '0';
121
113
  }
114
+ if (c >= 'A' && c <= 'F') {
115
+ return c - ('A' - 10);
116
+ }
117
+ if (c >= 'a' && c <= 'f') {
118
+ return c - ('a' - 10);
119
+ }
120
+ return -1;
121
+ }
122
122
 
123
- /**
124
- * Determine if the source string still contains characters that next() can
125
- * consume.
126
- *
127
- * @return true if not yet at the end of the source.
128
- */
129
- public boolean more() {
130
- this.next();
131
- if (this.end()) {
132
- return false;
133
- }
134
- this.back();
135
- return true;
123
+ public boolean end() {
124
+ return this.eof && !this.usePrevious;
125
+ }
126
+
127
+
128
+ /**
129
+ * Determine if the source string still contains characters that next()
130
+ * can consume.
131
+ * @return true if not yet at the end of the source.
132
+ */
133
+ public boolean more() {
134
+ this.next();
135
+ if (this.end()) {
136
+ return false;
136
137
  }
138
+ this.back();
139
+ return true;
140
+ }
137
141
 
138
- /**
139
- * Get the next character in the source string.
140
- *
141
- * @return The next character, or 0 if past the end of the source string.
142
- */
143
- public char next() {
144
- int c;
145
- if (this.usePrevious) {
146
- this.usePrevious = false;
147
- c = this.previous;
148
- } else {
149
- try {
150
- c = this.reader.read();
151
- } catch (IOException exception) {
152
- throw new RuntimeException(exception);
153
- }
154
-
155
- if (c <= 0) { // End of stream
156
- this.eof = true;
157
- c = 0;
158
- }
159
- }
160
- this.index += 1;
161
- if (this.previous == '\r') {
162
- this.line += 1;
163
- this.character = c == '\n' ? 0 : 1;
164
- } else if (c == '\n') {
165
- this.line += 1;
166
- this.character = 0;
167
- } else {
168
- this.character += 1;
169
- }
170
- this.previous = (char) c;
171
- return this.previous;
142
+
143
+ /**
144
+ * Get the next character in the source string.
145
+ *
146
+ * @return The next character, or 0 if past the end of the source string.
147
+ */
148
+ public char next() {
149
+ int c;
150
+ if (this.usePrevious) {
151
+ this.usePrevious = false;
152
+ c = this.previous;
153
+ } else {
154
+ try {
155
+ c = this.reader.read();
156
+ } catch (IOException exception) {
157
+ throw new RuntimeException(exception);
158
+ }
159
+
160
+ if (c <= 0) { // End of stream
161
+ this.eof = true;
162
+ c = 0;
163
+ }
164
+ }
165
+ this.index += 1;
166
+ if (this.previous == '\r') {
167
+ this.line += 1;
168
+ this.character = c == '\n' ? 0 : 1;
169
+ } else if (c == '\n') {
170
+ this.line += 1;
171
+ this.character = 0;
172
+ } else {
173
+ this.character += 1;
172
174
  }
175
+ this.previous = (char) c;
176
+ return this.previous;
177
+ }
173
178
 
174
- /**
175
- * Consume the next character, and check that it matches a specified
176
- * character.
177
- *
178
- * @param c The character to match.
179
- * @return The character.
180
- * @throws JSONException if the character does not match.
181
- */
182
- public char next(char c) {
183
- char n = this.next();
184
- if (n != c) {
185
- throw new RuntimeException("Expected '" + c + "' and instead saw '" + n + "'");
186
- }
187
- return n;
179
+
180
+ /**
181
+ * Consume the next character, and check that it matches a specified
182
+ * character.
183
+ * @param c The character to match.
184
+ * @return The character.
185
+ * @throws JSONException if the character does not match.
186
+ */
187
+ public char next(char c) {
188
+ char n = this.next();
189
+ if (n != c) {
190
+ throw new RuntimeException("Expected '" + c + "' and instead saw '" + n + "'");
188
191
  }
192
+ return n;
193
+ }
189
194
 
190
- /**
191
- * Get the next n characters.
192
- *
193
- * @param n The number of characters to take.
194
- * @return A string of n characters.
195
- * @throws JSONException Substring bounds error if there are not n
196
- * characters remaining in the source string.
197
- */
198
- public String next(int n) {
199
- if (n == 0) {
200
- return "";
201
- }
202
195
 
203
- char[] chars = new char[n];
204
- int pos = 0;
196
+ /**
197
+ * Get the next n characters.
198
+ *
199
+ * @param n The number of characters to take.
200
+ * @return A string of n characters.
201
+ * @throws JSONException
202
+ * Substring bounds error if there are not
203
+ * n characters remaining in the source string.
204
+ */
205
+ public String next(int n) {
206
+ if (n == 0) {
207
+ return "";
208
+ }
205
209
 
206
- while (pos < n) {
207
- chars[pos] = this.next();
208
- if (this.end()) {
209
- throw new RuntimeException("Substring bounds error");
210
- }
211
- pos += 1;
212
- }
213
- return new String(chars);
210
+ char[] chars = new char[n];
211
+ int pos = 0;
212
+
213
+ while (pos < n) {
214
+ chars[pos] = this.next();
215
+ if (this.end()) {
216
+ throw new RuntimeException("Substring bounds error");
217
+ }
218
+ pos += 1;
214
219
  }
220
+ return new String(chars);
221
+ }
215
222
 
216
- /**
217
- * Get the next char in the string, skipping whitespace.
218
- *
219
- * @throws JSONException
220
- * @return A character, or 0 if there are no more characters.
221
- */
222
- public char nextClean() {
223
- for (;;) {
224
- char c = this.next();
225
- if (c == 0 || c > ' ') {
226
- return c;
227
- }
228
- }
223
+
224
+ /**
225
+ * Get the next char in the string, skipping whitespace.
226
+ * @throws JSONException
227
+ * @return A character, or 0 if there are no more characters.
228
+ */
229
+ public char nextClean() {
230
+ for (;;) {
231
+ char c = this.next();
232
+ if (c == 0 || c > ' ') {
233
+ return c;
234
+ }
229
235
  }
236
+ }
230
237
 
231
- /**
232
- * Return the characters up to the next close quote character. Backslash
233
- * processing is done. The formal JSON format does not allow strings in
234
- * single quotes, but an implementation is allowed to accept them.
235
- *
236
- * @param quote The quoting character, either
237
- * <code>"</code>&nbsp;<small>(double quote)</small> or
238
- * <code>'</code>&nbsp;<small>(single quote)</small>.
239
- * @return A String.
240
- * @throws JSONException Unterminated string.
241
- */
242
- public String nextString(char quote) {
243
- char c;
244
- StringBuilder sb = new StringBuilder();
245
- for (;;) {
246
- c = this.next();
247
- switch (c) {
248
- case 0:
249
- case '\n':
250
- case '\r':
251
- throw new RuntimeException("Unterminated string");
252
- case '\\':
253
- c = this.next();
254
- switch (c) {
255
- case 'b':
256
- sb.append('\b');
257
- break;
258
- case 't':
259
- sb.append('\t');
260
- break;
261
- case 'n':
262
- sb.append('\n');
263
- break;
264
- case 'f':
265
- sb.append('\f');
266
- break;
267
- case 'r':
268
- sb.append('\r');
269
- break;
270
- case 'u':
271
- sb.append((char) Integer.parseInt(this.next(4), 16));
272
- break;
273
- case '"':
274
- case '\'':
275
- case '\\':
276
- case '/':
277
- sb.append(c);
278
- break;
279
- default:
280
- throw new RuntimeException("Illegal escape.");
281
- }
282
- break;
283
- default:
284
- if (c == quote) {
285
- return sb.toString();
286
- }
287
- sb.append(c);
288
- }
238
+
239
+ /**
240
+ * Return the characters up to the next close quote character.
241
+ * Backslash processing is done. The formal JSON format does not
242
+ * allow strings in single quotes, but an implementation is allowed to
243
+ * accept them.
244
+ * @param quote The quoting character, either
245
+ * <code>"</code>&nbsp;<small>(double quote)</small> or
246
+ * <code>'</code>&nbsp;<small>(single quote)</small>.
247
+ * @return A String.
248
+ * @throws JSONException Unterminated string.
249
+ */
250
+ public String nextString(char quote) {
251
+ char c;
252
+ StringBuilder sb = new StringBuilder();
253
+ for (;;) {
254
+ c = this.next();
255
+ switch (c) {
256
+ case 0:
257
+ case '\n':
258
+ case '\r':
259
+ throw new RuntimeException("Unterminated string");
260
+ case '\\':
261
+ c = this.next();
262
+ switch (c) {
263
+ case 'b':
264
+ sb.append('\b');
265
+ break;
266
+ case 't':
267
+ sb.append('\t');
268
+ break;
269
+ case 'n':
270
+ sb.append('\n');
271
+ break;
272
+ case 'f':
273
+ sb.append('\f');
274
+ break;
275
+ case 'r':
276
+ sb.append('\r');
277
+ break;
278
+ case 'u':
279
+ sb.append((char)Integer.parseInt(this.next(4), 16));
280
+ break;
281
+ case '"':
282
+ case '\'':
283
+ case '\\':
284
+ case '/':
285
+ sb.append(c);
286
+ break;
287
+ default:
288
+ throw new RuntimeException("Illegal escape.");
289
+ }
290
+ break;
291
+ default:
292
+ if (c == quote) {
293
+ return sb.toString();
289
294
  }
295
+ sb.append(c);
296
+ }
290
297
  }
298
+ }
291
299
 
292
- /**
293
- * Get the text up but not including the specified character or the end of
294
- * line, whichever comes first.
295
- *
296
- * @param delimiter A delimiter character.
297
- * @return A string.
298
- */
299
- public String nextTo(char delimiter) {
300
- StringBuilder sb = new StringBuilder();
301
- for (;;) {
302
- char c = this.next();
303
- if (c == delimiter || c == 0 || c == '\n' || c == '\r') {
304
- if (c != 0) {
305
- this.back();
306
- }
307
- return sb.toString().trim();
308
- }
309
- sb.append(c);
300
+
301
+ /**
302
+ * Get the text up but not including the specified character or the
303
+ * end of line, whichever comes first.
304
+ * @param delimiter A delimiter character.
305
+ * @return A string.
306
+ */
307
+ public String nextTo(char delimiter) {
308
+ StringBuilder sb = new StringBuilder();
309
+ for (;;) {
310
+ char c = this.next();
311
+ if (c == delimiter || c == 0 || c == '\n' || c == '\r') {
312
+ if (c != 0) {
313
+ this.back();
310
314
  }
315
+ return sb.toString().trim();
316
+ }
317
+ sb.append(c);
311
318
  }
319
+ }
312
320
 
313
- /**
314
- * Get the text up but not including one of the specified delimiter
315
- * characters or the end of line, whichever comes first.
316
- *
317
- * @param delimiters A set of delimiter characters.
318
- * @return A string, trimmed.
319
- */
320
- public String nextTo(String delimiters) {
321
- char c;
322
- StringBuilder sb = new StringBuilder();
323
- for (;;) {
324
- c = this.next();
325
- if (delimiters.indexOf(c) >= 0 || c == 0
326
- || c == '\n' || c == '\r') {
327
- if (c != 0) {
328
- this.back();
329
- }
330
- return sb.toString().trim();
331
- }
332
- sb.append(c);
321
+
322
+ /**
323
+ * Get the text up but not including one of the specified delimiter
324
+ * characters or the end of line, whichever comes first.
325
+ * @param delimiters A set of delimiter characters.
326
+ * @return A string, trimmed.
327
+ */
328
+ public String nextTo(String delimiters) {
329
+ char c;
330
+ StringBuilder sb = new StringBuilder();
331
+ for (;;) {
332
+ c = this.next();
333
+ if (delimiters.indexOf(c) >= 0 || c == 0 ||
334
+ c == '\n' || c == '\r') {
335
+ if (c != 0) {
336
+ this.back();
333
337
  }
338
+ return sb.toString().trim();
339
+ }
340
+ sb.append(c);
334
341
  }
342
+ }
335
343
 
336
- /**
337
- * Get the next value. The value can be a Boolean, Double, Integer,
338
- * JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
339
- *
340
- * @throws JSONException If syntax error.
341
- *
342
- * @return An object.
343
- */
344
- public Object nextValue() {
345
- char c = this.nextClean();
346
- String string;
347
344
 
348
- switch (c) {
349
- case '"':
350
- case '\'':
351
- return this.nextString(c);
352
- case '{':
353
- this.back();
354
- return new JSONObject(this);
355
- case '[':
356
- this.back();
357
- return new JSONArray(this);
358
- }
345
+ /**
346
+ * Get the next value. The value can be a Boolean, Double, Integer,
347
+ * JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
348
+ * @throws JSONException If syntax error.
349
+ *
350
+ * @return An object.
351
+ */
352
+ public Object nextValue() {
353
+ char c = this.nextClean();
354
+ String string;
355
+
356
+ switch (c) {
357
+ case '"':
358
+ case '\'':
359
+ return this.nextString(c);
360
+ case '{':
361
+ this.back();
362
+ return new JSONObject(this);
363
+ case '[':
364
+ this.back();
365
+ return new JSONArray(this);
366
+ }
359
367
 
360
- /*
368
+ /*
361
369
  * Handle unquoted text. This could be the values true, false, or
362
370
  * null, or it can be a number. An implementation (such as this one)
363
371
  * is allowed to also accept non-standard forms.
364
372
  *
365
373
  * Accumulate characters until we reach the end of the text or a
366
374
  * formatting character.
367
- */
368
- StringBuilder sb = new StringBuilder();
369
- while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
370
- sb.append(c);
371
- c = this.next();
372
- }
373
- this.back();
375
+ */
374
376
 
375
- string = sb.toString().trim();
376
- if ("".equals(string)) {
377
- throw new RuntimeException("Missing value");
378
- }
379
- return JSONObject.stringToValue(string);
377
+ StringBuilder sb = new StringBuilder();
378
+ while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
379
+ sb.append(c);
380
+ c = this.next();
380
381
  }
382
+ this.back();
381
383
 
382
- /**
383
- * Skip characters until the next character is the requested character. If
384
- * the requested character is not found, no characters are skipped.
385
- *
386
- * @param to A character to skip to.
387
- * @return The requested character, or zero if the requested character is
388
- * not found.
389
- */
390
- public char skipTo(char to) {
391
- char c;
392
- try {
393
- long startIndex = this.index;
394
- long startCharacter = this.character;
395
- long startLine = this.line;
396
- this.reader.mark(1000000);
397
- do {
398
- c = this.next();
399
- if (c == 0) {
400
- this.reader.reset();
401
- this.index = startIndex;
402
- this.character = startCharacter;
403
- this.line = startLine;
404
- return c;
405
- }
406
- } while (c != to);
407
- } catch (IOException exc) {
408
- throw new RuntimeException(exc);
409
- }
410
-
411
- this.back();
412
- return c;
384
+ string = sb.toString().trim();
385
+ if ("".equals(string)) {
386
+ throw new RuntimeException("Missing value");
413
387
  }
388
+ return JSONObject.stringToValue(string);
389
+ }
414
390
 
415
- /**
416
- * Make a printable string of this JSONTokener.
417
- *
418
- * @return " at {index} [character {character} line {line}]"
419
- */
420
- @Override
421
- public String toString() {
422
- return " at " + this.index + " [character " + this.character + " line "
423
- + this.line + "]";
391
+
392
+ /**
393
+ * Skip characters until the next character is the requested character.
394
+ * If the requested character is not found, no characters are skipped.
395
+ * @param to A character to skip to.
396
+ * @return The requested character, or zero if the requested character
397
+ * is not found.
398
+ */
399
+ public char skipTo(char to) {
400
+ char c;
401
+ try {
402
+ long startIndex = this.index;
403
+ long startCharacter = this.character;
404
+ long startLine = this.line;
405
+ this.reader.mark(1000000);
406
+ do {
407
+ c = this.next();
408
+ if (c == 0) {
409
+ this.reader.reset();
410
+ this.index = startIndex;
411
+ this.character = startCharacter;
412
+ this.line = startLine;
413
+ return c;
414
+ }
415
+ } while (c != to);
416
+ } catch (IOException exc) {
417
+ throw new RuntimeException(exc);
424
418
  }
419
+
420
+ this.back();
421
+ return c;
422
+ }
423
+
424
+
425
+ /**
426
+ * Make a printable string of this JSONTokener.
427
+ *
428
+ * @return " at {index} [character {character} line {line}]"
429
+ */
430
+ @Override
431
+ public String toString() {
432
+ return " at " + this.index + " [character " + this.character + " line " +
433
+ this.line + "]";
434
+ }
425
435
  }