PlayerIO

The fastest way to build online games without breaking a sweat.

Android Client Reference

Android  class documentationClass DatabaseArray

Namespace: com.playerio
Language: Java

Represents an BigDB array of values that can be accessed by index.

DatabaseArray is very similar to the DatabaseObject class since it has methods for getting, setting, checking and removing values. But unlike DatabaseObject, this class also has methods for adding and inserting values, and there is no Save method, since these cannot be saved to a BigDB table, they always have to be a property of an object.

If we for example have an object that can be visualized like this:

Then we would create it in BigDB like this:

However, just like DatabaseObject, DatabaseArray also supports nested property names, and we can refer to values in the array with their index number. Using this, we can make the example object in an easier way, like this:

Getting values works exactly like for DatabaseObject, and we can also use nested properties.

In addition to getting and setting values, we can also add values to the end of the array, insert values in the middle of it, or remove values in the middle of it. Note that the arrays are sparse, this means that removing a value doesn't shift the indexes of the following values, and we can set any value beyond the last value of the array.

Methods

 
public DatabaseArray
add (int value)

Add the given int value to the array

public DatabaseArray
add (long value)

Add the given long value to the array

public DatabaseArray
add (boolean value)

Add the given boolean value to the array

public DatabaseArray
add (DatabaseArray value)

Add the given DatabaseArray value to the array

public DatabaseArray
add (DatabaseObject value)

Add the given DatabaseObject value to the array

public DatabaseArray
add (String value)

Add the given String value to the array

public DatabaseArray
add (float value)

Add the given float value to the array

public DatabaseArray
add (byte[] value)

Add the given byte array value to the array

public DatabaseArray
add (Date value)

Add the given Date value to the array

public DatabaseArray
add (double value)

Add the given double value to the array

public DatabaseArray
addUInt (int value)

Add the given uint value to the array

public void
clear ()

Removes all properties in this array

public boolean
contains (String propertyExpression)

Returns true if the given property exists on this object

public boolean
contains (int index)

Returns true if a value exists at the given index.

public
DatabaseArray ()

Create a new DatabaseArray

public DatabaseArray
getArray (int index)

Get the DatabaseArray property at the given index

public DatabaseArray
getArray (String propertyExpression)

Get the given DatabaseArray property

public boolean
getBool (String propertyExpression)

Get the given boolean property

public boolean
getBool (String propertyExpression, boolean defaultValue)

Get the given boolean property, or the default if it doesn't exist.

public boolean
getBool (int index)

Get the boolean property at the given index.

public boolean
getBool (int index, boolean defaultValue)

Get the boolean property at the given index, or the default if it doesn't exist.

public byte[]
getBytes (String propertyExpression, byte[] defaultValue)

Get the given byte array property, or the default if it doesn't exist.

public byte[]
getBytes (String propertyExpression)

Get the given byte array property

public byte[]
getBytes (int index)

Get the byte array property at the given index.

public byte[]
getBytes (int index, byte[] defaultValue)

Get the byte array property at the given index, or the default if it doesn't exist.

public Date
getDateTime (String propertyExpression)

Get the given Date property

public Date
getDateTime (String propertyExpression, Date defaultValue)

Get the given Date property, or the default if it doesn't exist.

public Date
getDateTime (int index, Date defaultValue)

Get the Date property at the given index, or the default if it doesn't exist.

public Date
getDateTime (int index)

Get the Date property at the given index.

public double
getDouble (int index)

Get the double property at the given index.

public double
getDouble (String propertyExpression)

Get the given double property

public double
getDouble (String propertyExpression, double defaultValue)

Get the given double property, or the default if it doesn't exist.

public double
getDouble (int index, double defaultValue)

Get the double property at the given index, or the default if it doesn't exist.

public float
getFloat (int index)

Get the float property at the given index.

public float
getFloat (int index, float defaultValue)

Get the float property at the given index, or the default if it doesn't exist.

public float
getFloat (String propertyExpression, float defaultValue)

Get the given float property, or the default if it doesn't exist.

public float
getFloat (String propertyExpression)

Get the given float property

public int
getInt (String propertyExpression, int defaultValue)

Get the given int property, or the default if it doesn't exist.

public int
getInt (String propertyExpression)

Get the given int property

public int
getInt (int index, int defaultValue)

Get the String property at the given index, or the default if it doesn't exist.

public int
getInt (int index)

Get the int property at the given index.

