home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH18LIST C:\UT2004"
- //Identifies the package
- //Cast.uc
-
-
- class Cast extends Commandlet;
- //-------------- Attributes -------------------------------
- //#1
- var private string szName;
- var private array<string> rgNames;
- var private string szNames;
- var private int iLen;
-
- //-------------- init -------------------------------------
- //#2 private function
-
- private function int init(){
- szName = "Electra";
- szNames = "Orestes Clytemnestra Electra";
- iLen = Split(szNames, " ", rgNames);
- return 0;
- }
-
- //-------------- showName ---------------------------------
- //#3 Call to private function
- //Call another function in the class
- public function showName(){
- init();
- Log(Chr(10) $ " showName() scope : " $ szName);
- }
-
- //-------------- getInnerName ----------------------------
- //#4 Assignment locally to global
- //Retrieve name from inside the class and
- //Provide it to the world outside the class
- public function string getInnerName(){
- szName = "Orestes";
- Log(Chr(10) $ " getInnerName() scope : " $ szName);
- return szName;
- }
-
- //-------------- getName ----------------------------------
- //#5 Standard accessor
- public function string getName(){
- return szName;
- }
-
-
- //-------------- selectListName ---------------------------
- //#6 Array accessor function
- public function selectListName(int num){
- if(num < iLen){
- szName = rgNames[num];
- }
- }
-
- //-------------- setName ----------------------------------
- //#7 Standard mutator for current name
- public function setName(string name){
- //Take information from the outside
- //world and change the class attribute
- szName = name;
- }
-
- //-------------- getListLength ----------------------------
- //#8 Standard accessor for list length
- public function int getListLength(){
- return iLen;
- }
-
- //-------------- addToList --------------------------------
- //#9 mutator for the list
- public function addToList(string name){
- //augment class array
- rgNames.Insert(iLen, 1);
- //assign new length back to class attribute
- iLen = rgNames.Length;
- ///add the name
- rgNames[iLen-1] = name;
- //Log(" Added " $ name );
-
- }