Class ScriptValue.ListType

java.lang.Object
com.blackrook.rookscript.ScriptValue.ListType
All Implemented Interfaces:
Iterable<ScriptIteratorType.IteratorPair>
Enclosing class:
ScriptValue

public static class ScriptValue.ListType extends Object implements Iterable<ScriptIteratorType.IteratorPair>
The class used for a list/set.
  • Method Details

    • setSize

      public void setSize(int size)
      Sets the size of the list.
      Parameters:
      size - the new size.
    • add

      public void add(ScriptValue value)
      Adds an item to the list and expands its size by one.
      Parameters:
      value - the value to add.
    • add

      public void add(int index, ScriptValue value)
      Adds an item to the list and expands its size by one.
      Parameters:
      index - the index to add it to.
      value - the value to add.
    • indexOf

      public int indexOf(ScriptValue value)
      Finds a script value sequentially (strict equals).
      Parameters:
      value - the values.
      Returns:
      the index of the found value or -1 if not found.
    • lastIndexOf

      public int lastIndexOf(ScriptValue value)
      Finds a script value sequentially, in reverse (strict equals).
      Parameters:
      value - the values.
      Returns:
      the index of the found value or -1 if not found.
    • removeIndex

      public boolean removeIndex(int index, ScriptValue out)
      Removes an object at an index.
      Parameters:
      index - the index.
      out - the output value, set to the removed value.
      Returns:
      true if a value was removed, false if not (index was out of range).
    • remove

      public boolean remove(ScriptValue value)
      Finds an object and removes it from the list.
      Parameters:
      value - the value to remove.
      Returns:
      true if removed, false if not.
    • get

      public void get(int index, ScriptValue out)
      Gets a value from the list at an index.
      Parameters:
      index - the provided index.
      out - the output value, set to the desired value.
    • set

      public void set(int index, Object value)
      Sets a value from the list at an index.
      Parameters:
      index - the provided index.
      value - the value to set.
    • sort

      public void sort()
      Sorts this array.
    • search

      public int search(ScriptValue value)
      Binary searches for a value.
      Parameters:
      value - the value to search for.
      Returns:
      the index of the found value or < 0.
    • size

      public int size()
      Returns:
      the size of this list in items.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this list is empty, false otherwise.
    • iterator

      public ScriptIteratorType iterator()
      Specified by:
      iterator in interface Iterable<ScriptIteratorType.IteratorPair>
    • toString

      public String toString()
      Overrides:
      toString in class Object