コード例 #1
0
ファイル: P5.cs プロジェクト: d-mckee/cpsc-projects
 static void testHeterogeneousCollections()
 {
     ADataBeacon[] adb       = new ADataBeacon[9];
     int[]         testArray = new int[] { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
     Console.WriteLine("Testing heterogeneous collection with composite types...");
     adb[0] = new dataFilterBeacon();
     adb[1] = new dataFilterStrobeBeacon();
     adb[2] = new dataFilterQuirkyBeacon();
     adb[3] = new dataModBeacon();
     adb[4] = new dataModStrobeBeacon();
     adb[5] = new dataModQuirkyBeacon();
     adb[6] = new dataCutBeacon();
     adb[7] = new dataCutStrobeBeacon();
     adb[8] = new dataCutQuirkyBeacon();
     for (int i = 0; i < adb.Length; i++)
     {
         adb[i].scramble(testArray);
         adb[i].setMode(true);
         adb[i].filter();
         adb[i].setSeq(testArray);
         adb[i].getMode();
         adb[i].setPrime(37);
         adb[i].getCharge();
         adb[i].recharge(5);
         for (int j = 0; j < 5; j++)
         {
             adb[i].signal();
         }
         adb[i].turnOff();
         adb[i].isOn();
         adb[i].turnOn();
     }
 }
コード例 #2
0
ファイル: P5.cs プロジェクト: d-mckee/cpsc-projects
 static void testVarietyModeChangesBeacon()
 {
     ADataBeacon[] adb       = new ADataBeacon[9];
     int[]         testArray = new int[] { 9, 24, 39, 10, 54 };
     Console.WriteLine("Initializing collection of composite types");
     adb[0] = new dataFilterBeacon();
     adb[1] = new dataFilterStrobeBeacon();
     adb[2] = new dataFilterQuirkyBeacon();
     adb[3] = new dataModBeacon();
     adb[4] = new dataModStrobeBeacon();
     adb[5] = new dataModQuirkyBeacon();
     adb[6] = new dataCutBeacon();
     adb[7] = new dataCutStrobeBeacon();
     adb[8] = new dataCutQuirkyBeacon();
     Console.Write("Charges: ");
     for (int i = 0; i < adb.Length; i++)
     {
         adb[i].setSeq(testArray);
         for (int j = 0; j < 5; j++)
         {
             if (adb[i].isOn())
             {
                 adb[i].turnOff();
             }
             else
             {
                 adb[i].turnOn();
             }
             adb[i].signal();
         }
         adb[i].recharge(5);
         Console.Write(adb[i].getCharge() + " ");
     }
     Console.WriteLine();
 }