public long
getLong (int index)

Get the long property at the given index.

public long
getLong (String propertyExpression)

Get the given long property

public long
getLong (int index, long defaultValue)

Get the long property at the given index, or the default if it doesn't exist.

public long
getLong (String propertyExpression, long defaultValue)

Get the given long property, or the default if it doesn't exist.

public DatabaseObject
getObject (int index)

Get the DatabaseObject property at the given index

public DatabaseObject
getObject (String propertyExpression)

Get the given DatabaseObject property

public String
getString (String propertyExpression)

Get the given String property

public String
getString (int index, String defaultValue)

Get the String property at the given index, or the default if it doesn't exist.

public String
getString (int index)

Get the String property at the given index.

public String
getString (String propertyExpression, String defaultValue)

Get the given String property, or the default if it doesn't exist.

public int
getUInt (String propertyExpression, int defaultValue)

Get the given uint property, or the default if it doesn't exist.

public int
getUInt (String propertyExpression)

Get the given uint property

public int
getUInt (int index, int defaultValue)

Get the uint property at the given index, or the default if it doesn't exist.

public int
getUInt (int index)

Get the uint property at the given index.

public Object
getValue (String propertyExpression)

Get the given property as an object

public Object
getValue (int index)

Get the property at the given index as an Object.

public ArrayList<Integer>
indexes ()

Get the indexes of all properties on this object, sorted

public DatabaseArray
insert (int index, boolean value)

Insert the value at the given index to the given boolean

public DatabaseArray
insert (int index, float value)

Insert the value at the given index to the given float

public DatabaseArray
insert (int index, long value)

Insert the value at the given index to the given long

public DatabaseArray
insert (int index, String value)

Insert the value at the given index to the given string

public DatabaseArray
insert (int index, int value)

Insert the value at the given index to the given int

public DatabaseArray
insert (int index, double value)

Insert the value at the given index to the given double

public DatabaseArray
insert (int index, DatabaseArray value)

Insert the value at the given index to the given DatabaseArray

public DatabaseArray
insert (int index, DatabaseObject value)

Insert the value at the given index to the given DatabaseObject

public DatabaseArray
insert (int index, byte[] value)

Insert the value at the given index to the given byte array

public DatabaseArray
insert (int index, Date value)

Insert the value at the given index to the given Date

public DatabaseArray
insertUInt (int index, int value)

Insert the value at the given index to the given uint

public void
remove (int index)

Remove the value at the given index

public DatabaseArray
remove (String propertyExpression)

Removes the given property from this object

public DatabaseArray
set (String propertyExpression, long value)

Set the given property to the given long value

public DatabaseArray
set (String propertyExpression, boolean value)

Set the given property to the given boolean value

public DatabaseArray
set (String propertyExpression, int value)

Set the given property to the given int value

public DatabaseArray
set (String propertyExpression, String value)

Set the given property to the given string value

public DatabaseArray
set (String propertyExpression, Date value)

Set the given property to the given Date value

public DatabaseArray
set (String propertyExpression, DatabaseObject value)

Set the given property to the given DatabaseObject value

public DatabaseArray
set (String propertyExpression, DatabaseArray value)

Set the given property to the given DatabaseArray value

public DatabaseArray
set (String propertyExpression, byte[] value)

Set the given property to the given bye array value

public DatabaseArray
set (String propertyExpression, float value)

Set the given property to the given float value

public DatabaseArray
set (String propertyExpression, double value)

Set the given property to the given double value

public DatabaseArray
set (int index, byte[] value)

Set the value at the given index to the given byte array

public DatabaseArray
set (int index, double value)

Set the value at the given index to the given double

public DatabaseArray
set (int index, float value)

Set the value at the given index to the given float

public DatabaseArray
set (int index, DatabaseArray value)

Set the value at the given index to the given DatabaseArray

public DatabaseArray
set (int index, DatabaseObject value)

Set the value at the given index to the given DatabaseObject

public DatabaseArray
set (int index, Date value)

Set the value at the given index to the given Date

public DatabaseArray
set (int index, boolean value)

Set the value at the given index to the given boolean

public DatabaseArray
set (int index, String value)

Set the value at the given index to the given string

public DatabaseArray
set (int index, int value)

Set the value at the given index to the given int

public DatabaseArray
set (int index, long value)

Set the value at the given index to the given long

public DatabaseArray
setUInt (int index, int value)

