Interface Table

All Superinterfaces:
ExternVal
All Known Implementing Classes:
Table.AbstractArrayTable, Table.ArrayTable, Table.HandleTable

public interface Table extends ExternVal
A table extern.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    A table with an array as the underlying representation.
    static class 
    A table which stores its elements as a table in itself.
    static class 
    A table which implements its methods by delegating to method handles.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Object
    get(int index)
    Get an element of the table.
    Get the type of this extern.
    default int
    grow(int growBy, @Nullable Object fillWith)
    Grow the table by a number of elements, filling it with the given value.
    default void
    init(int dstIdx, int srcIdx, int len, Object[] data)
    Initialise the table with data.
    void
    set(int index, @Nullable Object value)
    Set an element of the table.
    int
    Get the size of the table.

    Methods inherited from interface io.github.eutro.wasm2j.embed.ExternVal

    getAsFunc, getAsGlobal, getAsHandle, getAsHandleRaw, getAsMemory, getAsTable, matchesType
  • Method Details

    • get

      @Nullable @Nullable Object get(int index)
      Get an element of the table.
      Parameters:
      index - The index of the element to get.
      Returns:
      The retrieved element.
    • set

      void set(int index, @Nullable @Nullable Object value)
      Set an element of the table.
      Parameters:
      index - The index of the element to set.
      value - The value to set it to.
    • size

      int size()
      Get the size of the table.
      Returns:
      The size of the table.
    • init

      default void init(int dstIdx, int srcIdx, int len, Object[] data)
      Initialise the table with data.
      Parameters:
      dstIdx - The index in the table to start at.
      srcIdx - The index in the data array to start at.
      len - The number of elements to copy.
      data - The data array.
    • grow

      default int grow(int growBy, @Nullable @Nullable Object fillWith)
      Grow the table by a number of elements, filling it with the given value.

      This operation is allowed to fail (and must fail if the upper limit is exceeded), in which case -1 should be returned.

      Parameters:
      growBy - The number of elements to grow by.
      fillWith - The value to fill new elements with.
      Returns:
      The old size of the table.
    • getType

      @NotNull ExternType.Table getType()
      Description copied from interface: ExternVal
      Get the type of this extern.
      Specified by:
      getType in interface ExternVal
      Returns:
      The type.