public Interpreter(IGenericHelper genericHelper, IFunctionHelper functionHelper, IIntegerHelper integerHelper, IRealHelper realHelper, IBooleanHelper booleanHelper, ISetHelper setHelper, IElementHelper elementHelper, IStringHelper stringHelper, IGraphHelper graphHelper, bool catchExceptions) { _catchExceptions = catchExceptions; _exceptions = new ComponentException(); _functionHelper = functionHelper; _integerHelper = integerHelper; _integerHelper.SetInterpreter(this); _realHelper = realHelper; _realHelper.SetInterpreter(this); _booleanHelper = booleanHelper; _booleanHelper.SetInterpreter(this); _genericHelper = genericHelper; _genericHelper.SetInterpreter(this); _setHelper = setHelper; _setHelper.SetInterpreter(this); _elementHelper = elementHelper; _elementHelper.SetInterpreter(this); _stringHelper = stringHelper; _stringHelper.SetInterpreter(this); _graphHelper = graphHelper; _graphHelper.SetInterpreter(this); }
public Network(List<ILayer> layers, List<ITarget> targets, IFunctionHelper functionhelper, double rate, double momentum) { Layers = layers; Targets = targets; FunctionHelper = functionhelper; Rate = rate; Momentum = momentum; }
public static Interpreter GetIntepreterOnlyWith(IBooleanHelper booleanHelper) { IFunctionHelper functionHelper = Substitute.For <IFunctionHelper>(); IIntegerHelper integerHelper = Substitute.For <IIntegerHelper>(); IRealHelper realHelper = Substitute.For <IRealHelper>(); IGenericHelper genericHelper = Substitute.For <IGenericHelper>(); ISetHelper setHelper = Substitute.For <ISetHelper>(); IElementHelper elemHelper = Substitute.For <IElementHelper>(); IStringHelper stringHelper = Substitute.For <IStringHelper>(); IGraphHelper graphHelper = Substitute.For <IGraphHelper>(); return(new Interpreter(genericHelper, functionHelper, integerHelper, realHelper, booleanHelper, setHelper, elemHelper, stringHelper, graphHelper, false)); }
public void DispatchFunction_IndentifierAndObjectList_CorrectListPassed() { List <Object> expected = new List <Object>() { 23, 2.334, null }; IdentifierExpression input1 = new IdentifierExpression("", 0, 0); IFunctionHelper fhelper = Substitute.For <IFunctionHelper>(); Interpreter interpreter = Utilities.GetIntepreterOnlyWith(fhelper); List <Object> res = null; fhelper.IdentifierFunction(Arg.Any <IdentifierExpression>(), Arg.Do <List <Object> >(x => res = x)); interpreter.DispatchFunction(input1, expected); res.Should().BeEquivalentTo(expected); }
public void DispatchFunction_IdentifierAndObjectList_CorrectValueReturned() { int expected = 17; IdentifierExpression input1 = new IdentifierExpression("", 0, 0); List <Object> input2 = new List <Object>() { 23, 2.334, null }; IFunctionHelper fhelper = Substitute.For <IFunctionHelper>(); Interpreter interpreter = Utilities.GetIntepreterOnlyWith(fhelper); fhelper.IdentifierFunction(Arg.Any <IdentifierExpression>(), Arg.Any <List <Object> >()). Returns(new Function(expected)); Function res = interpreter.DispatchFunction(input1, input2); Assert.AreEqual(expected, res.Reference); }
public void Dispatch_IdentifierAndObjectListAndFunctionType_CorrectIdentifierExprPassed() { IdentifierExpression expected = new IdentifierExpression("", 0, 0); IdentifierExpression input1 = expected; List <Object> input2 = new List <Object>() { 23, 2.334, null }; IFunctionHelper fhelper = Substitute.For <IFunctionHelper>(); Interpreter interpreter = Utilities.GetIntepreterOnlyWith(fhelper); IdentifierExpression res = null; fhelper.IdentifierFunction(Arg.Do <IdentifierExpression>(x => res = x), Arg.Any <List <Object> >()); interpreter.Dispatch(input1, input2, TypeEnum.Function); res.Should().BeEquivalentTo(expected); }