/// <summary> /// Copy ctor: Copies the PartNumber, ManufacturerCode, and GasConcentrations out /// of the passed-in factory cylinder into the new instance. /// </summary> /// <param name="factoryCylinder"></param> public Cylinder(FactoryCylinder factoryCylinder) : base(factoryCylinder.PartNumber, factoryCylinder.ManufacturerCode) { if (factoryCylinder != null) { foreach (GasConcentration gc in factoryCylinder.GasConcentrations) { GasConcentrations.Add((GasConcentration)gc.Clone()); } } }
/// <summary> /// Returns whether or not this cylinder contains only the specified gas and no other. /// </summary> /// <param name="gasCode"></param> /// <returns></returns> public bool ContainsOnlyGas(string gasCode) { return(GasConcentrations.Count == 1 && GasConcentrations.Find(gc => gc.Type.Code == gasCode) != null); }