Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

It was a beautiful song, but it ran too long...

If you're gonna have a hit, you gotta make it fit...

So they cut it down to 3:05.

- Billy Joel

 

aztec.util.ObjectList

public class ObjectList from<Collection>

Base

Collection

ObjectList

The ObjectList class provides a general purpose dynamic list class for any type of object. It is derived from Collection, so satisfies all the requirements that entails.

 

This ObjectList class accepts any type of class by storing the items as "Base" class entries. This means that when an item is retrieved from the list, it typically needs to be changed to the class in question using the "as" keyword. The Aztec Class Framework also provides a rich set of "template" classes for lists and queues intended to address this usability problem.

 

ObjectList Methods

ObjectList() Constructor for the ObjectList class
Size() Returns number of items in the list
AddItem() Adds an item to the end of the list
InsertItem() Inserts an item anywhere in the list using one based position
SetItem() Sets the object reference at the specified one based position
GetItem() Gets the item at the specified one based position
RemoveItem() Removes the item from the list at the one based position and returns reference
GotoTop() Moves internal "pointer" to top of list
GotoBottom() Moves internal "pointer" to bottom of list
GetCurrentItem() Gets "current" object in collection and move pointer position
IsCurrentValid() Returns true if the "pointer" currently points at a valid position
Clear() Clears the entire list

Derived Classes

See Also

 


ObjectList()

public method ObjectList()

Parameters

None

Return Value

None

Description

Constructor for the ObjectList class.

 

ObjectList Class


Size()

public virtual method<int> Size()

Parameters

None

Return Value

Returns size of collection

Description

This method returns the total number of objects currently stored in the list.

 

ObjectList Class


AddItem()

public method AddItem(Base Object)

Parameters

Object

Reference to object to be added to list

Return Value

None

Description

This method adds the specified object reference to the end of the list. The storage for the list is handled internally, and automatically grows the list if necessary. The user of the class doesn't need to worry about any of the details.

 

This method will fire a MemoryException if the system runs out of memory while satisfying the request.

 

ObjectList Class


InsertItem()

public method InsertItem(int Position, Base Object)

Parameters

Position

One based position of insert

Object

Reference to object to be added to list

Return Value

None

Description

This method inserts the specified object reference before the one based position which is passed in. This method will fire a MemoryException if the system runs out of memory while satisfying the request.

 

ObjectList Class


SetItem()

public method SetItem(int Position, Base Object)

Parameters

Position

One based position

Object

Reference to object to be added to list

Return Value

None

Description

This method sets the specified object reference at the one based position which is passed in. If the position is greater than the current size of the list, the method will grow the size of the list, and fill in all slots between the "old size" and the "new size" with null. Then the specified Object reference is placed at the one based position in the list.

 

This method will fire a MemoryException if the system runs out of memory while satisfying the request.

 

ObjectList Class


GetItem()

public method<Base> GetItem(int Position)

Parameters

Position

One based position

Return Value

Object reference at specified position

Description

This method returns the object reference at the specified one based position in the list. If the position is not valid (less than one or greater than the current size of the list), a value of null is returned.

 

ObjectList Class


RemoveItem()

public method<Base> RemoveItem(int Position)

Parameters

Position

One based position

Return Value

Object reference being removed

Description

This method removes the object reference at the specified one based position from the list and returns the reference being removed. If the position is not valid (less than one or greater than the current size of the list), the list is not modified and a value of null is returned.

 

ObjectList Class


GotoTop()

public virtual method GotoTop()

Parameters

None

Return Value

None

Description

This method moves the internal "pointer" to the top of the list. The "GetCurrent()" method returns the object which is at the current pointer location.

 

ObjectList Class


GotoBottom()

public virtual method GotoBottom()

Parameters

None

Return Value

None

Description

This method moves the internal "pointer" to the bottom of the list. The "GetCurrent()" method returns the object which is at the current pointer location.

 

ObjectList Class


GetCurrentItem()

public virtual method<Base> GetCurrentItem(bool Forward = true)

Parameters

None

Return Value

Reference to current item

Description

This method returns a reference to the object at the current "pointer" location within the list.

 

If the Forward flag is true, the current pointer location is then advanced to the next object in the list. If currently at the last position, the pointer is advanced to a "null" position.

 

If the forward flag is false, the current pointer is moved to the previous object in the list. If currently at the first position, the pointer is advanced to the "null" position.

 

If the pointer ends up at the "null" position, the next "GetCurrentItem()" call will return null. The "GotoTop()" or "GotoBottom()" method must be used to reset the pointer to a valid position.

 

If the collection is empty, this method also returns null.

 

ObjectList Class


IsCurrentValid()

public virtual method<bool> IsCurrentValid()

Parameters

None

Return Value

True if current position is valid

Description

Virtual method to return true if the "current" pointer within the list points at a valid position, and returns false if not. If the list is empty, or if the end of the list has been surpassed by making a "GetCurrentItem()" call at the end of the list, the current "pointer" does not point at a valid position (and GetCurrentItem() returns null), so this method returns false.

 

ObjectList Class


Clear()

public virtual method Clear()

Parameters

None

Return Value

None

Description

This method clears all items from the list.

 

ObjectList Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec