Exemplo n.º 1
0
        /// <summary>
        /// returns a deep clone with a certain volume
        /// </summary>
        /// <param name="Volume"></param>
        /// <returns></returns>
        public override IWaterPacket DeepClone(double Volume)
        {
            WaterWithChemicals WCC = new WaterWithChemicals(Volume);

            DeepClone(WCC, Volume);
            return(WCC);
        }
Exemplo n.º 2
0
        protected virtual void DeepClone(IWaterPacket CloneToThis, double Volume)
        {
            WaterWithChemicals WCC    = (WaterWithChemicals)CloneToThis;
            double             factor = Volume / this.Volume;

            //DeepClone the properties of the base clas
            base.DeepClone(WCC);
            //Now clone the chemicals
            foreach (KeyValuePair <Chemical, double> KVP in _chemicals)
            {
                WCC.AddChemical(KVP.Key, KVP.Value * factor);
            }
        }
 /// <summary>
 /// returns a deep clone with a certain volume
 /// </summary>
 /// <param name="Volume"></param>
 /// <returns></returns>
 public override IWaterPacket DeepClone(double Volume)
 {
   WaterWithChemicals WCC = new WaterWithChemicals(Volume);
   DeepClone(WCC, Volume);
   return WCC;
 }