예제 #1
0
        private int SetInitialValue(int x, int y, InitialOperation initialOperation)
        {
            try {
                switch (initialOperation)
                {
                case InitialOperation.Addition:
                    return(x.AddWith(y));

                case InitialOperation.Subtraction:
                    return(y.SubtractFrom(x));

                case InitialOperation.Multiplication:
                    return(x.MultiplyWith(y));

                case InitialOperation.Division:
                    return(x.DivideBy(y));

                case InitialOperation.Modulus:
                    return(x.ModulusBy(y));
                }
            }
            finally {
                OperationsDone++;
            }

            return(-1);
        }
예제 #2
0
        public QueryBuilder(int x, int y, InitialOperation initialOperation)
        {
            BaseElementX   = x;
            BaseElementY   = y;
            CurrentValue   = 0;
            OperationsDone = 0;
            Operation      = initialOperation;

            CurrentValue = SetInitialValue(x, y, initialOperation);
        }
예제 #3
0
 public static QueryBuilder GenerateQuery(this Tuple <int, int> intialElementTuple, InitialOperation initialOperation)
 => new QueryBuilder(intialElementTuple.Item1, intialElementTuple.Item2, initialOperation);