home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
classdict.sru
< prev
next >
Wrap
Text File
|
1997-04-03
|
2KB
|
80 lines
$PBExportHeader$classdict.sru
$PBExportComments$A classdict containing dictelements
forward
global type classdict from nonvisualobject
end type
end forward
global type classdict from nonvisualobject
end type
global classdict classdict
type variables
integer current = 0
dictelement firstElement
end variables
forward prototypes
public function boolean contains (any key)
public subroutine set (any key, powerobject obj)
public function powerobject get (any key)
public subroutine remove (any key)
public function any firstKey()
public function any nextKey()
public function powerobject firstObject()
public function powerobject nextObject()
end prototypes
public function boolean contains (any key);// is key present in dictionary
return firstElement.contains(key)
end function
public subroutine set (any key, powerobject obj);// set obj in dictionary using key
firstElement.set(key, obj)
end subroutine
public function powerobject get (any key);//
return firstElement.get(key)
end function
public subroutine remove (any key);// remove object from dictionary using key
firstElement.remove(key)
end subroutine
public function any firstKey();// return first key in dictionary
current = 0
return firstElement.keybyindex(0)
end function
public function any nextKey();// return next key in dictionary
current ++
return firstElement.keybyindex(current)
end function
public function powerobject firstObject();// return first object in dictionary
current = 0
return firstElement.objectbyindex(0)
end function
public function powerobject nextObject();// return next object in dictionary
current ++
return firstElement.objectbyindex(current)
end function
on classdict.create
TriggerEvent( this, "constructor" )
end on
on classdict.destroy
TriggerEvent( this, "destructor" )
end on
event constructor;// always add an empty/dummy first element
firstElement = create dictelement
end event
event destructor;// destroy firstElement
destroy firstElement
end event