Skip to content

Commit 2b78135

Browse files
committed
Added initial reference for JSONArray set and get methods
1 parent 362def0 commit 2b78135

File tree

2 files changed

+40
-34
lines changed

2 files changed

+40
-34
lines changed

core/src/processing/data/JSONArray.java

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected JSONArray(Object array) {
245245

246246
/**
247247
* Get the optional object value associated with an index.
248-
* @param index The index must be between 0 and length() - 1.
248+
* @param index must be between 0 and length() - 1
249249
* @return An object value, or null if there is no
250250
* object at that index.
251251
*/
@@ -259,7 +259,7 @@ private Object opt(int index) {
259259

260260
/**
261261
* Get the object value associated with an index.
262-
* @param index The index must be between 0 and length() - 1.
262+
* @param index must be between 0 and length() - 1
263263
* @return An object value.
264264
* @throws JSONException If there is no value for the index.
265265
*/
@@ -274,11 +274,12 @@ private Object get(int index) {
274274

275275
/**
276276
* Get the string associated with an index.
277-
* @param index The index must be between 0 and length() - 1.
277+
*
278+
* @webref jsonarray:method
279+
* @brief Gets the String value associated with an index
280+
* @param index must be between 0 and length() - 1
278281
* @return A string value.
279282
* @throws JSONException If there is no string value for the index.
280-
* @webref jsonarray:method
281-
* @brief Get the string associated with an index
282283
*/
283284
public String getString(int index) {
284285
Object object = this.get(index);
@@ -292,11 +293,11 @@ public String getString(int index) {
292293
/**
293294
* Get the int value associated with an index.
294295
*
295-
* @param index The index must be between 0 and length() - 1.
296-
* @return The value.
297-
* @throws JSONException If the key is not found or if the value is not a number.
298296
* @webref jsonarray:method
299-
* @brief Get the int value associated with an index
297+
* @brief Gets the int value associated with an index
298+
* @param index must be between 0 and length() - 1
299+
* @return The value.
300+
* @throws JSONException If the key is not found or if the value is not a number.
300301
*/
301302
public int getInt(int index) {
302303
Object object = this.get(index);
@@ -313,7 +314,7 @@ public int getInt(int index) {
313314
/**
314315
* Get the long value associated with an index.
315316
*
316-
* @param index The index must be between 0 and length() - 1.
317+
* @param index The index must be between 0 and length() - 1
317318
* @return The value.
318319
* @throws JSONException If the key is not found or if the value cannot
319320
* be converted to a number.
@@ -335,7 +336,8 @@ public long getLong(int index) {
335336
* internally, so this is simply getDouble() cast to a float.
336337
*
337338
* @webref jsonarray:method
338-
* @brief To come...
339+
* @brief Gets the float value associated with an index
340+
* @param index must be between 0 and length() - 1
339341
*/
340342
public float getFloat(int index) {
341343
return (float) getDouble(index);
@@ -345,7 +347,7 @@ public float getFloat(int index) {
345347
/**
346348
* Get the double value associated with an index.
347349
*
348-
* @param index The index must be between 0 and length() - 1.
350+
* @param index must be between 0 and length() - 1
349351
* @return The value.
350352
* @throws JSONException If the key is not found or if the value cannot
351353
* be converted to a number.
@@ -366,12 +368,12 @@ public double getDouble(int index) {
366368
* Get the boolean value associated with an index.
367369
* The string values "true" and "false" are converted to boolean.
368370
*
369-
* @param index The index must be between 0 and length() - 1.
371+
* @webref jsonarray:method
372+
* @brief Gets the boolean value associated with an index
373+
* @param index must be between 0 and length() - 1
370374
* @return The truth.
371375
* @throws JSONException If there is no value for the index or if the
372376
* value is not convertible to boolean.
373-
* @webref jsonarray:method
374-
* @brief Get the boolean value associated with an index
375377
*/
376378
public boolean getBoolean(int index) {
377379
Object object = this.get(index);
@@ -393,7 +395,7 @@ public boolean getBoolean(int index) {
393395
*
394396
* @webref jsonobject:method
395397
* @brief Gets the JSONArray associated with an index value
396-
* @param index must be between 0 and length() - 1.
398+
* @param index must be between 0 and length() - 1
397399
* @return A JSONArray value.
398400
* @throws JSONException If there is no value for the index. or if the
399401
* value is not a JSONArray
@@ -819,12 +821,13 @@ protected JSONArray append(Object value) {
819821
* Put or replace a String value. If the index is greater than the length of
820822
* the JSONArray, then null elements will be added as necessary to pad
821823
* it out.
822-
* @param index The subscript.
823-
* @param value A String value.
824+
*
825+
* @webref jsonarray:method
826+
* @brief Put a key/String pair in the JSONArray
827+
* @param index an index value
828+
* @param value the value to assign
824829
* @return this.
825830
* @throws JSONException If the index is negative.
826-
* @webref jsonarray:method
827-
* @brief Put or replace a String value
828831
*/
829832
public JSONArray setString(int index, String value) {
830833
this.set(index, value);
@@ -836,12 +839,13 @@ public JSONArray setString(int index, String value) {
836839
* Put or replace an int value. If the index is greater than the length of
837840
* the JSONArray, then null elements will be added as necessary to pad
838841
* it out.
839-
* @param index The subscript.
840-
* @param value An int value.
842+
*
843+
* @webref jsonarray:method
844+
* @brief Put a key/int pair in the JSONArray
845+
* @param index an index value
846+
* @param value the value to assign
841847
* @return this.
842848
* @throws JSONException If the index is negative.
843-
* @webref jsonarray:method
844-
* @brief Put or replace an int value
845849
*/
846850
public JSONArray setInt(int index, int value) {
847851
this.set(index, new Integer(value));
@@ -868,13 +872,14 @@ public JSONArray setLong(int index, long value) {
868872
* of the JSONArray, then null elements will be added as necessary to pad
869873
* it out. There are no 'double' values in JSON, so this is passed to
870874
* setDouble(value).
871-
* @param index The subscript.
872-
* @param value A float value.
875+
*
876+
* @webref jsonarray:method
877+
* @brief Put a key/float pair in the JSONArray
878+
* @param index an index value
879+
* @param value the value to assign
873880
* @return this.
874881
* @throws RuntimeException If the index is negative or if the value is
875882
* not finite.
876-
* @webref jsonarray:method
877-
* @brief Put or replace a float value
878883
*/
879884
public JSONArray setFloat(int index, float value) {
880885
return setDouble(index, value);
@@ -900,12 +905,13 @@ public JSONArray setDouble(int index, double value) {
900905
* Put or replace a boolean value in the JSONArray. If the index is greater
901906
* than the length of the JSONArray, then null elements will be added as
902907
* necessary to pad it out.
903-
* @param index The subscript.
904-
* @param value A boolean value.
908+
*
909+
* @webref jsonarray:method
910+
* @brief Put a key/boolean pair in the JSONArray
911+
* @param index an index value
912+
* @param value the value to assign
905913
* @return this.
906914
* @throws JSONException If the index is negative.
907-
* @webref jsonarray:method
908-
* @brief Put or replace a boolean value
909915
*/
910916
public JSONArray setBoolean(int index, boolean value) {
911917
return set(index, value ? Boolean.TRUE : Boolean.FALSE);
@@ -992,7 +998,7 @@ public int size() {
992998

993999
/**
9941000
* Determine if the value is null.
995-
* @param index The index must be between 0 and length() - 1.
1001+
* @param index must be between 0 and length() - 1
9961002
* @return true if the value at the index is null, or if there is no value.
9971003
*/
9981004
// TODO not sure on this one

core/src/processing/data/JSONObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ private Object get(String key) {
556556
* Gets the String associated with a key
557557
*
558558
* @webref jsonobject:method
559-
* @brief Gets the string associated with a key
559+
* @brief Gets the string value associated with a key
560560
* @param key a key string
561561
* @return A string which is the value.
562562
* @throws JSONException if there is no string value for the key.

0 commit comments

Comments
 (0)