Example #1
0
 public HomeController(
     IBasicCalculator basicCalculator       = null,
     IExtendedCalculator extendedCalculator = null)
 {
     _basicCalculator    = basicCalculator;
     _extendedCalculator = extendedCalculator;
 }
Example #2
0
 internal PolygonData(int minimumDistance)
 {
     _minimumDistance     = minimumDistance;
     _currentPointCount   = 0;
     _maxSizes            = new int[MaxPoints];
     _points              = new Point[MaxPoints];
     _verticalHorizontals = new VH[MaxPoints];
     _basicCalculator     = new BasicCalculator();
     _positionCalculator  = new PositionCalculator(_basicCalculator);
 }
Example #3
0
        public CalcQuery(IBasicCalculator calculator)
        {
            Field <OperationType>(
                "addition",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand1", Description = "First Operand"
            },
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand2", Description = "Second Operand"
            }
                    ),
                resolve: context => calculator.GetAdditionResult((double)context.GetArgument <float>("operand1"), (double)context.GetArgument <float>("operand2")).Result
                );

            Field <OperationType>(
                "subtraction",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand1", Description = "First Operand"
            },
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand2", Description = "Second Operand"
            }
                    ),
                resolve: context => calculator.GetSubtractionResult((double)context.GetArgument <float>("operand1"), (double)context.GetArgument <float>("operand2")).Result
                );

            Field <OperationType>(
                "multiplication",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand1", Description = "First Operand"
            },
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand2", Description = "Second Operand"
            }
                    ),
                resolve: context => calculator.GetMultiplicationResult((double)context.GetArgument <float>("operand1"), (double)context.GetArgument <float>("operand2")).Result
                );

            Field <OperationType>(
                "division",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand1", Description = "First Operand"
            },
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand2", Description = "Second Operand"
            }
                    ),
                resolve: context => calculator.GetDivisionResult((double)context.GetArgument <float>("operand1"), (double)context.GetArgument <float>("operand2")).Result
                );

            Field <OperationType>(
                "exponentiation",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand1", Description = "First Operand"
            },
                    new QueryArgument <NonNullGraphType <FloatGraphType> > {
                Name = "operand2", Description = "Second Operand"
            }
                    ),
                resolve: context => calculator.GetExponentiationResult((double)context.GetArgument <float>("operand1"), (double)context.GetArgument <float>("operand2")).Result
                );
        }
Example #4
0
 public PositionCalculator(IBasicCalculator basicCalculator)
 {
     _basicCalculator = basicCalculator;
 }