Set the value at the given index to the given uint

public DatabaseArray
setUInt (String propertyExpression, int value)

Set the given property to the given uint value

public int
size ()

Returns the number of values in this array.

DatabaseArray.add

public DatabaseArray
add (int value)

Add the given int value to the array

Arguments

int value

DatabaseArray.add

public DatabaseArray
add (long value)

Add the given long value to the array

Arguments

long value

DatabaseArray.add

public DatabaseArray
add (boolean value)

Add the given boolean value to the array

Arguments

boolean value

DatabaseArray.add

public DatabaseArray
add (DatabaseArray value)

Add the given DatabaseArray value to the array

Arguments

DatabaseArray value

DatabaseArray.add

public DatabaseArray
add (DatabaseObject value)

Add the given DatabaseObject value to the array

Arguments

DatabaseObject value

DatabaseArray.add

public DatabaseArray
add (String value)

Add the given String value to the array

Arguments

String value

DatabaseArray.add

public DatabaseArray
add (float value)

Add the given float value to the array

Arguments

float value

DatabaseArray.add

public DatabaseArray
add (byte[] value)

Add the given byte array value to the array

Arguments

byte[] value

DatabaseArray.add

public DatabaseArray
add (Date value)

Add the given Date value to the array

Arguments

Date value

DatabaseArray.add

public DatabaseArray
add (double value)

Add the given double value to the array

Arguments

double value

DatabaseArray.addUInt

public DatabaseArray
addUInt (int value)

Add the given uint value to the array

Arguments

int value

DatabaseArray.clear

public void
clear ()

Removes all properties in this array

DatabaseArray.contains

public boolean
contains (String propertyExpression)

Returns true if the given property exists on this object

Arguments

String propertyExpression

DatabaseArray.contains

public boolean
contains (int index)

Returns true if a value exists at the given index.

Arguments

int index

DatabaseArray.DatabaseArray

public
DatabaseArray ()

Create a new DatabaseArray

DatabaseArray.getArray

public DatabaseArray
getArray (int index)

Get the DatabaseArray property at the given index

Arguments

int index

DatabaseArray.getArray

public DatabaseArray
getArray (String propertyExpression)

Get the given DatabaseArray property

Arguments

String propertyExpression

DatabaseArray.getBool

public boolean
getBool (String propertyExpression)

Get the given boolean property

Arguments

String propertyExpression

DatabaseArray.getBool

public boolean
getBool (String propertyExpression, boolean defaultValue)

Get the given boolean property, or the default if it doesn't exist.

Arguments

String propertyExpression
boolean defaultValue

DatabaseArray.getBool

public boolean
getBool (int index)

Get the boolean property at the given index.

Arguments

int index

DatabaseArray.getBool

public boolean
getBool (int index, boolean defaultValue)

Get the boolean property at the given index, or the default if it doesn't exist.

Arguments

int index
boolean defaultValue

DatabaseArray.getBytes

public byte[]
getBytes (String propertyExpression, byte[] defaultValue)

Get the given byte array property, or the default if it doesn't exist.

Arguments

String propertyExpression
byte[] defaultValue

DatabaseArray.getBytes

public byte[]
getBytes (String propertyExpression)

Get the given byte array property

Arguments

String propertyExpression

DatabaseArray.getBytes

public byte[]
getBytes (int index)

Get the byte array property at the given index.

Arguments

int index

DatabaseArray.getBytes

public byte[]
getBytes (int index, byte[] defaultValue)

Get the byte array property at the given index, or the default if it doesn't exist.

Arguments

int index
byte[] defaultValue

DatabaseArray.getDateTime

public Date
getDateTime (String propertyExpression)

Get the given Date property

Arguments

String propertyExpression

DatabaseArray.getDateTime

public Date
getDateTime (String propertyExpression, Date defaultValue)

Get the given Date property, or the default if it doesn't exist.

Arguments

String propertyExpression
Date defaultValue

DatabaseArray.getDateTime

public Date
getDateTime (int index, Date defaultValue)

Get the Date property at the given index, or the default if it doesn't exist.

Arguments

int index
Date defaultValue

DatabaseArray.getDateTime

public Date
getDateTime (int index)

Get the Date property at the given index.

Arguments

int index

DatabaseArray.getDouble

public double
getDouble (int index)

Get the double property at the given index.

Arguments

int index

DatabaseArray.getDouble

public double
getDouble (String propertyExpression)

