public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            stepCollection.AddStep(new Step(stepCollection.CharAtIndex));

            currentStep = CommandsStep.IncreaseIndex;

            return(stepCollection);
        }
        public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            stepCollection.RemoveLatestStep();

            currentStep = CommandsStep.IncreaseIndex;

            return(stepCollection);
        }
Beispiel #3
0
        public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            stepCollection.IncreaseIndex();

            currentStep = CommandsStep.VerifyStep;

            return(stepCollection);
        }
        public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            if (String.IsNullOrEmpty(stepCollection.Command))
            {
                currentStep = CommandsStep.InvalidEntrance;
            }
            else
            {
                currentStep = CommandsStep.VerifyStep;
            }

            return(stepCollection);
        }
Beispiel #5
0
        public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            if (stepCollection.VerifyIfCommandTerminated())
            {
                currentStep = CommandsStep.Finish;
            }
            else
            {
                var currentChar = stepCollection.CharAtIndex;

                if (_commands.Contains(currentChar))
                {
                    currentStep = CommandsStep.AddStep;
                }
                else if (currentChar.Equals(cancelLastOperation))
                {
                    currentStep = CommandsStep.CancelLastOperation;
                }
                else
                {
                    if (int.TryParse(currentChar.ToString(), out int numericChar))
                    {
                        if (currentStep == CommandsStep.CancelLastOperation)
                        {
                            currentStep = CommandsStep.InvalidEntrance;
                        }
                        else
                        {
                            currentStep = CommandsStep.AddRepeats;
                        }
                    }
                    else
                    {
                        currentStep = CommandsStep.InvalidEntrance;
                    }
                }
            }

            return(stepCollection);
        }
        public StepCollection Execute(StepCollection stepCollection, ref CommandsStep currentStep)
        {
            if (stepCollection.StepsSize == 0 || stepCollection.Command[stepCollection.Index - 1].Equals('X'))
            {
                currentStep = CommandsStep.InvalidEntrance;
            }
            else
            {
                stepCollection.AddNumberToLatestStepRepeat(stepCollection.CharAtIndex);

                if (stepCollection.LastStep().Times >= 2147483647 && !stepCollection.Command[stepCollection.Index + 1].Equals('X'))
                {
                    currentStep = CommandsStep.InvalidEntrance;
                }
                else
                {
                    currentStep = CommandsStep.IncreaseIndex;
                }
            }

            return(stepCollection);
        }