| Package | system.data.stacks |
| Class | public class TypedStack |
| Inheritance | TypedStack Object |
| Implements | Stack, Typeable, Validator |
Example :
import system.data.stacks.ArrayStack ;
import system.data.stacks.TypedStack ;
var s:ArrayStack = new ArrayStack() ;
var t:TypedStack = new TypedStack( String , s ) ;
t.push("item1") ;
t.push("item2") ;
trace( t ) ; // {item1,item2}
try
{
t.push( 1 ) ;
}
catch( e:TypeError )
{
trace( e.message ) ; // TypedStack.validate(1) is mismatch.
}
| Property | Defined By | ||
|---|---|---|---|
| type : *
Indicates the type of the Typeable object. | TypedStack | ||
| Method | Defined By | ||
|---|---|---|---|
TypedStack(type:*, stack:Stack)
Creates a new TypedStack instance. | TypedStack | ||
clear():void
Removes all of the elements from this stack (optional operation). | TypedStack | ||
clone():*
Creates and returns a shallow copy of the object. | TypedStack | ||
isEmpty():Boolean
Returns true if this stack contains no elements. | TypedStack | ||
Returns the iterator reference of the object. | TypedStack | ||
peek():*
Returns the lastly pushed value without removing it. | TypedStack | ||
pop():*
Removes and returns the lastly pushed value. | TypedStack | ||
push(o:*):void
Pushes the passed-in value to this stack. | TypedStack | ||
search(o:*):int
Search a value in the stack. | TypedStack | ||
size():uint
Returns the number of elements in this collection. | TypedStack | ||
supports(value:*):Boolean
Returns true if the specific value is valid. | TypedStack | ||
toSource(indent:int = 0):String
Returns the source code string representation of the object. | TypedStack | ||
toString():String
Returns the String representation of the object. | TypedStack | ||
validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid. | TypedStack | ||
| type | property |
type:*Indicates the type of the Typeable object.
If the type change the clear() method is invoked.
public function get type():* public function set type(value:any):void| TypedStack | () | Constructor |
public function TypedStack(type:*, stack:Stack)Creates a new TypedStack instance.
Parameterstype:* — the type of this Typeable object (a Class or a Function).
| |
stack:Stack — The Stack reference of this wrapper.
|
ArgumentError — if the type is null or undefined.
| |
TypeError — if a value in the passed-in Stack object isn't valid.
|
| clear | () | method |
public function clear():voidRemoves all of the elements from this stack (optional operation).
| clone | () | method |
public function clone():*Creates and returns a shallow copy of the object.
Returns* — A new object that is a shallow copy of this instance.
|
| isEmpty | () | method |
public function isEmpty():Boolean
Returns true if this stack contains no elements.
Boolean — true if this stack is empty else false.
|
| iterator | () | method |
public function iterator():IteratorReturns the iterator reference of the object.
ReturnsIterator — the iterator reference of the object.
|
| peek | () | method |
public function peek():*Returns the lastly pushed value without removing it.
Returns* |
the — lastly pushed value.
|
| pop | () | method |
public function pop():*Removes and returns the lastly pushed value.
Returns* — the lastly pushed value
|
| push | () | method |
public function push(o:*):voidPushes the passed-in value to this stack.
Parameters
o:* |
| search | () | method |
public function search(o:*):intSearch a value in the stack.
Parameters
o:* |
int — the index position of a value in the stack.
|
| size | () | method |
public function size():uintReturns the number of elements in this collection.
Returnsuint — the number of elements in this collection.
|
| supports | () | method |
public function supports(value:*):Boolean
Returns true if the specific value is valid.
Parameters
value:* |
Boolean — true if the specific value is valid.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source code string representation of the object.
Parameters
indent:int (default = 0) |
String — the source code string representation of the object.
|
| toString | () | method |
public function toString():StringReturns the String representation of the object.
ReturnsString — the String representation of the object.
|
| validate | () | method |
public function validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid.
Parameters
value:* |
TypeError — if the value is not valid.
|