propane 3.10.0-java → 3.11.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 +2 -0
- data/README.md +7 -7
- data/lib/propane/app.rb +2 -5
- data/lib/propane/helper_methods.rb +6 -6
- data/lib/propane/version.rb +1 -1
- data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
- data/pom.rb +6 -6
- data/pom.xml +6 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
- data/src/main/java/processing/awt/PImageAWT.java +6 -4
- data/src/main/java/processing/core/PApplet.java +71 -59
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
- data/src/main/java/processing/opengl/PShader.java +1 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
- data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
- data/test/test_helper.rb +1 -0
- data/vendors/Rakefile +1 -1
- metadata +29 -155
- data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
- data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/lib/java/monkstone/ColorUtil.java +0 -127
- data/lib/java/monkstone/MathToolModule.java +0 -287
- data/lib/java/monkstone/PropaneLibrary.java +0 -46
- data/lib/java/monkstone/core/LibraryProxy.java +0 -136
- data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
- data/lib/java/monkstone/fastmath/Deglut.java +0 -71
- data/lib/java/monkstone/fastmath/package-info.java +0 -6
- data/lib/java/monkstone/filechooser/Chooser.java +0 -39
- data/lib/java/monkstone/noise/FastTerrain.java +0 -874
- data/lib/java/monkstone/noise/Noise.java +0 -90
- data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/lib/java/monkstone/noise/NoiseMode.java +0 -28
- data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
- data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
- data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
- data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
- data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
- data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
- data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
- data/lib/java/monkstone/slider/Slider.java +0 -61
- data/lib/java/monkstone/slider/SliderBar.java +0 -245
- data/lib/java/monkstone/slider/SliderGroup.java +0 -56
- data/lib/java/monkstone/slider/WheelHandler.java +0 -35
- data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
- data/lib/java/monkstone/vecmath/JRender.java +0 -56
- data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
- data/lib/java/monkstone/vecmath/package-info.java +0 -20
- data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
- data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
- data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
- data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
- data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
- data/lib/java/monkstone/videoevent/package-info.java +0 -20
- data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
- data/lib/java/processing/awt/PImageAWT.java +0 -377
- data/lib/java/processing/awt/PShapeJava2D.java +0 -387
- data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
- data/lib/java/processing/awt/ShimAWT.java +0 -581
- data/lib/java/processing/core/PApplet.java +0 -15156
- data/lib/java/processing/core/PConstants.java +0 -523
- data/lib/java/processing/core/PFont.java +0 -1126
- data/lib/java/processing/core/PGraphics.java +0 -8600
- data/lib/java/processing/core/PImage.java +0 -3377
- data/lib/java/processing/core/PMatrix.java +0 -208
- data/lib/java/processing/core/PMatrix2D.java +0 -562
- data/lib/java/processing/core/PMatrix3D.java +0 -890
- data/lib/java/processing/core/PShape.java +0 -3561
- data/lib/java/processing/core/PShapeOBJ.java +0 -483
- data/lib/java/processing/core/PShapeSVG.java +0 -2016
- data/lib/java/processing/core/PStyle.java +0 -63
- data/lib/java/processing/core/PSurface.java +0 -198
- data/lib/java/processing/core/PSurfaceNone.java +0 -431
- data/lib/java/processing/core/PVector.java +0 -1066
- data/lib/java/processing/core/ThinkDifferent.java +0 -115
- data/lib/java/processing/data/DoubleDict.java +0 -850
- data/lib/java/processing/data/DoubleList.java +0 -928
- data/lib/java/processing/data/FloatDict.java +0 -847
- data/lib/java/processing/data/FloatList.java +0 -936
- data/lib/java/processing/data/IntDict.java +0 -807
- data/lib/java/processing/data/IntList.java +0 -936
- data/lib/java/processing/data/JSONArray.java +0 -1260
- data/lib/java/processing/data/JSONObject.java +0 -2282
- data/lib/java/processing/data/JSONTokener.java +0 -435
- data/lib/java/processing/data/LongDict.java +0 -802
- data/lib/java/processing/data/LongList.java +0 -937
- data/lib/java/processing/data/Sort.java +0 -46
- data/lib/java/processing/data/StringDict.java +0 -613
- data/lib/java/processing/data/StringList.java +0 -800
- data/lib/java/processing/data/Table.java +0 -4936
- data/lib/java/processing/data/TableRow.java +0 -198
- data/lib/java/processing/data/XML.java +0 -1156
- data/lib/java/processing/dxf/RawDXF.java +0 -404
- data/lib/java/processing/event/Event.java +0 -125
- data/lib/java/processing/event/KeyEvent.java +0 -70
- data/lib/java/processing/event/MouseEvent.java +0 -114
- data/lib/java/processing/event/TouchEvent.java +0 -57
- data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
- data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
- data/lib/java/processing/net/Client.java +0 -744
- data/lib/java/processing/net/Server.java +0 -388
- data/lib/java/processing/opengl/FontTexture.java +0 -378
- data/lib/java/processing/opengl/FrameBuffer.java +0 -513
- data/lib/java/processing/opengl/LinePath.java +0 -627
- data/lib/java/processing/opengl/LineStroker.java +0 -681
- data/lib/java/processing/opengl/PGL.java +0 -3483
- data/lib/java/processing/opengl/PGraphics2D.java +0 -615
- data/lib/java/processing/opengl/PGraphics3D.java +0 -281
- data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
- data/lib/java/processing/opengl/PJOGL.java +0 -2008
- data/lib/java/processing/opengl/PShader.java +0 -1484
- data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
- data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
- data/lib/java/processing/opengl/Texture.java +0 -1696
- data/lib/java/processing/opengl/VertexBuffer.java +0 -88
- data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
- data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +0 -27
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,435 +0,0 @@
|
|
1
|
-
package processing.data;
|
2
|
-
|
3
|
-
import java.io.BufferedReader;
|
4
|
-
import java.io.IOException;
|
5
|
-
import java.io.InputStream;
|
6
|
-
import java.io.InputStreamReader;
|
7
|
-
import java.io.Reader;
|
8
|
-
import java.io.StringReader;
|
9
|
-
|
10
|
-
/*
|
11
|
-
Copyright (c) 2002 JSON.org
|
12
|
-
|
13
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
-
of this software and associated documentation files (the "Software"), to deal
|
15
|
-
in the Software without restriction, including without limitation the rights
|
16
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
-
copies of the Software, and to permit persons to whom the Software is
|
18
|
-
furnished to do so, subject to the following conditions:
|
19
|
-
|
20
|
-
The above copyright notice and this permission notice shall be included in all
|
21
|
-
copies or substantial portions of the Software.
|
22
|
-
|
23
|
-
The Software shall be used for Good, not Evil.
|
24
|
-
|
25
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
26
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
27
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
28
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
29
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
30
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
31
|
-
SOFTWARE.
|
32
|
-
*/
|
33
|
-
|
34
|
-
/**
|
35
|
-
* 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.
|
38
|
-
* @author JSON.org
|
39
|
-
* @version 2012-02-16
|
40
|
-
*/
|
41
|
-
class JSONTokener {
|
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
|
-
|
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");
|
96
|
-
}
|
97
|
-
this.index -= 1;
|
98
|
-
this.character -= 1;
|
99
|
-
this.usePrevious = true;
|
100
|
-
this.eof = false;
|
101
|
-
}
|
102
|
-
|
103
|
-
|
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);
|
119
|
-
}
|
120
|
-
return -1;
|
121
|
-
}
|
122
|
-
|
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;
|
137
|
-
}
|
138
|
-
this.back();
|
139
|
-
return true;
|
140
|
-
}
|
141
|
-
|
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;
|
174
|
-
}
|
175
|
-
this.previous = (char) c;
|
176
|
-
return this.previous;
|
177
|
-
}
|
178
|
-
|
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 + "'");
|
191
|
-
}
|
192
|
-
return n;
|
193
|
-
}
|
194
|
-
|
195
|
-
|
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
|
-
}
|
209
|
-
|
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;
|
219
|
-
}
|
220
|
-
return new String(chars);
|
221
|
-
}
|
222
|
-
|
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
|
-
}
|
235
|
-
}
|
236
|
-
}
|
237
|
-
|
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> <small>(double quote)</small> or
|
246
|
-
* <code>'</code> <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();
|
294
|
-
}
|
295
|
-
sb.append(c);
|
296
|
-
}
|
297
|
-
}
|
298
|
-
}
|
299
|
-
|
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();
|
314
|
-
}
|
315
|
-
return sb.toString().trim();
|
316
|
-
}
|
317
|
-
sb.append(c);
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
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();
|
337
|
-
}
|
338
|
-
return sb.toString().trim();
|
339
|
-
}
|
340
|
-
sb.append(c);
|
341
|
-
}
|
342
|
-
}
|
343
|
-
|
344
|
-
|
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
|
-
}
|
367
|
-
|
368
|
-
/*
|
369
|
-
* Handle unquoted text. This could be the values true, false, or
|
370
|
-
* null, or it can be a number. An implementation (such as this one)
|
371
|
-
* is allowed to also accept non-standard forms.
|
372
|
-
*
|
373
|
-
* Accumulate characters until we reach the end of the text or a
|
374
|
-
* 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
|
-
|
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);
|
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
|
-
}
|
435
|
-
}
|