Get the given double property

Arguments

String propertyExpression

DatabaseArray.getDouble

public double
getDouble (String propertyExpression, double defaultValue)

Get the given double property, or the default if it doesn't exist.

Arguments

String propertyExpression
double defaultValue

DatabaseArray.getDouble

public double
getDouble (int index, double defaultValue)

Get the double property at the given index, or the default if it doesn't exist.

Arguments

int index
double defaultValue

DatabaseArray.getFloat

public float
getFloat (int index)

Get the float property at the given index.

Arguments

int index

DatabaseArray.getFloat

public float
getFloat (int index, float defaultValue)

Get the float property at the given index, or the default if it doesn't exist.

Arguments

int index
float defaultValue

DatabaseArray.getFloat

public float
getFloat (String propertyExpression, float defaultValue)

Get the given float property, or the default if it doesn't exist.

Arguments

String propertyExpression
float defaultValue

DatabaseArray.getFloat

public float
getFloat (String propertyExpression)

Get the given float property

Arguments

String propertyExpression

DatabaseArray.getInt

public int
getInt (String propertyExpression, int defaultValue)

Get the given int property, or the default if it doesn't exist.

Arguments

String propertyExpression
int defaultValue

DatabaseArray.getInt

public int
getInt (String propertyExpression)

Get the given int property

Arguments

String propertyExpression

DatabaseArray.getInt

public int
getInt (int index, int defaultValue)

Get the String property at the given index, or the default if it doesn't exist.

Arguments

int index
int defaultValue

DatabaseArray.getInt

public int
getInt (int index)

Get the int property at the given index.

Arguments

int index

DatabaseArray.getLong

public long
getLong (int index)

Get the long property at the given index.

Arguments

int index

DatabaseArray.getLong

public long
getLong (String propertyExpression)

Get the given long property

Arguments

String propertyExpression

DatabaseArray.getLong

public long
getLong (int index, long defaultValue)

Get the long property at the given index, or the default if it doesn't exist.

Arguments

int index
long defaultValue

DatabaseArray.getLong

public long
getLong (String propertyExpression, long defaultValue)

Get the given long property, or the default if it doesn't exist.

Arguments

String propertyExpression
long defaultValue

DatabaseArray.getObject

public DatabaseObject
getObject (int index)

Get the DatabaseObject property at the given index

Arguments

int index

DatabaseArray.getObject

public DatabaseObject
getObject (String propertyExpression)

Get the given DatabaseObject property

Arguments

String propertyExpression

DatabaseArray.getString

public String
getString (String propertyExpression)

Get the given String property

Arguments

String propertyExpression

DatabaseArray.getString

public String
getString (int index, String defaultValue)

Get the String property at the given index, or the default if it doesn't exist.

Arguments

int index
String defaultValue

DatabaseArray.getString

public String
getString (int index)

Get the String property at the given index.

Arguments

int index

DatabaseArray.getString

public String
getString (String propertyExpression, String defaultValue)

Get the given String property, or the default if it doesn't exist.

Arguments

String propertyExpression
String defaultValue

DatabaseArray.getUInt

public int
getUInt (String propertyExpression, int defaultValue)

Get the given uint property, or the default if it doesn't exist.

Arguments

String propertyExpression
int defaultValue

DatabaseArray.getUInt

public int
getUInt (String propertyExpression)

Get the given uint property

Arguments

String propertyExpression

DatabaseArray.getUInt

public int
getUInt (int index, int defaultValue)

Get the uint property at the given index, or the default if it doesn't exist.

Arguments

int index
int defaultValue

DatabaseArray.getUInt

public int
getUInt (int index)

Get the uint property at the given index.

Arguments

int index

DatabaseArray.getValue

public Object
getValue (String propertyExpression)

Get the given property as an object

Arguments

String propertyExpression

DatabaseArray.getValue

public Object
getValue (int index)

Get the property at the given index as an Object.

Arguments

int index

DatabaseArray.indexes

public ArrayList<Integer>
indexes ()

Get the indexes of all properties on this object, sorted

DatabaseArray.insert

public DatabaseArray
insert (int index, boolean value)

Insert the value at the given index to the given boolean

Arguments

int index
boolean value

DatabaseArray.insert

public DatabaseArray
insert (int index, float value)

Insert the value at the given index to the given float

Arguments

int index
float value

DatabaseArray.insert

public DatabaseArray
insert (int index, long value)

