Package weka.core.pmml
Class Array
java.lang.Object
weka.core.pmml.Array
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SparseArray
Class for encapsulating a PMML Array element.
- Version:
- $Revision: 10203 $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
Returns true if the array contains this string value.static Array
static Array
Static factory method for creating non-sparse or sparse array types as needed.getType()
Get the type of this array.int
index
(int position) Returns the index of the value stored at the given positionstatic boolean
Utility method to check if an XML element is an array.boolean
isSparse()
Is this array a SparseArray?int
Get the number of values in this array.toString()
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.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.valueSparseString
(int indexOfIndex) Gets the value at indexOfIndex from the array.valueString
(int index) Gets the value at index from the array as a String.
-
Method Details
-
isArray
Utility method to check if an XML element is an array.- Parameters:
arrayE
- the XML element to check- Returns:
- returns true if the XML element is an array
-
create
- Throws:
Exception
-
create
Static factory method for creating non-sparse or sparse array types as needed.- Parameters:
arrayE
- the XML element encapsulating the array- Returns:
- an appropriate Array type
- Throws:
Exception
- if there is a problem when constructing the array
-
getType
Get the type of this array.- Returns:
- the type of the array.
-
isSparse
public boolean isSparse()Is this array a SparseArray?- Returns:
- true if this array is sparse.
-
numValues
public int numValues()Get the number of values in this array.- Returns:
- the number of values in this array.
-
contains
Returns true if the array contains this string value.- Parameters:
value
- the value to check for.- Returns:
- true if the array contains this string value
-
contains
public boolean contains(int value) Returns true if the array contains this integer value.- Parameters:
value
- the value to check for- Returns:
- true if the array contains this integer value
-
contains
public boolean contains(double value) Returns true if the array contains this real value.- Parameters:
value
- the value to check for- Returns:
- true if the array contains this real value
-
contains
public boolean contains(float value) Returns true if the array contains this real value.- Parameters:
value
- the value to check for- Returns:
- true if the array contains this real value
-
index
public int index(int position) Returns the index of the value stored at the given position- Parameters:
position
- the position- Returns:
- the index of the value stored at the given position
-
value
Gets the value at index from the array.- Parameters:
index
- the index of the value to get.- Returns:
- the value at index in the array as as String.
- Throws:
Exception
- if index is out of bounds.
-
valueString
Gets the value at index from the array as a String. Calls value().- Parameters:
index
- the index of the value to get.- Returns:
- the value at index in the array as a String.
- Throws:
Exception
- if index is out of bounds.
-
valueDouble
Gets the value at index from the array as a double.- Parameters:
index
- the index of the value to get.- Returns:
- the value at index in the array as a double.
- Throws:
Exception
- if index is out of bounds.
-
valueFloat
Gets the value at index from the array as a float.- Parameters:
index
- the index of the value to get.- Returns:
- the value at index in the array as a float.
- Throws:
Exception
- if index is out of bounds.
-
valueInt
Gets the value at index from the array as an int.- Parameters:
index
- the index of the value to get.- Returns:
- the value at index in the array as an int.
- Throws:
Exception
- if index is out of bounds.
-
valueSparse
Gets the value at indexOfIndex from the array. Does the same as value() if this array is not sparse.- Parameters:
indexOfIndex
- the index of the index of the value to get.- Returns:
- a value from the array as a String.
- Throws:
Exception
- if indexOfIndex is out of bounds.
-
valueSparseString
Gets the value at indexOfIndex from the array. Does the same as value() if this array is not sparse.- Parameters:
indexOfIndex
- the index of the index of the value to get.- Returns:
- a value from the array as a String.
- Throws:
Exception
- if indexOfIndex is out of bounds.
-
valueSparseDouble
Gets the value at indexOfIndex from the array. Does the same as value() if this array is not sparse.- Parameters:
indexOfIndex
- the index of the index of the value to get.- Returns:
- a value from the array as a double.
- Throws:
Exception
- if indexOfIndex is out of bounds.
-
valueSparseFloat
Gets the value at indexOfIndex from the array. Does the same as value() if this array is not sparse.- Parameters:
indexOfIndex
- the index of the index of the value to get.- Returns:
- a value from the array as a float.
- Throws:
Exception
- if indexOfIndex is out of bounds.
-
valueSparseInt
Gets the value at indexOfIndex from the array. Does the same as value() if this array is not sparse.- Parameters:
indexOfIndex
- the index of the index of the value to get.- Returns:
- a value from the array as an int.
- Throws:
Exception
- if indexOfIndex is out of bounds.
-
toString
-