示例#1
0
 public void SetState(IWortCopperState newState)
 {
     _currentState = newState;
     _currentState.OnEntry(this, _brew);
     PrintCurrentState();
     //return _currentState.ToString();
 }
 public void SetEndTime(string paramText, string endTime, WortCopper holdingVessel, Brew brew)
 {
     if (paramText.Equals("Wort Boiling - Finish"))
     {
         WortCopperProcessParameters paramToCheck  = WortCopperProcessParameters.HeatingEndTime;
         WortCopperProcessParameters paramToChange = WortCopperProcessParameters.BoilingEndTime;
         IWortCopperState            newState      = holdingVessel.ExtraBoilingState;
         SetProcessStepEndTime(endTime, holdingVessel, brew, paramToCheck, paramToChange, newState);
     }
 }
 public void SetEndTime(string paramText, string endTime, WortCopper wortCopper, Brew brew)
 {
     if (paramText.Equals("Casting Time - Finish"))
     {
         WortCopperProcessParameters paramToCheck  = WortCopperProcessParameters.CastingStartTime;
         WortCopperProcessParameters paramToChange = WortCopperProcessParameters.CastingEndTime;
         IWortCopperState            newState      = wortCopper.IdleState;
         SetProcessStepEndTime(endTime, wortCopper, brew, paramToCheck, paramToChange, newState);
     }
 }
 public void StartCasting(string paramText, string startTime, WortCopper wortCopper, Brew brew)
 {
     if (paramText.Equals("Start Casting - Finish"))
     {
         WortCopperProcessParameters paramToCheck  = WortCopperProcessParameters.BoilingEndTime;
         WortCopperProcessParameters paramToChange = WortCopperProcessParameters.CastingStartTime;
         IWortCopperState            newState      = wortCopper.CastingState;
         SetCastingStartTime(startTime, wortCopper, brew, paramToCheck, paramToChange, newState);
     }
 }
示例#5
0
        public WortCopper()
        {
            _brew              = new Brew();
            _idleState         = new WortCopperIdleState();
            _heatingState      = new WortCopperHeatingState();
            _boilingState      = new WortCopperBoilingState();
            _extraBoilingState = new WortCopperExtraBoilingState();
            _castingState      = new WortCopperCastingState();

            _currentState = _idleState;
            //_currentState.InitBrew(this, _brew);
        }
        private void SetCastingStartTime(string endTime, WortCopper wortCopper, Brew brew,
                                         WortCopperProcessParameters paramToCheck,
                                         WortCopperProcessParameters paramToChange,
                                         IWortCopperState newState)
        {
            string brandName = brew.BrandName;
            string wortCopperParamToCheckValue = brew.GetProcessParameterValue(ProcessEquipment.WortCopper,
                                                                               paramToCheck.ToString());

            //Complete process step
            if (brandName.Length > 0 &&
                wortCopperParamToCheckValue.Length > 0)
            {
                Brew   nBrew     = wortCopper.Brew;
                string paramName = paramToChange.ToString();
                nBrew.SetProcessParameterValue(ProcessEquipment.WortCopper, paramName, endTime);

                //Set new state
                wortCopper.SetState(newState);
                //Console.WriteLine("New state is: " + newStateString);
            }
        }