Insert the value at the given index to the given long

Arguments

int index
long value

DatabaseArray.insert

public DatabaseArray
insert (int index, String value)

Insert the value at the given index to the given string

Arguments

int index
String value

DatabaseArray.insert

public DatabaseArray
insert (int index, int value)

Insert the value at the given index to the given int

Arguments

int index
int value

DatabaseArray.insert

public DatabaseArray
insert (int index, double value)

Insert the value at the given index to the given double

Arguments

int index
double value

DatabaseArray.insert

public DatabaseArray
insert (int index, DatabaseArray value)

Insert the value at the given index to the given DatabaseArray

Arguments

int index
DatabaseArray value

DatabaseArray.insert

public DatabaseArray
insert (int index, DatabaseObject value)

Insert the value at the given index to the given DatabaseObject

Arguments

int index
DatabaseObject value

DatabaseArray.insert

public DatabaseArray
insert (int index, byte[] value)

Insert the value at the given index to the given byte array

Arguments

int index
byte[] value

DatabaseArray.insert

public DatabaseArray
insert (int index, Date value)

Insert the value at the given index to the given Date

Arguments

int index
Date value

DatabaseArray.insertUInt

public DatabaseArray
insertUInt (int index, int value)

Insert the value at the given index to the given uint

Arguments

int index
int value

DatabaseArray.remove

public void
remove (int index)

Remove the value at the given index

Arguments

int index

DatabaseArray.remove

public DatabaseArray
remove (String propertyExpression)

Removes the given property from this object

Arguments

String propertyExpression

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, long value)

Set the given property to the given long value

Arguments

String propertyExpression
long value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, boolean value)

Set the given property to the given boolean value

Arguments

String propertyExpression
boolean value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, int value)

Set the given property to the given int value

Arguments

String propertyExpression
int value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, String value)

Set the given property to the given string value

Arguments

String propertyExpression
String value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, Date value)

Set the given property to the given Date value

Arguments

String propertyExpression
Date value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, DatabaseObject value)

Set the given property to the given DatabaseObject value

Arguments

String propertyExpression
DatabaseObject value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, DatabaseArray value)

Set the given property to the given DatabaseArray value

Arguments

String propertyExpression
DatabaseArray value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, byte[] value)

Set the given property to the given bye array value

Arguments

String propertyExpression
byte[] value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, float value)

Set the given property to the given float value

Arguments

String propertyExpression
float value

DatabaseArray.set

public DatabaseArray
set (String propertyExpression, double value)

Set the given property to the given double value

Arguments

String propertyExpression
double value

DatabaseArray.set

public DatabaseArray
set (int index, byte[] value)

Set the value at the given index to the given byte array

Arguments

int index
byte[] value

DatabaseArray.set

public DatabaseArray
set (int index, double value)

Set the value at the given index to the given double

Arguments

int index
double value

DatabaseArray.set

public DatabaseArray
set (int index, float value)

Set the value at the given index to the given float

Arguments

int index
float value

DatabaseArray.set

public DatabaseArray
set (int index, DatabaseArray value)

Set the value at the given index to the given DatabaseArray

Arguments

int index
DatabaseArray value

DatabaseArray.set

public DatabaseArray
set (int index, DatabaseObject value)

Set the value at the given index to the given DatabaseObject

Arguments

int index
DatabaseObject value

DatabaseArray.set

public DatabaseArray
set (int index, Date value)

Set the value at the given index to the given Date

Arguments

int index
Date value

DatabaseArray.set

public DatabaseArray
set (int index, boolean value)

Set the value at the given index to the given boolean

Arguments

int index
boolean value

DatabaseArray.set

public DatabaseArray
set (int index, String value)

Set the value at the given index to the given string

Arguments

int index
String value

DatabaseArray.set

public DatabaseArray
set (int index, int value)

Set the value at the given index to the given int

Arguments

int index
int value

DatabaseArray.set

public DatabaseArray
set (int index, long value)

Set the value at the given index to the given long

Arguments

int index
long value

DatabaseArray.setUInt

public DatabaseArray
setUInt (int index, int value)

Set the value at the given index to the given uint

Arguments

int index
int value

DatabaseArray.setUInt

public DatabaseArray
setUInt (String propertyExpression, int value)

Set the given property to the given uint value

Arguments

String propertyExpression
int value

DatabaseArray.size

public int
size ()

Returns the number of values in this array.