Package com.scriptbasic.spi
Interface BasicArray
- All Known Implementing Classes:
BasicArrayValue
public interface BasicArray
-
Method Summary
Modifier and TypeMethodDescriptionstatic BasicArraycreate()static BasicArrayGet theindex-th element of the array.longGet the length of the array.voidSet the index-th element of the arrayvoidSet the array object.
-
Method Details
-
create
-
create
- Throws:
ScriptBasicException
-
setArray
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 callingset(Integer, Object).- Parameters:
array- the array- Throws:
ScriptBasicException- when the array is null
-
set
Set the index-th element of the array- Parameters:
index- parameterobject- the new value for the array- Throws:
ScriptBasicException- in case of exception
-
get
Get theindex-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.
-