home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
classset.sru
< prev
next >
Wrap
Text File
|
1997-08-06
|
3KB
|
113 lines
$PBExportHeader$classset.sru
$PBExportComments$A set (actually a list) containing setelements
forward
global type classset from nonvisualobject
end type
end forward
global type classset from nonvisualobject
end type
global classset classset
type variables
PRIVATE integer count = 0
PRIVATE setelement firstElement, currentElement
end variables
forward prototypes
public function boolean contains (powerobject obj)
public subroutine add (powerobject obj)
public function powerobject get (integer index)
public subroutine remove (powerobject obj)
public subroutine remove (integer index)
public function integer size ()
public function powerobject firstobject ()
public function powerobject currentobject ()
public function powerobject nextobject ()
end prototypes
public function boolean contains (powerobject obj);// is obj present in list
if (firstElement.contains(obj) > 0) then
return TRUE
end if
return FALSE
end function
public subroutine add (powerobject obj);// add obj to end of list
if isNull(obj) then
return
end if
count = count + firstElement.add(obj)
end subroutine
public function powerobject get (integer index);// return object on position index
setelement FoundElem
FoundElem = firstElement.get(index)
if isNull(FoundElem) then
powerobject nullobj
setNull(nullobj)
return nullobj
end if
return FoundElem.contents
end function
public subroutine remove (powerobject obj);// remove obj from list
count = count - firstElement.remove(obj)
end subroutine
public subroutine remove (integer index);// remove object on position index
count = count - firstElement.remove(index)
end subroutine
public function integer size ();// return size of list
return count
end function
public function powerobject firstobject ();// return first object in dictionary
currentElement = firstElement.nextElement
if isNull(currentElement) then
powerobject nullobj
setNull(nullobj)
return nullobj
end if
return currentElement.contents
end function
public function powerobject currentobject ();// return current object in dictionary
if isNull(currentElement) then
powerobject nullobj
setNull(nullobj)
return nullobj
end if
return currentElement.contents
end function
public function powerobject nextobject ();// return next object in dictionary
if not isNull(currentElement) then
currentElement = currentElement.nextElement
end if
if isNull(currentElement) then
powerobject nullobj
setNull(nullobj)
return nullobj
end if
return currentElement.contents
end function
on classset.create
TriggerEvent( this, "constructor" )
end on
on classset.destroy
TriggerEvent( this, "destructor" )
end on
event constructor;// always add an empty/dummy first element
firstelement = create setelement
end event
event destructor;// destroy firstElement
destroy firstElement
end event