Aztec® Programming Language
Version 1.1 Alpha 2

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

Download Aztec

Search        Contact Us

Don't fly Mr. bluebird, I'm just walkin' down the road...

Early morning sunshine tells me all I need to know.

- Dickey Betts

 

aztec.util.PrimitiveList

public class PrimitiveList<T> from<Collection>

Base

Collection

PrimitiveList<>

The PrimitiveList 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 values in the list. Once a specific instance of the PrimitiveList<> is created (simply by using It in code), the class provides a general purpose dynamic PrimitiveList class which can only hold that particular type of object (or an object whose type is derived from the that type). It is derived from Collection, so satisfies all the requirements that entails.

 

The beauty of the template based List<> 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 PrimitiveList<>, 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 PrimitiveList<> class. The creation of a single implementation of the PrimitiveList<> template class can occur anywhere in Aztec code where a class can be used.

 

Note that the description of the PrimitiveList<> 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 PrimitiveList<> class is created, the "T" will be replaced with the primitive class that was passed into the PrimitiveList<> class definition.

 

PrimitiveList<> Methods

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

 


PrimitiveList()

public method PrimitiveList()

Parameters

None

Return Value

None

Description

Constructor for the PrimitiveList<> class.

 

PrimitiveList<> Class


Size()

public virtual method<int> Size()

Parameters

None

Return Value

Returns size of collection

Description

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

 

PrimitiveList<> Class


AddItem()

public method AddItem(T ObjectValue)

Parameters

ObjectValue

Primitive object value to be added to list

Return Value

None

Description

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

 

PrimitiveList<> Class


InsertItem()

public method InsertItem(int Position, T Object)

Parameters

Position

One based position of insert

Object

Primitive object value to be added to list

Return Value

None

Description

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

 

PrimitiveList<> Class


SetItem()

public method SetItem(int Position, T Object)

Parameters

Position

One based position

Object

Primitive object value to object to be set in the list

Return Value

None

Description

This method sets the specified primitive value 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 the appropriate initialization value based on the primitive type being stored. Then the specified primitive value 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.

 

PrimitiveList<> Class


GetItem()

public method<T> GetItem(int Position)

Parameters

Position

One based position

Return Value

Primitive object value at specified position

Description

This method returns the primitive object value 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 is returned equivalent to the default value for the data type in question.

 

PrimitiveList<> Class


RemoveItem()

public method<T> RemoveItem(int Position)

Parameters

Position

One based position

Return Value

Primitive object value being removed

Description

This method removes the primitive object value 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 is returned equivalent to the default value for the data type in question.

 

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

 

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

 

PrimitiveList<> Class


GetCurrentItem()

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

Parameters

None

Return Value

Primitive object value for current item

Description

This method returns the primitive object value 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 a value equivalent to the default value for the data type in question.

 

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

 

PrimitiveList<> Class


Clear()

public virtual method Clear()

Parameters

None

Return Value

None

Description

This method clears all primitive value items from the list.

 

PrimitiveList<> Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec