/// <summary> /// Full constructor for a motherboard with CPU, memory, and graphics card /// </summary> /// <param name="numberOfMemorySlots">Its number of memory slots</param> /// <param name="powerConsumption">Its power consumption</param> /// <param name="numberOfPciSlots">Its number of PCI slots</param> /// <param name="formFactor">Its form factor</param> /// <param name="hardDriveLimit">Its hard drive limit</param> /// <param name="cpu">Its CPU</param> /// <param name="memory">Its memory</param> /// <param name="graphicsCard">Its graphics card</param> /// <exception cref="ArgumentException">Exception if an argument is invalid</exception> public Motherboard(int numberOfMemorySlots, double powerConsumption, int numberOfPciSlots, string formFactor, int hardDriveLimit, Cpu cpu, Memory memory, GraphicsCard graphicsCard) { if (numberOfMemorySlots <= 0) { throw new ArgumentException("Number of memory slots must be greater than 0"); } if (powerConsumption <= 0) { throw new ArgumentException("Power consumption must be greater than 0"); } if (numberOfPciSlots <= 0) { throw new ArgumentException("Number of PCI slots must be greater than 0"); } if (hardDriveLimit <= 0) { throw new ArgumentException("Hard drive limit must be greater than 0"); } NumberOfMemorySlots = numberOfMemorySlots; PowerConsumption = powerConsumption; NumberOfPciSlots = numberOfPciSlots; FormFactor = formFactor; HardDriveLimit = hardDriveLimit; Cpu = cpu; Memory = memory; GraphicsCard = graphicsCard; }
} //The graphics card attached to this motherboard /// <summary> /// Initializes the motherboard /// </summary> /// <param name="memorySlots">The amount of memory slots</param> /// <param name="powerConsumption">The power consumption in Watts that the motherboard needs to consume</param> /// <param name="pciSlots">The amount of PCI slots</param> /// <param name="formFactor">The form factor of this motherboard</param> /// <param name="hardDriveLimit">The limit of harddrives this motherboard has</param> /// <param name="cpu">The CPU</param> /// <param name="memory">All of the memory attached to this motherboard, cannot exceed the `memorySlots` value</param> /// <param name="graphicsCard">The graphics card</param> public Motherboard(int memorySlots, int powerConsumption, int pciSlots, FormFactor formFactor, int hardDriveLimit, CPU cpu, Memory[] memory, GraphicsCard graphicsCard) { if (memorySlots < memory.Length) { throw new ArgumentOutOfRangeException("Amount of memory cards exceed amount of available memory slots"); } if (powerConsumption < 0) { throw new ArgumentOutOfRangeException("Power Consumption must be a positive value"); } if (pciSlots < 0) { throw new ArgumentOutOfRangeException("PCI Slots must be a positive value"); } if (hardDriveLimit < 1) { throw new ArgumentOutOfRangeException("HardDrive limit must be greater than 0"); } MemorySlots = memorySlots; PowerConsumption = powerConsumption; PCISlots = pciSlots; FormFactor = formFactor; HardDriveLimit = hardDriveLimit; CPU = cpu; Memory = memory; GraphicsCard = graphicsCard; }
/// <summary> /// Adds a new graphics card to the motherboard /// </summary> /// <param name="graphicsCard">The graphics card</param> /// <returns>A motherboard with a new graphics card</returns> public IMotherboard <Motherboard> AddGraphicCard(GraphicsCard graphicsCard) { // Make sure the graphics card is not null if (this.motherboard.GraphicCard == null) { throw new ArgumentNullException($"{nameof(GraphicsCard)} cannot be null"); } this.motherboard.GraphicCard = graphicsCard; return(this); }
/// <summary> /// Creates an old motherboard with a slow cpu and little memory. /// Graphics card is slow. /// </summary> public void BuildMotherboard() { FormFactor formFactor = new FormFactor( name: "ATX", date: new DateTime(2001, 01, 01), width: 12, depth: 9.6, usbSlots: 8 ); CPU cpu = new CPU( speed: 2.8, Manufacturer.AMD, socketType: "S1", cacheSize: 2048, cores: 4 ); Memory[] memory = new Memory[2] { new Memory( readSpeed: 800, writeSpeed: 800, type: MemoryType.DDR3, size: 1024 ), new Memory( readSpeed: 800, writeSpeed: 800, type: MemoryType.DDR3, size: 1024 ) }; GraphicsCard graphicsCard = new GraphicsCard( speed: 800, videoMemory: 2048, cudaCores: 1200, fans: 1 ); Computer.Motherboard = new Motherboard( memorySlots: 4, powerConsumption: 500, pciSlots: 3, formFactor: formFactor, hardDriveLimit: 2, cpu: cpu, memory: memory, graphicsCard: graphicsCard ); }
/// <summary> /// Initializes a new instance of <see cref="Motherboard"/> class. /// </summary> /// <param name="name">The name</param> /// <param name="formFactor">The form factor.</param> /// <param name="powerConsumption">The power consumption.</param> /// <param name="hardDriveLimit">The hard drive limit.</param> /// <param name="cpuBoard">The Cpu board.</param> /// <param name="memorySlots">The memory slots.</param> /// <param name="pCISlots">The PCI slots.</param> /// <param name="hardDrives">List of hard drives.</param> /// <param name="memorySticks">A list of memory sticks.</param> /// <param name="graphicCard">The graphics card.</param> public Motherboard(string name, string formFactor, double powerConsumption, int hardDriveLimit, Cpu cpuBoard, int memorySlots, int pCISlots, List <HardDrive> hardDrives, List <Memory> memorySticks, GraphicsCard graphicCard) { Name = name ?? throw new ArgumentNullException(nameof(name)); FormFactor = formFactor ?? throw new ArgumentNullException(nameof(formFactor)); PowerConsumption = powerConsumption; HardDriveLimit = hardDriveLimit; CpuBoard = cpuBoard; MemorySlots = memorySlots; PCISlots = pCISlots; HardDrives = hardDrives ?? throw new ArgumentNullException(nameof(hardDrives)); MemorySticks = memorySticks ?? throw new ArgumentNullException(nameof(memorySticks)); GraphicCard = graphicCard ?? throw new ArgumentNullException(nameof(graphicCard)); }
/// <summary> /// Creates an semi-new motherboard with a good cpu and average amount of memory. /// Graphics card is medium-speed. /// </summary> public void BuildMotherboard() { FormFactor formFactor = new FormFactor( name: "ATX", date: new DateTime(2015, 01, 01), width: 12, depth: 9.6, usbSlots: 8 ); CPU cpu = new CPU( speed: 3.6, Manufacturer.AMD, socketType: "AM4", cacheSize: 4096, cores: 6 ); Memory[] memory = new Memory[4] { new Memory( readSpeed: 2000, writeSpeed: 2000, type: MemoryType.DDR4, size: 2048 ), new Memory( readSpeed: 2000, writeSpeed: 2000, type: MemoryType.DDR4, size: 2048 ), new Memory( readSpeed: 2000, writeSpeed: 2000, type: MemoryType.DDR4, size: 2048 ), new Memory( readSpeed: 2000, writeSpeed: 2000, type: MemoryType.DDR4, size: 2048 ) }; GraphicsCard graphicsCard = new GraphicsCard( speed: 1500, videoMemory: 4096, cudaCores: 2000, fans: 2 ); Computer.Motherboard = new Motherboard( memorySlots: 4, powerConsumption: 700, pciSlots: 4, formFactor: formFactor, hardDriveLimit: 4, cpu: cpu, memory: memory, graphicsCard: graphicsCard ); }
public ComputerBuilder addGraphicsCard(GraphicsCard graphicsCard) { computer.GraphicsCard = graphicsCard; return(this); }
/// <summary> /// Creates an new motherboard with a very good cpu and high amount of memory. /// Graphics card is very fast. /// </summary> public void BuildMotherboard() { FormFactor formFactor = new FormFactor( name: "ATX", date: new DateTime(2021, 01, 01), width: 12, depth: 9.6, usbSlots: 8 ); CPU cpu = new CPU( speed: 4.8, Manufacturer.Intel, socketType: "LGA 1151", cacheSize: 4096, cores: 12 ); Memory[] memory = new Memory[4] { new Memory( readSpeed: 4096, writeSpeed: 4096, type: MemoryType.DDR4, size: 4096 ), new Memory( readSpeed: 4096, writeSpeed: 4096, type: MemoryType.DDR4, size: 4096 ), new Memory( readSpeed: 4096, writeSpeed: 4096, type: MemoryType.DDR4, size: 4096 ), new Memory( readSpeed: 4096, writeSpeed: 4096, type: MemoryType.DDR4, size: 4096 ) }; GraphicsCard graphicsCard = new GraphicsCard( speed: 3200, videoMemory: 8192, cudaCores: 3000, fans: 3 ); Computer.Motherboard = new Motherboard( memorySlots: 6, powerConsumption: 850, pciSlots: 4, formFactor: formFactor, hardDriveLimit: 6, cpu: cpu, memory: memory, graphicsCard: graphicsCard ); }