Stack

Stores data in a ‘first on, last off’ fashion.  Each element placed in this collection can be of any data type.

See Also

com.boostworthy.collections.ICollection

Summary
StackStores data in a ‘first on, last off’ fashion.
Variables
m_aDataArray for storing all data in this collection.
Functions and Properties
StackConstructor.
addElementAdds a new element to this object’s collection.
removeElementRemoves an element from this object’s collection.
lengthGets the length of this collection.
getIteratorReturns an iterator of the specified type.
disposePerforms any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
getElementIndexLoops through the data array and checks each element against the passed element.

Variables

m_aData

protected var m_aData: Array

Array for storing all data in this collection.

Functions and Properties

Stack

public function Stack()

Constructor.

addElement

public function addElement(objElement: Object):void

Adds a new element to this object’s collection.

Parameters

param objElement The element to add to this object. 

removeElement

public function removeElement(objElement: Object):void

Removes an element from this object’s collection.

Parameters

param objElement The element to remove from this object. 

length

public function get length():uint

Gets the length of this collection.

Returns

The length of this collection. 

getIterator

public function getIterator(uIterator: uint = 2):IIterator

Returns an iterator of the specified type.

Parameters

param uIterator The iterator type to use for iterating through the data being stored by this collection.  Default is ‘2’ (IteratorType.ARRAY_FORWARD). 

Returns

An iterator instance of the specified type. 

See Also

com.boostworthy.collections.iterators.IteratorType

dispose

public function dispose():void

Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.

getElementIndex

private function getElementIndex(objElement: Object):int

Loops through the data array and checks each element against the passed element.  If the element is found in the data array, it’s index is returned, otherwise ‘null’ is returned indicating that it was not found in the data array.

Parameters

param objElement The element being searched for in the collection. 

Returns

The element’s index in the data array. 

The ‘ICollection’ interface defines a common interface for all collection objects.
The ‘IDisposable’ interface defines a common interface for all objects to encorporate garbage collection.
The ‘TweenStack’ class is an extension of the regular stack.
protected var m_aData: Array
Array for storing all data in this collection.
public function Stack()
Constructor.
public function addElement(objElement: Object):void
Adds a new element to this object’s collection.
public function removeElement(objElement: Object):void
Removes an element from this object’s collection.
public function get length():uint
Gets the length of this collection.
public function getIterator(uIterator: uint = 2):IIterator
Returns an iterator of the specified type.
public function dispose():void
Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
private function getElementIndex(objElement: Object):int
Loops through the data array and checks each element against the passed element.
Close