Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.core.pmml
Class Array

    java.lang.Object
      weka.core.pmml.Array

All Implemented Interfaces:
  java.io.Serializable

    public class Array

extends java.lang.Object
implements java.io.Serializable

Class for encapsulating a PMML Array element.

Version:
  $Revision: 5563 $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
  Serialized Form

Nested Class Summary
`static class` | `Array.ArrayType`

Method Summary
`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(java.lang.String value)` Returns true if the array contains this string value.
`static Array` | `create(org.w3c.dom.Element arrayE)` Static factory method for creating non-sparse or sparse array types as needed.
`Array.ArrayType` | `getType()` Get the type of this array.
`static boolean` | `isArray(org.w3c.dom.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.
`java.lang.String` | `toString()`
`java.lang.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.
`java.lang.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.
`java.lang.String` | `valueSparseString(int indexOfIndex)` Gets the value at indexOfIndex from the array.
`java.lang.String` | `valueString(int index)` Gets the value at index from the array as a String.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### isArray

    public static boolean isArray(org.w3c.dom.Element arrayE)

  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

    public static Array create(org.w3c.dom.Element arrayE)
                        throws java.lang.Exception

  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:
    `java.lang.Exception` - if there is a problem when constructing the array

### getType

    public Array.ArrayType 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

    public boolean contains(java.lang.String value)

  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

### value

    public java.lang.String value(int index)
                           throws java.lang.Exception

  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:
    `java.lang.Exception` - if index is out of bounds.

### valueString

    public java.lang.String valueString(int index)
                                 throws java.lang.Exception

  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:
    `java.lang.Exception` - if index is out of bounds.

### valueDouble

    public double valueDouble(int index)
                       throws java.lang.Exception

  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:
    `java.lang.Exception` - if index is out of bounds.

### valueFloat

    public float valueFloat(int index)
                     throws java.lang.Exception

  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:
    `java.lang.Exception` - if index is out of bounds.

### valueInt

    public int valueInt(int index)
                 throws java.lang.Exception

  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:
    `java.lang.Exception` - if index is out of bounds.

### valueSparse

    public java.lang.String valueSparse(int indexOfIndex)
                                 throws java.lang.Exception

  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:
    `java.lang.Exception` - if indexOfIndex is out of bounds.

### valueSparseString

    public java.lang.String valueSparseString(int indexOfIndex)
                                       throws java.lang.Exception

  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:
    `java.lang.Exception` - if indexOfIndex is out of bounds.

### valueSparseDouble

    public double valueSparseDouble(int indexOfIndex)
                             throws java.lang.Exception

  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:
    `java.lang.Exception` - if indexOfIndex is out of bounds.

### valueSparseFloat

    public float valueSparseFloat(int indexOfIndex)
                           throws java.lang.Exception

  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:
    `java.lang.Exception` - if indexOfIndex is out of bounds.

### valueSparseInt

    public int valueSparseInt(int indexOfIndex)
                       throws java.lang.Exception

  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:
    `java.lang.Exception` - if indexOfIndex is out of bounds.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD