public override List <ulong> Handle(HandlerParameters parameters)
        {
            if (parameters.Operation == HandlerKind.Fibonacci)
            {
                if (parameters.Arguments.Length < 2)
                {
                    Log.Error(new ArgumentException(), INCORRECT_PARAM_QUANTITY);
                    return(null);
                }

                ulong min = parameters.Arguments[0];
                ulong max = parameters.Arguments[1];

                if (min > max)
                {
                    Log.Error(new ArgumentException(), MIN_LESS_THAN_MAX);
                    return(null);
                    //throw new ArgumentException(MIN_LESS_THAN_MAX);
                }
                return(GetFibonacci(min, max));
            }
            else
            {
                if (_successor != null)
                {
                    return(_successor.Handle(parameters));
                }
                else
                {
                    Log.Information(NO_NEXT_HANDLER);
                    return(null);
                }
            }
        }
Esempio n. 2
0
        public override List <ulong> Handle(HandlerParameters parameters)
        {
            if (parameters.Operation == HandlerKind.NumbersSquaresLessThanN)
            {
                if (parameters.Arguments.Length < 1)
                {
                    throw new ArgumentException(INCORRECT_PARAM_QUANTITY);
                }

                return(GetNumberSquiresLessThanN(parameters.Arguments[0]));
            }
            else
            {
                if (_successor != null)
                {
                    return(_successor.Handle(parameters));
                }
                else
                {
                    Log.Information(NO_NEXT_HANDLER);
                    return(null);
                }
            }
        }
Esempio n. 3
0
 public abstract List <ulong> Handle(HandlerParameters parameters);