weka.core.pmml

## Class SparseArray

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

- All Implemented Interfaces:
    java.io.Serializable

      public class SparseArray
      extends Array
      implements java.io.Serializable

  Implementation of a sparse array. Extends Array.
  Version:
    $Revision: 8034 $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class weka.core.pmml.Array

      `Array.ArrayType`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `index(int position)` Returns the index of the value stored at the given position
    `boolean` | `isSparse()` Overrides isSparse() in Array and always returns true.
    `int` | `locateIndex(int index)` Locates the greatest index that is not greater than the given index.
    `int` | `numNonZero()` Get the number of non-zero values in this sparse array
    `int` | `numValues()` Get the number of values in this array.
    `java.lang.String` | `toString()`
    `java.lang.String` | `value(int arrIndex)` Gets the value at index from the array.

    - ### Methods inherited from class weka.core.pmml.Array

      `contains, contains, contains, contains, create, create, getType, isArray, valueDouble, valueFloat, valueInt, valueSparse, valueSparseDouble, valueSparseFloat, valueSparseInt, valueSparseString, valueString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### isSparse

          public boolean isSparse()

      Overrides isSparse() in Array and always returns true.
      Overrides:
        `isSparse` in class `Array`
      Returns:
        true always

    - #### numValues

          public int numValues()

      Get the number of values in this array.
      Overrides:
        `numValues` in class `Array`
      Returns:
        the number of values in this array.

    - #### numNonZero

          public int numNonZero()

      Get the number of non-zero values in this sparse array
      Returns:
        the number of values that are non-zero

    - #### index

          public int index(int position)

      Returns the index of the value stored at the given position
      Overrides:
        `index` in class `Array`
      Parameters:
        `position` - the position
      Returns:
        the index of the value stored at the given position

    - #### locateIndex

          public int locateIndex(int index)

      Locates the greatest index that is not greater than the given index.
      Returns:
        the internal index of the attribute index. Returns -1 if no index with this property could be found

    - #### value

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

      Gets the value at index from the array.
      Overrides:
        `value` in class `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.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `Array`