コード例 #1
0
        public Computer CreatePC(int cpuType, int coreCount, int ramSize, int hardCount, int hardCapacity)
        {
            IRAM ram = new RAM(ramSize);
            ICPU cpu;

            switch (cpuType)
            {
            case 32:
                cpu = new CPU32(ram, coreCount);
                break;

            case 64:
                cpu = new CPU64(ram, coreCount);
                break;

            case 128:
                cpu = new CPU128(ram, coreCount);
                break;

            default:
                break;
            }
            IVideoCard   videoCard     = new ColorfulVideoCard();
            IMotherboard motherBoard   = new MotherBoard();
            RAID         hardDriveRaid = new RAID();

            for (int i = 0; i < hardCount; i++)
            {
                HardDrive currentHardDrive = new HardDrive(hardCapacity, true);
                hardDriveRaid.AddHardDrive(currentHardDrive);
            }
            Computer pc = new PC(cpu, ram, videoCard, hardDriveRaid, motherBoard);

            return(pc);
        }
コード例 #2
0
ファイル: Computer.cs プロジェクト: nimanmvr/TelerikAcademy
 protected Computer(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard)
 {
     this.cpu           = cpu;
     this.ram           = ram;
     this.videoCard     = videoCard;
     this.hardDriveRaid = hardDriveRaid;
     this.motherBoard   = motherBoard;
 }
コード例 #3
0
        public Computer CreateServer(int cpuType, int coreCount, int ramSize, int hardCount, int hardCapacity)
        {
            IRAM ram = new RAM(ramSize);
            ICPU cpu;

            switch (cpuType)
            {
            case 32:
                cpu = new CPU32(ram, coreCount);
                break;

            case 64:
                cpu = new CPU64(ram, coreCount);
                break;

            case 128:
                cpu = new CPU128(ram, coreCount);
                break;

            default:
                break;
            }
            IVideoCard   videoCard     = new MonochromeVideoCard();
            IMotherboard motherBoard   = new MotherBoard();
            RAID         hardDriveRaid = new RAID();
            IBattery     battery       = new LaptopBattery();

            for (int i = 0; i < hardCount; i++)
            {
                HardDrive currentHardDrive = new HardDrive(hardCapacity, true);
                hardDriveRaid.AddHardDrive(currentHardDrive);
            }
            Computer server = new Server(cpu, ram, videoCard, hardDriveRaid, motherBoard);

            return(server);
        }
コード例 #4
0
 public PC(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard)
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
 }
コード例 #5
0
 public Laptop(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard, IBattery battery)
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
     this.battery = battery;
 }
コード例 #6
0
ファイル: Server.cs プロジェクト: nimanmvr/TelerikAcademy
 public Server(ICPU cpu, IRAM ram, MonochromeVideoCard videoCard, RAID hardDriveRaid, MonochromeVideoCard motherBoard)
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
 }