propane 3.1.0.pre-java → 3.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -0
  3. data/CHANGELOG.md +1 -5
  4. data/README.md +23 -12
  5. data/Rakefile +23 -12
  6. data/lib/propane/helpers/version_error.rb +6 -0
  7. data/lib/propane/runner.rb +12 -0
  8. data/lib/propane/version.rb +1 -1
  9. data/library/slider/slider.rb +1 -1
  10. data/mvnw +234 -0
  11. data/mvnw.cmd +145 -0
  12. data/pom.xml +28 -27
  13. data/propane.gemspec +2 -2
  14. data/src/main/java/japplemenubar/JAppleMenuBar.java +41 -47
  15. data/src/main/java/monkstone/ColorUtil.java +1 -1
  16. data/src/main/java/monkstone/MathToolModule.java +12 -11
  17. data/src/main/java/monkstone/PropaneLibrary.java +9 -10
  18. data/src/main/java/monkstone/core/LibraryProxy.java +124 -113
  19. data/src/main/java/monkstone/fastmath/Deglut.java +86 -89
  20. data/src/main/java/monkstone/filechooser/Chooser.java +7 -13
  21. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -1
  22. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +4 -4
  23. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  24. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +9 -9
  25. data/src/main/java/monkstone/slider/SimpleSlider.java +0 -9
  26. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +11 -13
  27. data/src/main/java/monkstone/slider/Slider.java +1 -1
  28. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  29. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  30. data/src/main/java/monkstone/slider/WheelHandler.java +8 -9
  31. data/src/main/java/monkstone/vecmath/AppRender.java +2 -2
  32. data/src/main/java/monkstone/vecmath/ShapeRender.java +2 -2
  33. data/src/main/java/monkstone/vecmath/package-info.java +2 -2
  34. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +2 -2
  35. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  36. data/src/main/java/monkstone/videoevent/VideoInterface.java +11 -5
  37. data/src/main/java/monkstone/videoevent/package-info.java +2 -2
  38. data/src/main/java/processing/awt/PGraphicsJava2D.java +1742 -2243
  39. data/src/main/java/processing/awt/PShapeJava2D.java +268 -270
  40. data/src/main/java/processing/awt/PSurfaceAWT.java +821 -920
  41. data/src/main/java/processing/core/DesktopHandler.java +94 -0
  42. data/src/main/java/processing/core/PApplet.java +14170 -14082
  43. data/src/main/java/processing/core/PConstants.java +447 -473
  44. data/src/main/java/processing/core/PFont.java +867 -873
  45. data/src/main/java/processing/core/PGraphics.java +7193 -7428
  46. data/src/main/java/processing/core/PImage.java +3051 -3117
  47. data/src/main/java/processing/core/PMatrix.java +159 -172
  48. data/src/main/java/processing/core/PMatrix2D.java +403 -444
  49. data/src/main/java/processing/core/PMatrix3D.java +735 -749
  50. data/src/main/java/processing/core/PShape.java +2651 -2793
  51. data/src/main/java/processing/core/PShapeOBJ.java +415 -422
  52. data/src/main/java/processing/core/PShapeSVG.java +1466 -1475
  53. data/src/main/java/processing/core/PStyle.java +37 -40
  54. data/src/main/java/processing/core/PSurface.java +98 -103
  55. data/src/main/java/processing/core/PSurfaceNone.java +208 -236
  56. data/src/main/java/processing/core/PVector.java +961 -990
  57. data/src/main/java/processing/data/DoubleDict.java +709 -753
  58. data/src/main/java/processing/data/DoubleList.java +695 -748
  59. data/src/main/java/processing/data/FloatDict.java +702 -746
  60. data/src/main/java/processing/data/FloatList.java +697 -751
  61. data/src/main/java/processing/data/IntDict.java +673 -718
  62. data/src/main/java/processing/data/IntList.java +633 -699
  63. data/src/main/java/processing/data/JSONArray.java +873 -931
  64. data/src/main/java/processing/data/JSONObject.java +1165 -1262
  65. data/src/main/java/processing/data/JSONTokener.java +341 -351
  66. data/src/main/java/processing/data/LongDict.java +662 -707
  67. data/src/main/java/processing/data/LongList.java +634 -700
  68. data/src/main/java/processing/data/Sort.java +41 -37
  69. data/src/main/java/processing/data/StringDict.java +486 -522
  70. data/src/main/java/processing/data/StringList.java +580 -624
  71. data/src/main/java/processing/data/Table.java +3508 -3686
  72. data/src/main/java/processing/data/TableRow.java +183 -182
  73. data/src/main/java/processing/data/XML.java +883 -957
  74. data/src/main/java/processing/event/Event.java +66 -87
  75. data/src/main/java/processing/event/KeyEvent.java +41 -48
  76. data/src/main/java/processing/event/MouseEvent.java +93 -103
  77. data/src/main/java/processing/event/TouchEvent.java +6 -10
  78. data/src/main/java/processing/javafx/PGraphicsFX2D.java +5 -69
  79. data/src/main/java/processing/javafx/PSurfaceFX.java +2 -7
  80. data/src/main/java/processing/opengl/FontTexture.java +270 -290
  81. data/src/main/java/processing/opengl/FrameBuffer.java +363 -375
  82. data/src/main/java/processing/opengl/LinePath.java +500 -543
  83. data/src/main/java/processing/opengl/LineStroker.java +582 -593
  84. data/src/main/java/processing/opengl/PGL.java +2881 -2904
  85. data/src/main/java/processing/opengl/PGraphics2D.java +315 -408
  86. data/src/main/java/processing/opengl/PGraphics3D.java +72 -107
  87. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12043 -12230
  88. data/src/main/java/processing/opengl/PJOGL.java +1681 -1745
  89. data/src/main/java/processing/opengl/PShader.java +1257 -1260
  90. data/src/main/java/processing/opengl/PShapeOpenGL.java +4599 -4662
  91. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1030 -1047
  92. data/src/main/java/processing/opengl/Texture.java +1397 -1462
  93. data/src/main/java/processing/opengl/VertexBuffer.java +55 -57
  94. data/src/main/resources/icon/icon-1024.png +0 -0
  95. data/src/main/resources/icon/icon-128.png +0 -0
  96. data/src/main/resources/icon/icon-16.png +0 -0
  97. data/src/main/resources/icon/icon-256.png +0 -0
  98. data/src/main/resources/icon/icon-32.png +0 -0
  99. data/src/main/resources/icon/icon-48.png +0 -0
  100. data/src/main/resources/icon/icon-512.png +0 -0
  101. data/src/main/resources/icon/icon-64.png +0 -0
  102. data/vendors/Rakefile +1 -1
  103. metadata +12 -8
  104. data/src/main/java/processing/core/ThinkDifferent.java +0 -70
