Class MVCArray

java.lang.Object
com.dlsc.gmapsfx.javascript.JavascriptObject
com.dlsc.gmapsfx.javascript.object.MVCArray

public class MVCArray
extends JavascriptObject
This javascript object current takes JavascriptObjects as parameters, but returns JSObjects, as it doesn't know what has been placed within it.
Author:
Geoff Capper
  • Constructor Details

  • Method Details

    • clear

      public void clear()
      Removes all elements from the array.
    • forEach

      public void forEach​(String func)
      Iterates over the elements within the array, calling the supplied function for each member. The parameters to the callback function are: func(element, index)
      Parameters:
      func -
    • getArray

      public JSObject getArray()
      Returns a JSObject representing the underlying array. Not entirely sure how useful this would be for people.
      Returns:
    • getAt

      public JSObject getAt​(int idx)
      Returns the item at the specified index in the array.
      Parameters:
      idx - The index of the item to be returned.
      Returns:
      The object at the specified index.
    • getLength

      public int getLength()
      Gets the length of the array.
      Returns:
    • insertAt

      public void insertAt​(int idx, JavascriptObject elem)
      Inserts the supplied element at the specified index in the array.
      Parameters:
      idx - The index at which to insert the item.
      elem - The item to be inserted.
    • pop

      public JSObject pop()
      Removes and returns the last element of the array
      Returns:
    • push

      public int push​(JavascriptObject obj)
      Adds the supplied element onto the end of the array, then returns the length of the array.
      Parameters:
      obj - The Javascript object to be added to the array.
      Returns:
      The length of the array after the addition.
    • removeAt

      public void removeAt​(int idx)
      Removes and discards the item at the specified index.
      Parameters:
      idx - The index of the object to be removed.
    • setAt

      public void setAt​(int idx, JavascriptObject obj)
      Sets the supplied object at the supplied index.
      Parameters:
      idx - The index at which the item should be set.
      obj - The object to be set at the supplied index.