Scripting API

Home Scripting API Index Class Overview

nlvm.util

Class Vector


public class Vector
extends Object

A dynamic array

Constructor Summary

Vector()
    Constructs an empty vector using a default capacity
Vector(int capacity)
    Constructs an empty vector with an initial capacity.
Vector(int capacity, int capacityIncr)
    Constructs an empty vector with an initial capacity and a custom capacity increase


Method Summary

void addElement(Object elem)
  Adds an element to end of the vector
int capacity()
  Returns the capacity of this vector
void clear()
  Removes all elements and sets the size to 0
bool contains(Object a)
  Returns true if the vector contains the element 'a'
Object elementAt(int index)
  Returns the element at index
void ensureCapacity(int minCapacity)
  Increases the capacity to minCapacity
bool equals(Object a)
void insertElementAt(Object obj, int index)
  Inserts an element at a specific index
bool isEmpty()
  Returns true if the size of the vector is 0
void removeAllElements()
  Removes all elements and sets the size to 0
bool removeElement(Object elem)
  Remove the first occurance of elem from this vector
void removeElementAt(int index)
  Removes an element at a specific index
void setElementAt(Object obj, int index)
  Sets the element at index
void setSize(int size)
  Sets the size of this vector
int size()
  Returns the size of the vector


Constructor Detail


Vector

public Vector()

Constructs an empty vector using a default capacity


Vector

public Vector(int capacity)

Constructs an empty vector with an initial capacity.


Vector

public Vector(int capacity, int capacityIncr)

Constructs an empty vector with an initial capacity and a custom capacity increase


Method Detail


addElement

public void addElement(Object elem)

Adds an element to end of the vector


capacity

public int capacity()

Returns the capacity of this vector


clear

public void clear()

Removes all elements and sets the size to 0

This is identical to removeAllElements()


contains

public bool contains(Object a)

Returns true if the vector contains the element 'a'


elementAt

public Object elementAt(int index)

Returns the element at index


ensureCapacity

public void ensureCapacity(int minCapacity)

Increases the capacity to minCapacity


equals

public bool equals(Object a)


insertElementAt

public void insertElementAt(Object obj, int index)

Inserts an element at a specific index

Since:
    2.6.5.7


isEmpty

public bool isEmpty()

Returns true if the size of the vector is 0


removeAllElements

public void removeAllElements()

Removes all elements and sets the size to 0

This is identical to clear()


removeElement

public bool removeElement(Object elem)

Remove the first occurance of elem from this vector


removeElementAt

public void removeElementAt(int index)

Removes an element at a specific index

Since:
    2.6.5.7


setElementAt

public void setElementAt(Object obj, int index)

Sets the element at index


setSize

public void setSize(int size)

Sets the size of this vector


size

public int size()

Returns the size of the vector