Class ValueArray

java.lang.Object
com.sparsity.sparksee.gdb.ValueArray
All Implemented Interfaces:
Closeable, AutoCloseable

public class ValueArray extends Object implements Closeable
ValueArray class.

It allows for getting and setting ValueArray attribute values.

It is very important to close the ValueArray once no more get or set operations will be performed.

Creation of a new ValueArray: (i) Set all the ValueArray elements using Graph::SetAttributeArray (ii) perform as many get/set operations as you need to the ValueArray instance. Lastly, (iii) Close the ValueArray

Use of an existing ValueArray: (i) Get a ValueArray instance using Graph::GetAttributeArray (ii) perform as many get/set operations as you need to the ValueArray instance. Lastly, (iii) Close the ValueArray

Check out the 'Attributes and values' section in the SPARKSEE User Manual for more details on this.

Author:
Sparsity Technologies http://www.sparsity-technologies.com
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the ValueArray instance.
    void
    get(int index, Value value)
    Get a Value from the array.
    boolean[]
    Get all the Values from this boolean array
    boolean[]
    getBoolean(int index, int size)
    Get a subset of the Values from this boolean array
    double[]
    Get all the Values from this double array
    double[]
    getDouble(int index, int size)
    Get a subset of the Values from this double array
    int[]
    Get all the Values from this int array
    int[]
    getInteger(int index, int size)
    Get a subset of the Values from this int array
    long[]
    Get all the Values from this long array
    long[]
    getLong(int index, int size)
    Get a subset of the Values from this long array
    long[]
    Get all the Values from this OID array
    long[]
    getOID(int index, int size)
    Get a subset of the Values from this long array
    long[]
    Get all the Values from this timestamp array
    long[]
    getTimestamp(int index, int size)
    Get a subset of the Values from this timestamp array
    boolean
    Gets if ValueArray instance has been closed or not.
    void
    Sets the attribute array to Null.
    void
    set(int index, Value value)
    Set a Value to a specific array position.
    void
    set(Value value)
    Set a Value to the whole array.
    void
    setBoolean(boolean[] values)
    Set all the values of this bool array.
    void
    setBoolean(int index, boolean[] values)
    Set a subset of the values of this bool array.
    void
    setDouble(double[] values)
    Set all the values of this double array.
    void
    setDouble(int index, double[] values)
    Set a subset of the values of this double array.
    void
    setInteger(int[] values)
    Set all the values of this int array.
    void
    setInteger(int index, int[] values)
    Set a subset of the values of this int array.
    void
    setLong(int index, long[] values)
    Set a subset of the values of this long array.
    void
    setLong(long[] values)
    Set all the values of this long array.
    void
    setOID(int index, long[] values)
    Set a subset of the values of this oid array.
    void
    setOID(long[] values)
    Set all the values of this oid array.
    void
    setTimestamp(int index, long[] values)
    Set a subset of the values of this timestamp array.
    void
    setTimestamp(long[] values)
    Set all the values of this timestamp array.
    int
    Returns the array size.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInteger

      public int[] getInteger(int index, int size)
      Get a subset of the Values from this int array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • getTimestamp

      public long[] getTimestamp(int index, int size)
      Get a subset of the Values from this timestamp array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • set

      public void set(int index, Value value) throws RuntimeException, RuntimeException
      Set a Value to a specific array position.

      AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the element to set [0..N-1]
      value - [in] Value to set in the array element
      Throws:
      RuntimeException - If the index is out of range or the Value not valid
      RuntimeException - null
    • setBoolean

      public void setBoolean(int index, boolean[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this bool array.

      UnsupportedOperationErrorIf array DataType is not bool AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • setTimestamp

      public void setTimestamp(long[] values) throws RuntimeException, RuntimeException
      Set all the values of this timestamp array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not timestamp
    • setOID

      public void setOID(long[] values) throws RuntimeException, RuntimeException
      Set all the values of this oid array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not oid
    • get

      public void get(int index, Value value) throws RuntimeException, RuntimeException
      Get a Value from the array.

      AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the element to get [0..N-1]
      value - [out] Value to get the array element
      Throws:
      RuntimeException - If the index is out of range or the Value not valid
      RuntimeException - null
    • setTimestamp

      public void setTimestamp(int index, long[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this timestamp array.

      UnsupportedOperationErrorIf array DataType is not timestamp AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • getOID

      public long[] getOID()
      Get all the Values from this OID array

      Returns:
      Returns all the values
    • setInteger

      public void setInteger(int index, int[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this int array.

      UnsupportedOperationErrorIf array DataType is not int AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • getLong

      public long[] getLong(int index, int size)
      Get a subset of the Values from this long array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • getBoolean

      public boolean[] getBoolean(int index, int size)
      Get a subset of the Values from this boolean array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • close

      public void close()
      Closes the ValueArray instance.

      It must be called to ensure the integrity of all data.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getTimestamp

      public long[] getTimestamp()
      Get all the Values from this timestamp array

      Returns:
      Returns all the values
    • getBoolean

      public boolean[] getBoolean()
      Get all the Values from this boolean array

      Returns:
      Returns all the values
    • setBoolean

      public void setBoolean(boolean[] values) throws RuntimeException, RuntimeException
      Set all the values of this bool array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not bool
    • getInteger

      public int[] getInteger()
      Get all the Values from this int array

      Returns:
      Returns all the values
    • getDouble

      public double[] getDouble(int index, int size)
      Get a subset of the Values from this double array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • size

      public int size()
      Returns the array size.

      Returns:
      The number of elements in the array.
    • setDouble

      public void setDouble(int index, double[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this double array.

      UnsupportedOperationErrorIf array DataType is not Double AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • makeNull

      public void makeNull() throws RuntimeException
      Sets the attribute array to Null.

      The ValueArray can not be used after this call.

      Throws:
      RuntimeException - null
    • getOID

      public long[] getOID(int index, int size)
      Get a subset of the Values from this long array

      Parameters:
      index - Position of the first element to get [0..N-1]
      size - Number of elements to get [1..N]
      Returns:
      Returns all the requested values
    • setLong

      public void setLong(int index, long[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this long array.

      UnsupportedOperationErrorIf array DataType is not long AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • getDouble

      public double[] getDouble()
      Get all the Values from this double array

      Returns:
      Returns all the values
    • setOID

      public void setOID(int index, long[] values) throws RuntimeException, RuntimeException, RuntimeException
      Set a subset of the values of this oid array.

      UnsupportedOperationErrorIf array DataType is not oid AppErrorIf the ValueArray is not available

      Parameters:
      index - [in] Position of the first element to set [0..N-1]
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If the index or size is out of range
      RuntimeException - null
    • isClosed

      public boolean isClosed()
      Gets if ValueArray instance has been closed or not.

      Returns:
      TRUE if the ValueArray instance has been closed, FALSE otherwise.
      See Also:
    • setLong

      public void setLong(long[] values) throws RuntimeException, RuntimeException
      Set all the values of this long array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not long
    • setDouble

      public void setDouble(double[] values) throws RuntimeException, RuntimeException
      Set all the values of this double array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not Double
    • setInteger

      public void setInteger(int[] values) throws RuntimeException, RuntimeException
      Set all the values of this int array.

      AppErrorIf the ValueArray is not available

      Parameters:
      values - [in] All the values to set
      Throws:
      RuntimeException - null
      RuntimeException - If array DataType is not int
    • set

      public void set(Value value) throws RuntimeException, RuntimeException
      Set a Value to the whole array.

      AppErrorIf the ValueArray is not available

      Parameters:
      value - [in] Value to set in all the array elements
      Throws:
      RuntimeException - If the Value is not valid
      RuntimeException - null
    • getLong

      public long[] getLong()
      Get all the Values from this long array

      Returns:
      Returns all the values