예제 #1
0
파일: Computer.cs 프로젝트: krumov/telerik
 public Computer(
         ComputerType type,
         Cpu cpu, 
         Ram ram,
         IEnumerable<HardDrive> hardDrives,
         IVideoCard videoCard,
         LaptopBattery battery)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = videoCard;
     this.battery = battery;
 }
예제 #2
0
파일: HPFactory.cs 프로젝트: krumov/telerik
        public static Dictionary<string, Computer> BuildHPComputers()
        {
            var machines = new Dictionary<string, Computer>();

            var pcRam = new Ram(2);
            var pcVideoCard = new VideoCardWithColor();
            var pcCpu = new Cpu(2, 32);
            var pcHdd = new[] { new HardDrive(500, false, 0) };
            machines["pc"] = new Computer(ComputerType.PC, pcCpu, pcRam, pcHdd, pcVideoCard, null);

            var serverRam = new Ram(32);
            var serverVideo = new VideoCardMonochrome();
            var serverCpu = new Cpu(4, 32);
            var serverHdd = new[] { new HardDrive(1000, false, 3) };
            machines["server"] = new Computer(ComputerType.SERVER, serverCpu, serverRam, serverHdd, serverVideo, null);

            var laptopCard = new VideoCardWithColor();
            var laptopRam = new Ram(4);
            var laptopCpu = new Cpu(2, 64);
            var laptopHdd = new[] { new HardDrive(500, false, 0) };
            machines["laptop"] = new Computer(ComputerType.LAPTOP, laptopCpu, laptopRam, laptopHdd, laptopCard, new ComputerParts.LaptopBattery());

            return machines;
        }