public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { CheckIfComputerExist(computerId); if (this.components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } IComponent component = null; switch (componentType) { case "CentralProcessingUnit": component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case "Motherboard": component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case "PowerSupply": component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case "RandomAccessMemory": component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case "SolidStateDrive": component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case "VideoCard": component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; default: throw new ArgumentException(ExceptionMessages.InvalidComponentType); } IComputer computer = this.computers.FirstOrDefault(x => x.Id == computerId); computer.AddComponent(component); this.components.Add(component); return(string.Format(SuccessMessages.AddedComponent, component.GetType().Name, component.Id, computerId)); }
private IComponent CreateComponent(string componentType, int id, string manufacturer, string model, decimal price, double overallPerformance, int generation) { IComponent component = null; if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } return(component); }
public void TestReadFromRam() { var random = new Random(); var lines = GetMemoryLines(); var data = new byte[0x100]; random.NextBytes(data); var unused = new RandomAccessMemory(0x100, data, lines); var mockDevice = new Mock <IDevice>(); for (var i = 0; i < data.Length; i++) { lines.AddressBus.WriteValue(mockDevice.Object, (ushort)(0x100 + i)); lines.MREQ.WriteValue(TristateWireState.LogicLow); lines.RD.WriteValue(TristateWireState.LogicLow); lines.WAIT.WriteValue(TristateWireState.HighImpedance); lines.Clock.Tick(); Assert.Equal(TristateWireState.LogicHigh, lines.WAIT.Value); lines.Clock.Tick(); Assert.Equal(TristateWireState.HighImpedance, lines.WAIT.Value); Assert.Equal(data[i], lines.DataBus.Value); lines.MREQ.WriteValue(TristateWireState.LogicHigh); lines.RD.WriteValue(TristateWireState.LogicHigh); lines.Clock.Tick(); Assert.Equal(TristateWireState.HighImpedance, lines.WAIT.Value); Assert.Equal(data[i], lines.DataBus.Value); } }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var computer = this.computers.FirstOrDefault(x => x.Id == computerId); if (computer == null) { throw new ArgumentException(ExceptionMessages.NotExistingComputerId); } IComponent component = null; if (this.components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); computer.AddComponent(component); this.components.Add(component); } else { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } return(string.Format(SuccessMessages.AddedComponent, componentType, component.Id, computer.Id)); }
public DataScience() { poleProc = new Processor(null, null, null, 2100, 8, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 4, 0); poleMem = new MemoryDisc(null, null, null, 1000, 0, 0); poleRAM = new RandomAccessMemory(null, null, 32, null, 0, 0); poleGCard = new GraphicsCard(null, null, 11, 0, 0); }
public Photo() { poleProc = new Processor(null, null, null, 2100, 0, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, "ssd", 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 16, null, 0, 0); poleGCard = new GraphicsCard(null, null, 4, 0, 0); }
public Office() { poleProc = new Processor(null, null, null, 1600, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 4, 0); poleMem = new MemoryDisc(null, null, null, 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 4, null, 0, 0); poleGCard = new GraphicsCard(null, null, 0, 0, 0); }
public ConfigurationDefault(ReadonlyMemory memory, RandomAccessMemory ram, GraphicsProcessor graphicsProcessor, Accumulator accumulator, InputDevice inputDevice, Random random) : base(memory) { RAM = ram; GraphicsProcessor = graphicsProcessor; Accumulator = accumulator; InputDevice = inputDevice; Random = random; }
public DeathStranding() { poleProc = new Processor(null, null, null, 3400, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, "ssd", 500, 0, 0); poleRAM = new RandomAccessMemory(null, null, 8, null, 0, 0); poleGCard = new GraphicsCard(null, null, 6, 0, 0); }
public Programmer() { poleProc = new Processor(null, null, null, 2100, 4, 0, 0); poleMoth = new Motherboard(null, null, null, null, null, null, 0, 0); poleMem = new MemoryDisc(null, null, null, 300, 0, 0); poleRAM = new RandomAccessMemory(null, null, 8, null, 0, 0); poleGCard = new GraphicsCard(null, null, 0, 0, 0); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { if (!IsComputerExist(computerId)) { throw new ArgumentException("Computer with this id does not exist."); } if (components.Any(x => x.Id == id)) { throw new ArgumentException("Component with this id already exists."); } IComponent component = null; if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException("Component type is invalid."); } var computer = computers.FirstOrDefault(c => c.Id == computerId); computer.AddComponent(component); components.Add(component); return($"Component {component.GetType().Name} with id {component.Id} added successfully in computer with id {computer.Id}."); }
private void findRAM(RandomAccessMemory theorRam) { foreach (RandomAccessMemory ram in Storage.randomAccessMemories) { if ((ram.memorySize >= theorRam.memorySize) && (ram.MT == poleMoth.supportedMT)) { poleRAM = ram; break; } } }
private IComponent CreateComponent(int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { Type type = GetDefaultType(componentType); if (type == null) { throw new ArgumentException (ExceptionMessages.InvalidComponentType); } IComponent component = null; if (componentType == ComponentType.CentralProcessingUnit.ToString()) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } if (componentType == ComponentType.Motherboard.ToString()) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } if (componentType == ComponentType.PowerSupply.ToString()) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } if (componentType == ComponentType.RandomAccessMemory.ToString()) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } if (componentType == ComponentType.SolidStateDrive.ToString()) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } if (componentType == ComponentType.VideoCard.ToString()) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } return(component); }
public void Test1() { // Arrange var ram = new RandomAccessMemory(); var byte2 = new Byte2(42); // Act var output = ram.Do(false, false, byte2, false); // Assert output.ToInt16().Should().Be(0); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var computer = this.computers.FirstOrDefault(x => x.Id == computerId); if (computer == null) { throw new ArgumentException("Computer with this id does not exist."); } Models.Products.Components.IComponent component = null; switch (componentType) { case nameof(CentralProcessingUnit): component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case nameof(Motherboard): component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case nameof(PowerSupply): component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case nameof(RandomAccessMemory): component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case nameof(SolidStateDrive): component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case nameof(VideoCard): component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; } if (component == null) { throw new ArgumentException("Component type is invalid."); } if (this.components.Any(x => x.Id == component.Id)) { throw new ArgumentException("Component with this id already exists."); } computer.AddComponent(component); this.components.Add(component); return($"Component {component.GetType().Name} with id {component.Id} added successfully in computer with id {computer.Id}."); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var type = new ComponentType(); var computer = computers.FirstOrDefault(c => c.Id == computerId); if (computer == null) { throw new ArgumentException(ExceptionMessages.NotExistingComputerId); } if (components.Select(c => c.Id).Contains(id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } IComponent component = null; if (!Enum.TryParse(componentType, out type)) { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } else if (type == ComponentType.CentralProcessingUnit) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (type == ComponentType.Motherboard) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (type == ComponentType.PowerSupply) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (type == ComponentType.RandomAccessMemory) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (type == ComponentType.SolidStateDrive) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (type == ComponentType.VideoCard) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } components.Add(component); computer.AddComponent(component); return(string.Format(SuccessMessages.AddedComponent, componentType, id, computerId)); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { IComputer computer = this.computers.FirstOrDefault(c => c.Id == computerId); if (computer == null) { throw new ArgumentException("Computer with this id does not exist."); } IComponent component = this.components.FirstOrDefault(c => c.Id == id); if (component != null) { throw new ArgumentException("Component with this id already exists."); } if (componentType == Common.Enums.ComponentType.CentralProcessingUnit.ToString()) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == Common.Enums.ComponentType.Motherboard.ToString()) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == Common.Enums.ComponentType.PowerSupply.ToString()) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == Common.Enums.ComponentType.RandomAccessMemory.ToString()) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == Common.Enums.ComponentType.SolidStateDrive.ToString()) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == Common.Enums.ComponentType.VideoCard.ToString()) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException("Component type is invalid."); } this.components.Add(component); computer.AddComponent(component); return($"Component {componentType} with id {id} added successfully in computer with id {computerId}."); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { IComputer currComp = computers.FirstOrDefault(c => c.Id == computerId); if (!computers.Contains(currComp)) { throw new ArgumentException(string.Format(Common.Constants.ExceptionMessages.NotExistingComputerId)); } var currComponent = components.FirstOrDefault(c => c.Id == id); if (currComponent != null) { throw new ArgumentException(string.Format(Common.Constants.ExceptionMessages.ExistingComponentId)); } IComponent component = null; if (componentType == nameof(CentralProcessingUnit)) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == nameof(Motherboard)) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == nameof(PowerSupply)) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == nameof(RandomAccessMemory)) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == nameof(SolidStateDrive)) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == nameof(VideoCard)) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException(string.Format(Common.Constants.ExceptionMessages.InvalidComponentType)); } currComp.AddComponent(component); components.Add(component); return(string.Format(Common.Constants.SuccessMessages.AddedComponent, componentType, id, computerId)); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { ComponentType cType = new ComponentType(); IComponent component = null; if (DoesComputerExist(computerId)) { throw new ArgumentException(COMPUTER_DOESNT_EXIST); } else if (computers.Where(x => x.Id == computerId).Any(x => x.Components.Any(x => x.Id == id))) { throw new ArgumentException("Component with this id already exists."); } else if (!Enum.TryParse <ComponentType>(componentType, out cType)) { throw new ArgumentException("Component type is invalid."); } else if (cType == ComponentType.CentralProcessingUnit) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.Motherboard) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.PowerSupply) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.RandomAccessMemory) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.SolidStateDrive) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.VideoCard) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } components.Add(component); IComputer computer = computers.Where(x => x.Id == computerId).FirstOrDefault(); computer.AddComponent(component); return($"Component {component.GetType().Name} with id {component.Id} added successfully in computer with id {computer.Id}."); }
public string AddComponent(int computerId, int id, string componentTypeName, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var currentComputer = this.computers.FirstOrDefault(x => x.Id == computerId); NonExistingComputeId(currentComputer); if (!Enum.TryParse(componentTypeName, out ComponentType componentType)) { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } if (this.components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } IComponent component = null; switch (componentType) { case ComponentType.CentralProcessingUnit: component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.Motherboard: component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.PowerSupply: component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.RandomAccessMemory: component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.SolidStateDrive: component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.VideoCard: component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; } currentComputer.AddComponent(component); components.Add(component); return(string.Format(SuccessMessages.AddedComponent, componentTypeName, id, computerId)); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { CheckThatComputerWithThisIdExist(computerId); var findComputer = this.computers.FirstOrDefault(c => c.Id == computerId); if (this.components.Any(c => c.Id == id)) { throw new ArgumentException($"Component with this id already exists."); } IComponent component = null; switch (componentType) { case "CentralProcessingUnit": component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case "Motherboard": component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case "PowerSupply": component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case "RandomAccessMemory": component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case "SolidStateDrive": component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case "VideoCard": component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; default: throw new ArgumentException($"Component type is invalid."); } this.components.Add(component); findComputer.AddComponent(component); return $"Component {componentType} with id {id} added successfully in computer with id {computerId}."; }
private static Z80CPU GetZ80Cpu() { var dataBus = new DataBus(); var addressBus = new AddressBus(); var z80Clock = new PassthroughClock(); var cpuLines = new Z80CPULines { AddressBus = addressBus, DataBus = dataBus, SystemClock = z80Clock, BUSACK = new TristateWire(), BUSREQ = new TristateWire(TristateWireState.PullUp), HALT = new TristateWire(), INT = new TristateWire(TristateWireState.PullUp), IORQ = new TristateWire(), M1 = new TristateWire(), MREQ = new TristateWire(), NMI = new TristateWire(TristateWireState.PullUp), RD = new TristateWire(), RESET = new TristateWire(TristateWireState.PullUp), RFSH = new TristateWire(), WAIT = new TristateWire(TristateWireState.PullUp), WR = new TristateWire() }; var memoryConnects = new MemoryLines { AddressBus = addressBus, Clock = z80Clock, DataBus = dataBus, MREQ = cpuLines.MREQ, RD = cpuLines.RD, WAIT = cpuLines.WAIT, WR = cpuLines.WR }; var unused = new RandomAccessMemory(0, 0x4000, memoryConnects); return(new Z80CPU(cpuLines)); }
public void TestWriteToRamChange() { var random = new Random(); var lines = GetMemoryLines(); var data = new byte[0x100]; random.NextBytes(data); var memory = new RandomAccessMemory(0x100, data, lines); var mockDevice = new Mock <IDevice>(); for (var i = 0; i < data.Length; i++) { var randomValue = (byte)(random.Next() % 256); lines.AddressBus.WriteValue(mockDevice.Object, (ushort)(0x100 + i)); lines.DataBus.WriteValue(mockDevice.Object, randomValue); lines.MREQ.WriteValue(TristateWireState.LogicLow); lines.WR.WriteValue(TristateWireState.LogicLow); lines.WAIT.WriteValue(TristateWireState.HighImpedance); lines.Clock.Tick(); Assert.Equal(TristateWireState.LogicHigh, lines.WAIT.Value); Assert.Equal(randomValue, memory.Memory[i]); lines.Clock.Tick(); Assert.Equal(TristateWireState.HighImpedance, lines.WAIT.Value); Assert.Equal(randomValue, memory.Memory[i]); lines.MREQ.WriteValue(TristateWireState.LogicHigh); lines.WR.WriteValue(TristateWireState.LogicHigh); lines.Clock.Tick(); Assert.Equal(TristateWireState.HighImpedance, lines.WAIT.Value); Assert.Equal(randomValue, memory.Memory[i]); } }
public string AddComponent (int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { if (computers.Any(c => c.Id == id)) { bool IsValidType = Enum.TryParse <ComponentType>(componentType, out ComponentType componType); if (IsValidType) { Component component = null; string message = string.Empty; switch (componType) { case ComponentType.CentralProcessingUnit: component = new CentralProcessingUnit(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; case ComponentType.Motherboard: component = new Motherboard(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; case ComponentType.PowerSupply: component = new PowerSupply(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; case ComponentType.RandomAccessMemory: component = new RandomAccessMemory(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; case ComponentType.SolidStateDrive: component = new SolidStateDrive(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; case ComponentType.VideoCard: component = new VideoCard(overallPerformance, price, model, manufacturer, id, generation); if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } else { components.Add(component); message = string.Format(SuccessMessages.AddedComponent, id); } break; default: break; } return(message); } else { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } } else { throw new ArgumentException(ExceptionMessages.NotExistingComputerId); } }
public ConfigurationFibonacci(ReadonlyMemory memory, RandomAccessMemory ram, SegmentDisplay segmentDisplay, Accumulator accumulator) : base(memory) { RAM = ram; SegmentDisplay = segmentDisplay; Accumulator = accumulator; }
/// <summary> /// Wandelt ein Objekt der Entität 'Arbeitsspeicher' in eine grafisches Objekt. /// </summary> /// <param name="entity">Objekt vom Typ 'Arbeitsspeicher'</param> public void MapFromEntity(RandomAccessMemory entity) { this.Id = entity.Id; this.Beschreibung = entity.Description; this.Speicher = entity.Memory; this.Taktrate = entity.ClockRate; this.Hersteller = entity.Producer.CompanyName; }