home *** CD-ROM | disk | FTP | other *** search
- $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
- integer count = 0
- setelement firstElement
- 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 ()
- end prototypes
-
- public function boolean contains (powerobject obj);// is obj present in list
- return firstElement.contains(obj)
- end function
-
- public subroutine add (powerobject obj);// add obj to front of list
- firstElement.add(obj)
- count ++
- end subroutine
-
- public function powerobject get (integer index);// return object on position index
- return firstElement.get(index)
- end function
-
- public subroutine remove (powerobject obj);// remove obj from list
- if firstElement.remove(obj) then
- count --
- end if
- end subroutine
-
- public subroutine remove (integer index);// remove object on position index
- if firstElement.remove(index) then
- count --
- end if
- end subroutine
-
- public function integer size ();// return size of list
- return count
- 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
-
-