home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH18LIST C:\UT2004"
- //Identifies the package
- //CH08_01LIST.uc
-
- class CH18_01LIST extends Commandlet;
- function int Main(string Args)
- {
- //#1
- //Declare an identifier of the Cast type
- local Cast firstCast;
- local int iCtr;
- //Create an instance of the Cast class
- firstCast = new class'Cast';
-
- Log(Chr(10)$ " Cast Functions");
- //#2 The call to showName() calls the init() function
- Log(Chr(10)$ "1. The Cast private init() sets the name");
- Log( " and showName() displays it--" );
- firstCast.showName();
- //#3 The attribute value from its local scope
- Log(Chr(10)$ "2. Name returned from getInnerName() function : "
- $ firstCast.getInnerName());
- //#4 Travers the cast array
- Log(Chr(10)$ "3. Show names array 'selectListName( )' : ");
- for(iCtr = 0; iCtr < firstCast.getListLength(); iCtr++){
- firstCast.selectListName(iCtr);
- Log(" From selectListName("$iCtr$") "
- $ firstCast.getName());
- }//end for
- //#5 Access the name attribute after traversing the cast array
- Log(Chr(10)$ "4. Accessor now returns : "
- $ firstCast.getName());
- //#6 Name added to array
- Log(Chr(10)$ "5. Add a name to the list (Aegisthus): ");
- firstCast.addToList("Aegisthus");
- //#7 Show the new number of names and then the names
- Log(Chr(10)$ "6. Show names array 'selectListName()' : ");
- Log(Chr(10)$ " List length now: " $ firstCast.getListLength());
- for(iCtr = 0; iCtr < firstCast.getListLength(); iCtr++){
- firstCast.selectListName(iCtr);
- Log(" From selectListName("$iCtr$") "
- $ firstCast.getName());
- }//end for
- return 0;
- }
-