Interface BasicArray

All Known Implementing Classes:
BasicArrayValue

public interface BasicArray
  • Method Summary

    Modifier and Type Method Description
    static BasicArray create()  
    static BasicArray create​(java.lang.Object[] array)  
    java.lang.Object get​(java.lang.Integer index)
    Get the index-th element of the array.
    long getLength()
    Get the length of the array.
    void set​(java.lang.Integer index, java.lang.Object object)
    Set the index-th element of the array
    void setArray​(java.lang.Object[] array)
    Set the array object.
  • Method Details

    • create

      static BasicArray create()
    • create

      static BasicArray create​(java.lang.Object[] array) throws ScriptBasicException
      Throws:
      ScriptBasicException
    • setArray

      void setArray​(java.lang.Object[] array) throws ScriptBasicException
      Set the array object. This method is available as a convenience method for extension methods and is not used by the interpreter. This method can be used when the array is available from some calculation and it would be waste of resource to copy the elements of the array one by one calling set(Integer, Object).
      Parameters:
      array - the array
      Throws:
      ScriptBasicException - when the array is null
    • set

      void set​(java.lang.Integer index, java.lang.Object object) throws ScriptBasicException
      Set the index-th element of the array
      Parameters:
      index - parameter
      object - the new value for the array
      Throws:
      ScriptBasicException - in case of exception
    • get

      java.lang.Object get​(java.lang.Integer index) throws ScriptBasicException
      Get the index-th element of the array. Note that this method does NOT convert the value to an ordinary Java object. Thus when calling this method from an extension method be prepared to convert the value to ordinary Java object yourself.
      Parameters:
      index - parameter
      Returns:
      the array element.
      Throws:
      ScriptBasicException - in case of exception
    • getLength

      long getLength()
      Get the length of the array. This is not the length of the underlying object array but the size that the BASIC program should feel.
      Returns:
      the length of the array, which is n+1, where n is the maximal index of the array the BASIC program ever used.