mlsoft.mct.MlArray

MlArray is used to hold an array of Objects.

Public Methods

public void add(int count)
Adds count items of space at the end of the array.

public void add(int pos,int count)
Adds space to the array of count items at the given position pos.

public void addItem(Object object)
Adds space for a single object and adds the given object to the end of the array.

public boolean del(int pos, int count)
Deletes count objects from the array starting at the given position pos.

public boolean delAll()
Deletes all the objects in the array.

public boolean set(int pos, Object object)
Sets the object in the array at the given position pos.

public Object get(int pos)
Returns the object at the given position pos.

public int getCount()
Returns the number of items in the array.

public boolean move(int newPos, int pos, int count)
Move count objects in the array from the given position pos to the new position newPos.

public boolean reorder(int pos, int newPos[])
Reorder the array starting at the given position pos with the positions given in the newPos array. The newPos array must have a new position for each position to be reordered.

public int compare(Object item1, Object item2)
Compares two items in the array. The return value should be <= -1 when item1 < item2 and >= 1 if item 1 > item2. If both items are equal, 0 should be returned. If you subclass the Array class you can implement your own compare method to compare items.

public boolean sort()
Sorts the objects in the array. This will call compare(item1, item2) to compare the various objects.

public boolean sort(int pos, int count)
Sorts a portion of the array starting at the given position pos and sorting count objects.