Aztec® Programming Language
Version 1.1 Alpha 2

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

Download Aztec

Search        Contact Us

Well I may not have the answer...

But I believe I've got a plan.

- Jackson Browne

 

aztec.util.PrimitiveRefList

public class PrimitiveRefList<T> from<Collection>

Base

Collection

PrimitiveRefList<>

The PrimitiveRefList class is a "template" based class that takes a primitive class name as an argument to indicate what type of class is being stored in the list. This class stores primitive references in the list. Once a specific instance of the PrimitiveRefList<> is created (simply by using It in code), the class provides a general purpose dynamic PrimitiveRefList class which can only hold that references of that particular type of primitive object. It is derived from Collection, so satisfies all the requirements that entails.

 

The beauty of the template based PrimitiveRefList<> classes versus the ObjectList class is that the template based implementation is built so the the system takes only a particular type of data to store in the list, and when an item is retrieved, the type of data is known by the compiler, so the caller gets a version of the "GetItem()" method specific to the data type being contained in the PrimitiveRefList<>, so no extra effort is required to change the return type to the desired type.

 

The template class is not usable by itself, and an implementation of the class must be created, using a valid Aztec class, in order to use the PrimitiveRefList<> class. The creation of a single implementation of the PrimitiveRefList<> template class can occur anywhere in Aztec code where a class can be used.

 

Note that the description of the PrimitiveRefList<> class below uses "T" as the placeholder in the class definition. It will be used throughout the class as a method argument and a retun type. When a specific implementation of the PrimitiveRefList<> class is created, the "T" will be replaced with the primitive class that was passed into the PrimitiveRefList<> class definition.

 

PrimitiveRefList<> Methods

PrimitiveRefList() Constructor for the PrimitiveRefList<> 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

 


PrimitiveRefList()

public method PrimitiveRefList()

Parameters

None

Return Value

None

Description

Constructor for the PrimitiveRefList<> class.

 

PrimitiveRefList<> Class


Size()

public virtual method<int> Size()

Parameters

None

Return Value

Returns size of collection

Description

This method returns the total number of primitive reference items currently stored in the list.

 

PrimitiveRefList<> Class


AddItem()

public method AddItem(T ref ObjectReference)

Parameters

ObjectReference

Primitive object reference to be added to list

Return Value

None

Description

This method adds the specified primitive 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.

 

PrimitiveRefList<> Class


InsertItem()

public method InsertItem(int Position, T ref ObjectReference)

Parameters

Position

One based position of insert

ObjectReference

Primitive object reference to be added to list

Return Value

None

Description

This method inserts the specified primitive 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.

 

PrimitiveRefList<> Class


SetItem()

public method SetItem(int Position, T ref ObjectReference)

Parameters

Position

One based position

ObjectReference

Primitive object reference to object to be set in the list

Return Value

None

Description

This method sets the specified primitive 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 primitive 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.

 

PrimitiveRefList<> Class


GetItem()

public method<T ref> GetItem(int Position)

Parameters

Position

One based position

Return Value

Primitive object reference at specified position

Description

This method returns the primitive 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.

 

PrimitiveRefList<> Class


RemoveItem()

public method<T ref> RemoveItem(int Position)

Parameters

Position

One based position

Return Value

Primitive object reference being removed

Description

This method removes the primitive object reference at the specified one based position from the list and returns the primitive value 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.

 

PrimitiveRefList<> 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.

 

PrimitiveRefList<> 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 "GetCurrentItem()" method returns the object which is at the current pointer location.

 

PrimitiveRefList<> Class


GetCurrentItem()

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

Parameters

None

Return Value

Primitive object reference for current item

Description

This method returns the primitive object reference 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 returns null.

 

PrimitiveRefList<> 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.

 

PrimitiveRefList<> Class


Clear()

public virtual method Clear()

Parameters

None

Return Value

None

Description

This method clears all primitive reference items from the list.

 

PrimitiveRefList<> Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec