public bool Validate(ISystemBlockHandler systemBlock) { var systemBlockHull = (SystemBlockHull)systemBlock.GetContainer(ComponentType.SystemBlockHull).GetItems().FirstOrDefault(); var powerSupply = (PowerSupply)systemBlock.GetContainer(ComponentType.PowerSupply).GetItems().FirstOrDefault(); if (!systemBlockHull.CanAccommodatePowerSupply(powerSupply)) { return(false); } return(Next == null ? true : Next.Validate(systemBlock)); }
public bool Validate(ISystemBlockHandler systemBlock) { foreach (ComponentType componentType in Enum.GetValues(typeof(ComponentType))) { if (!systemBlock.GetContainer(componentType).IsValid()) { return(false); } } return(Next == null ? true : Next.Validate(systemBlock)); }
public bool Validate(ISystemBlockHandler systemBlock) { var powerSupply = (PowerSupply)systemBlock.GetContainer(ComponentType.PowerSupply).GetItems().FirstOrDefault(); var consumers = systemBlock.GetPowerConsumers(); if (!powerSupply.HasEnoughPower(consumers)) { return(false); } return(Next == null ? true : Next.Validate(systemBlock)); }