Skip to content

Commit 78ed032

Browse files
author
Scott Murray
committed
Added reference for JSONArray, JSONObject, loadJSONArray(), loadJSONObject(), saveJSONArray(), saveJSONObject()
1 parent 7f174e8 commit 78ed032

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

core/src/processing/core/PApplet.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,13 +6119,24 @@ public JSONObject parseJSONObject(String input) {
61196119

61206120
/**
61216121
* @webref output:files
6122+
* @param filename name of a file in the data folder or a URL
6123+
* @see JSONObject
6124+
* @see JSONArray
6125+
* @see PApplet#loadJSONArray(String)
6126+
* @see PApplet#saveJSONObject(JSONObject, String)
6127+
* @see PApplet#saveJSONArray(JSONArray, String)
61226128
*/
61236129
public JSONObject loadJSONObject(String filename) {
61246130
return new JSONObject(createReader(filename));
61256131
}
61266132

61276133
/**
61286134
* @webref output:files
6135+
* @see JSONObject
6136+
* @see JSONArray
6137+
* @see PApplet#loadJSONObject(String)
6138+
* @see PApplet#loadJSONArray(String)
6139+
* @see PApplet#saveJSONArray(JSONArray, String)
61296140
*/
61306141
public boolean saveJSONObject(JSONObject json, String filename) {
61316142
return saveJSONObject(json, filename, null);
@@ -6143,13 +6154,24 @@ public JSONArray parseJSONArray(String input) {
61436154

61446155
/**
61456156
* @webref output:files
6157+
* @param filename name of a file in the data folder or a URL
6158+
* @see JSONObject
6159+
* @see JSONArray
6160+
* @see PApplet#loadJSONObject(String)
6161+
* @see PApplet#saveJSONObject(JSONObject, String)
6162+
* @see PApplet#saveJSONArray(JSONArray, String)
61466163
*/
61476164
public JSONArray loadJSONArray(String filename) {
61486165
return new JSONArray(createReader(filename));
61496166
}
61506167

61516168
/**
61526169
* @webref output:files
6170+
* @see JSONObject
6171+
* @see JSONArray
6172+
* @see PApplet#loadJSONObject(String)
6173+
* @see PApplet#loadJSONArray(String)
6174+
* @see PApplet#saveJSONObject(JSONObject, String)
61536175
*/
61546176
public boolean saveJSONArray(JSONArray json, String filename) {
61556177
return saveJSONArray(json, filename);

core/src/processing/data/JSONArray.java

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ of this software and associated documentation files (the "Software"), to deal
9292
* @author JSON.org
9393
* @version 2012-11-13
9494
* @webref data:composite
95+
* @see JSONObject
96+
* @see PApplet#loadJSONObject(String)
97+
* @see PApplet#loadJSONArray(String)
98+
* @see PApplet#saveJSONObject(JSONObject, String)
99+
* @see PApplet#saveJSONArray(JSONArray, String)
95100
*/
96101
public class JSONArray {
97102

@@ -103,12 +108,16 @@ public class JSONArray {
103108

104109
/**
105110
* Construct an empty JSONArray.
111+
* @nowebref
106112
*/
107113
public JSONArray() {
108114
this.myArrayList = new ArrayList<Object>();
109115
}
110116

111117

118+
/**
119+
* @nowebref
120+
*/
112121
public JSONArray(Reader reader) {
113122
this(new JSONTokener(reader));
114123
}
@@ -152,6 +161,9 @@ protected JSONArray(JSONTokener x) {
152161
}
153162

154163

164+
/**
165+
* @nowebref
166+
*/
155167
public JSONArray(IntList list) {
156168
myArrayList = new ArrayList<Object>();
157169
for (int item : list.values()) {
@@ -160,6 +172,9 @@ public JSONArray(IntList list) {
160172
}
161173

162174

175+
/**
176+
* @nowebref
177+
*/
163178
public JSONArray(FloatList list) {
164179
myArrayList = new ArrayList<Object>();
165180
for (float item : list.values()) {
@@ -168,6 +183,9 @@ public JSONArray(FloatList list) {
168183
}
169184

170185

186+
/**
187+
* @nowebref
188+
*/
171189
public JSONArray(StringList list) {
172190
myArrayList = new ArrayList<Object>();
173191
for (String item : list.values()) {
@@ -658,10 +676,10 @@ public boolean[] getBooleanArray() {
658676
/**
659677
* Append an String value. This increases the array's length by one.
660678
*
679+
* @webref jsonarray:method
680+
* @brief Appends a String value, increasing the array's length by one
661681
* @param value A String value.
662682
* @return this.
663-
* @webref jsonarray:method
664-
* @brief Append an String value. This increases the array's length by one.
665683
*/
666684
public JSONArray append(String value) {
667685
this.append((Object)value);
@@ -959,9 +977,9 @@ private JSONArray set(int index, Object value) {
959977
/**
960978
* Get the number of elements in the JSONArray, included nulls.
961979
*
962-
* @return The length (or size).
963980
* @webref jsonarray:method
964-
* @brief Get the number of elements in the JSONArray, included nulls
981+
* @brief Gets the number of elements in the JSONArray, included nulls
982+
* @return The length (or size).
965983
*/
966984
public int size() {
967985
return myArrayList.size();
@@ -982,11 +1000,10 @@ protected boolean isNull(int index) {
9821000
/**
9831001
* Remove an index and close the hole.
9841002
*
985-
* @param index The index of the element to be removed.
986-
* @return The value that was associated with the index,
987-
* or null if there was no value.
9881003
* @webref jsonarray:method
9891004
* @brief Remove an index and close the hole
1005+
* @param index The index of the element to be removed.
1006+
* @return The value that was associated with the index, or null if there was no value.
9901007
*/
9911008
public Object remove(int index) {
9921009
Object o = this.opt(index);

core/src/processing/data/JSONObject.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ of this software and associated documentation files (the "Software"), to deal
104104
* @author JSON.org
105105
* @version 2012-12-01
106106
* @webref data:composite
107+
* @see JSONArray
108+
* @see PApplet#loadJSONObject(String)
109+
* @see PApplet#loadJSONArray(String)
110+
* @see PApplet#saveJSONObject(JSONObject, String)
111+
* @see PApplet#saveJSONArray(JSONArray, String)
107112
*/
108113
public class JSONObject {
109114
/**
@@ -189,6 +194,7 @@ public int hashCode() {
189194

190195
/**
191196
* Construct an empty JSONObject.
197+
* @nowebref
192198
*/
193199
public JSONObject() {
194200
this.map = new HashMap<String, Object>();
@@ -215,6 +221,9 @@ public JSONObject() {
215221
// }
216222

217223

224+
/**
225+
* @nowebref
226+
*/
218227
public JSONObject(Reader reader) {
219228
this(new JSONTokener(reader));
220229
}
@@ -299,6 +308,9 @@ protected JSONObject(HashMap<String, Object> map) {
299308
}
300309

301310

311+
/**
312+
* @nowebref
313+
*/
302314
public JSONObject(IntDict dict) {
303315
map = new HashMap<String, Object>();
304316
for (int i = 0; i < dict.size(); i++) {
@@ -307,6 +319,9 @@ public JSONObject(IntDict dict) {
307319
}
308320

309321

322+
/**
323+
* @nowebref
324+
*/
310325
public JSONObject(FloatDict dict) {
311326
map = new HashMap<String, Object>();
312327
for (int i = 0; i < dict.size(); i++) {
@@ -315,6 +330,9 @@ public JSONObject(FloatDict dict) {
315330
}
316331

317332

333+
/**
334+
* @nowebref
335+
*/
318336
public JSONObject(StringDict dict) {
319337
map = new HashMap<String, Object>();
320338
for (int i = 0; i < dict.size(); i++) {

0 commit comments

Comments
 (0)