@@ -30,406 +30,396 @@ 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
-
34
33
  /**
35
34
  * A JSONTokener takes a source string and extracts characters and tokens from
36
- * it. It is used by the JSONObject and JSONArray constructors to parse
37
- * JSON source strings.
35
+ * it. It is used by the JSONObject and JSONArray constructors to parse JSON
36
+ * source strings.
37
+ *
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;
50
-
51
-
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
- }
68
-
69
-
70
- /**
71
- * Construct a JSONTokener from an InputStream.
72
- */
73
- public JSONTokener(InputStream inputStream) {
74
- this(new InputStreamReader(inputStream));
75
- }
76
-
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;
77
50
 
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");
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;
96
66
  }
97
- this.index -= 1;
98
- this.character -= 1;
99
- this.usePrevious = true;
100
- this.eof = false;
101
- }
102
-
103
67
 
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';
113
- }
114
- if (c >= 'A' && c <= 'F') {
115
- return c - ('A' - 10);
116
- }
117
- if (c >= 'a' && c <= 'f') {
118
- return c - ('a' - 10);
68
+ /**
69
+ * Construct a JSONTokener from an InputStream.
70
+ */
71
+ public JSONTokener(InputStream inputStream) {
72
+ this(new InputStreamReader(inputStream));
119
73
  }
120
- return -1;
121
- }
122
-
123
- public boolean end() {
124
- return this.eof && !this.usePrevious;
125
- }
126
-
127
74
 
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;
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));
137
82
  }
138
- this.back();
139
- return true;
140
- }
141
-
142
83
 
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;
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;
174
97
  }
175
- this.previous = (char) c;
176
- return this.previous;
177
- }
178
-
179
98
 
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 + "'");
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;
191
117
  }
192
- return n;
193
- }
194
-
195
118
 
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 "";
119
+ public boolean end() {
120
+ return this.eof && !this.usePrevious;
208
121
  }
209
122
 
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;
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;
219
136
  }
220
- return new String(chars);
221
- }
222
-
223
137
 
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
- }
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;
235
172
  }
236
- }
237
173
 
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;
188
+ }
238
189
 
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.");
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 "";
289
201
  }
290
- break;
291
- default:
292
- if (c == quote) {
293
- return sb.toString();
202
+
203
+ char[] chars = new char[n];
204
+ int pos = 0;
205
+
206
+ while (pos < n) {
207
+ chars[pos] = this.next();
208
+ if (this.end()) {
209
+ throw new RuntimeException("Substring bounds error");
210
+ }
211
+ pos += 1;
294
212
  }
295
- sb.append(c);
296
- }
213
+ return new String(chars);
297
214
  }
298
- }
299
-
300
215
 
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();
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
+ }
314
228
  }
315
- return sb.toString().trim();
316
- }
317
- sb.append(c);
318
229
  }
319
- }
320
230
 
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
+ }
289
+ }
290
+ }
321
291
 
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();
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);
337
310
  }
338
- return sb.toString().trim();
339
- }
340
- sb.append(c);
341
311
  }
342
- }
343
312
 
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);
333
+ }
334
+ }
344
335
 
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;
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;
355
347
 
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
- }
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
+ }
367
359
 
368
- /*
360
+ /*
369
361
  * Handle unquoted text. This could be the values true, false, or
370
362
  * null, or it can be a number. An implementation (such as this one)
371
363
  * is allowed to also accept non-standard forms.
372
364
  *
373
365
  * Accumulate characters until we reach the end of the text or a
374
366
  * formatting character.
375
- */
376
-
377
- StringBuilder sb = new StringBuilder();
378
- while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
379
- sb.append(c);
380
- c = this.next();
381
- }
382
- this.back();
383
-
384
- string = sb.toString().trim();
385
- if ("".equals(string)) {
386
- throw new RuntimeException("Missing value");
387
- }
388
- return JSONObject.stringToValue(string);
389
- }
390
-
367
+ */
368
+ StringBuilder sb = new StringBuilder();
369
+ while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
370
+ sb.append(c);
371
+ c = this.next();
372
+ }
373
+ this.back();
391
374
 
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;
375
+ string = sb.toString().trim();
376
+ if ("".equals(string)) {
377
+ throw new RuntimeException("Missing value");
414
378
  }
415
- } while (c != to);
416
- } catch (IOException exc) {
417
- throw new RuntimeException(exc);
379
+ return JSONObject.stringToValue(string);
418
380
  }
419
381
 
420
- this.back();
421
- return c;
422
- }
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
+ }
423
410
 
411
+ this.back();
412
+ return c;
413
+ }
424
414
 
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
- }
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 + "]";
424
+ }
435
425
  }