public class Array extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Array.ArrayType |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double value)
Returns true if the array contains this real value.
|
boolean |
contains(float value)
Returns true if the array contains this real value.
|
boolean |
contains(int value)
Returns true if the array contains this integer value.
|
boolean |
contains(String value)
Returns true if the array contains this string value.
|
static Array |
create(Element arrayE)
Static factory method for creating non-sparse or sparse array types as
needed.
|
static Array |
create(List<Object> values,
List<Integer> indices) |
Array.ArrayType |
getType()
Get the type of this array.
|
int |
index(int position)
Returns the index of the value stored at the given position
|
static boolean |
isArray(Element arrayE)
Utility method to check if an XML element is an array.
|
boolean |
isSparse()
Is this array a SparseArray?
|
int |
numValues()
Get the number of values in this array.
|
String |
toString() |
String |
value(int index)
Gets the value at index from the array.
|
double |
valueDouble(int index)
Gets the value at index from the array as a double.
|
float |
valueFloat(int index)
Gets the value at index from the array as a float.
|
int |
valueInt(int index)
Gets the value at index from the array as an int.
|
String |
valueSparse(int indexOfIndex)
Gets the value at indexOfIndex from the array.
|
double |
valueSparseDouble(int indexOfIndex)
Gets the value at indexOfIndex from the array.
|
float |
valueSparseFloat(int indexOfIndex)
Gets the value at indexOfIndex from the array.
|
int |
valueSparseInt(int indexOfIndex)
Gets the value at indexOfIndex from the array.
|
String |
valueSparseString(int indexOfIndex)
Gets the value at indexOfIndex from the array.
|
String |
valueString(int index)
Gets the value at index from the array as a String.
|
public static boolean isArray(Element arrayE)
arrayE
- the XML element to checkpublic static Array create(List<Object> values, List<Integer> indices) throws Exception
Exception
public static Array create(Element arrayE) throws Exception
arrayE
- the XML element encapsulating the arrayException
- if there is a problem when constructing the arraypublic Array.ArrayType getType()
public boolean isSparse()
public int numValues()
public boolean contains(String value)
value
- the value to check for.public boolean contains(int value)
value
- the value to check forpublic boolean contains(double value)
value
- the value to check forpublic boolean contains(float value)
value
- the value to check forpublic int index(int position)
position
- the positionpublic String value(int index) throws Exception
index
- the index of the value to get.Exception
- if index is out of bounds.public String valueString(int index) throws Exception
index
- the index of the value to get.Exception
- if index is out of bounds.public double valueDouble(int index) throws Exception
index
- the index of the value to get.Exception
- if index is out of bounds.public float valueFloat(int index) throws Exception
index
- the index of the value to get.Exception
- if index is out of bounds.public int valueInt(int index) throws Exception
index
- the index of the value to get.Exception
- if index is out of bounds.public String valueSparse(int indexOfIndex) throws Exception
indexOfIndex
- the index of the index of the value to get.Exception
- if indexOfIndex is out of bounds.public String valueSparseString(int indexOfIndex) throws Exception
indexOfIndex
- the index of the index of the value to get.Exception
- if indexOfIndex is out of bounds.public double valueSparseDouble(int indexOfIndex) throws Exception
indexOfIndex
- the index of the index of the value to get.Exception
- if indexOfIndex is out of bounds.public float valueSparseFloat(int indexOfIndex) throws Exception
indexOfIndex
- the index of the index of the value to get.Exception
- if indexOfIndex is out of bounds.public int valueSparseInt(int indexOfIndex) throws Exception
indexOfIndex
- the index of the index of the value to get.Exception
- if indexOfIndex is out of bounds.Copyright © 2020 University of Waikato, Hamilton, NZ. All rights reserved.