ArrayedStack

ArrayedStack

An arrayed stack.  This is called a LIFO structure (Last In, First Out).

See Also

LinkedStack

Summary
ArrayedStackAn arrayed stack.
Functions and Properties
ArrayedStackInitializes a stack to match the given size.
maxSizeThe stack’s maximum capacity.
peekIndicates the top item.
pushPushes data onto the stack.
popPops data off the stack.
getAtReads an item at a given index.
setAtWrites an item at a given index.
contains@inheritDoc
clear@inheritDoc
getIterator@inheritDoc
size@inheritDoc
isEmpty@inheritDoc
toArray@inheritDoc
toStringPrints out a string representing the current object.
dumpPrints out all elements (for debug/demo purposes).

Functions and Properties

ArrayedStack

public function ArrayedStack(size: int)

Initializes a stack to match the given size.

Parameters

sizeThe maximum allowed size. 

maxSize

public function get maxSize():int

The stack’s maximum capacity.

peek

public function peek():*

Indicates the top item.

Returns

The top item. 

push

public function push(obj: *):Boolean

Pushes data onto the stack.

Parameters

objThe data. 

pop

public function pop():*

Pops data off the stack.

Returns

A reference to the top item or null if the stack is empty. 

getAt

public function getAt(i: int):*

Reads an item at a given index.

Parameters

iThe index. 

Returns

The item at the given index. 

setAt

public function setAt(i: int,
obj: *):void

Writes an item at a given index.

Parameters

iThe index.
objThe data. 

contains

public function contains(obj: *):Boolean

@inheritDoc

clear

public function clear():void

@inheritDoc

getIterator

public function getIterator():Iterator

@inheritDoc

size

public function get size():int

@inheritDoc

isEmpty

public function isEmpty():Boolean

@inheritDoc

toArray

public function toArray():Array

@inheritDoc

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

dump

public function dump():String

Prints out all elements (for debug/demo purposes).

Returns

A human-readable representation of the structure. 

A ‘java-style’ collection interface.
public function ArrayedStack(size: int)
Initializes a stack to match the given size.
public function get maxSize():int
The stack’s maximum capacity.
public function peek():*
Indicates the top item.
public function push(obj: *):Boolean
Pushes data onto the stack.
public function pop():*
Pops data off the stack.
public function getAt(i: int):*
Reads an item at a given index.
public function setAt(i: int,
obj: *):void
Writes an item at a given index.
public function contains(obj: *):Boolean
@inheritDoc
public function clear():void
@inheritDoc
public function getIterator():Iterator
@inheritDoc
public function get size():int
@inheritDoc
public function isEmpty():Boolean
@inheritDoc
public function toArray():Array
@inheritDoc
public function toString():String
Prints out a string representing the current object.
public function dump():String
Prints out all elements (for debug/demo purposes).
A stack based on a linked list.
Close