Class STACK

Name

STACK  --  Class are destined to control stack arbitrary data.

Synopsis

 StackNew() 	--> new Stack object

Description

Class are destined to control stack arbitrary data.

Attributes

<Data> Array, an array of data.

Methods

FREE Free stack.
LEN Get stack length.
POP Get last pushed data.
PUSH Push data to the stack.
STACKNEW STACK object constructor.

Method STACK:FREE()

 Free() 	--> .t.

Free() is removed all elements from stack.

Method STACK:LEN()

 Len() 	--> nLenStack

Len() is return elements count of stack.

Method STACK:POP()

 Pop() 	--> vData

Pop() is return last pushed data in to stack. If stack has no elements function return NIL

Method STACK:PUSH()

 Push(<vData>) 	--> nLenStack

Push() is inserted arbitrary data to the end of stack.

Method STACK:STACKNEW()

 StackNew() 	--> new Stack object

StackNew() is constructs and returns new stack object. That class can be used to storage, access, control arbitrary data.

Example:

  st := StackNew()
 st:push("Some value")	// --> 1
 st:push(123)		// --> 2
 ? st:Len()	// -->2
 ? st:pop()	// 123
 ? st:Len()	// --> 1
 st:Free()	// --> .T.
 ? st:Len()	// --> 0
 

Platforms

No dependies of platform.