public CalculatorService(INumberFactory numberFactory) { this.numberFactory = numberFactory; currrentMode = Mode.DEC; Expression = GetExpression("0", "0"); Expressions = new List <Expression <INumber> >(); }
public void SetUp() { //Arrange numberFactory = new NumberFactory(); calculatorService = new CalculatorService(numberFactory) { CurrentMode = Mode.BIN }; }
public ComponentSet(JepInstance j) { this.numFac = j.NumFac; this.varFac = j.VarFac; this.nodeFac = j.NodeFac; this.varTab = j.VarTab; this.funTab = j.FunTab; this.opTab = j.OpTab; this.parser = j.Parser; this.evaluator = j.Evaluator; this.pv = j.PrintVisitor; }
/// <summary> /// Initializes new instance of <see cref="CalculationObjectFactory"/>. /// </summary> /// <param name="numberFactory">Factory of numbers.</param> /// <param name="resourceStore">Store of resources.</param> public CalculationObjectFactory(INumberFactory numberFactory, IResourceStore resourceStore) { _numberFactory = numberFactory; _resourceStore = resourceStore; _knownUnaryFunctions = new Dictionary <string, Func <IHasValue> > { { "log2", () => new Log2(_resourceStore, _numberFactory) } }; _knownBinaryFunctions = new Dictionary <string, Func <IHasValue> > { { "+", () => new Plus(_resourceStore, _numberFactory) }, { "-", () => new Minus(_resourceStore, _numberFactory) }, { "*", () => new Multiply(_resourceStore, _numberFactory) }, { "/", () => new Divide(_resourceStore, _numberFactory) } }; }
public void SetComponents(IJepComponent[] components) { foreach (IJepComponent component in components) { if (component is INumberFactory) { this._numFac = (INumberFactory)component; } else if (component is VariableFactory) { this._varFac = (VariableFactory)component; } else if (component is NodeFactory) { this._nodeFac = (NodeFactory)component; } else if (component is VariableTable) { this._varTab = (VariableTable)component; } else if (component is FunctionTable) { this._funTab = (FunctionTable)component; } else if (component is OperatorTable) { this._opTab = (OperatorTable)component; } else if (component is IParser) { this._parser = (IParser)component; } else if (component is IEvaluator) { this._evaluator = (IEvaluator)component; } else if (component is Colosoft.Text.Jep.PrintVisitor) { this._pv = (Colosoft.Text.Jep.PrintVisitor)component; } } this.ReinitializeComponents(); }
/// <summary> /// Initializes new instance of <see cref="Divide"/>. /// </summary> /// <param name="resourceStore">Store of resources.</param> /// <param name="numberFactory">Number factory.</param> public Divide(IResourceStore resourceStore, INumberFactory numberFactory) : base(resourceStore) { _numberFactory = numberFactory; }
public void init(JepInstance jep) { this.nf = jep.NumFac; }
/// <summary> /// Initializes new instance of <see cref="Multiply"/>. /// </summary> /// <param name="resourceStore">Store of resources.</param> /// <param name="numberFactory">Number factory.</param> public Multiply(IResourceStore resourceStore, INumberFactory numberFactory) : base(resourceStore) { _numberFactory = numberFactory; }
public override void Init(JepInstance jep) { this.nf = jep.NumFac; }
public void SetUp() { //Arrange numberFactory = new NumberFactory(); calculatorService = new CalculatorService(numberFactory); }
public ListWrapper(List<int> numberList, INumberFactory numberFactory) { _numberList = numberList; _numberFactory = numberFactory; }
/// <summary> /// Initializes new instance of <see cref="Plus"/>. /// </summary> /// <param name="resourceStore">Store of resources.</param> /// <param name="numberFactory">Number factory.</param> public Minus(IResourceStore resourceStore, INumberFactory numberFactory) : base(resourceStore) { _numberFactory = numberFactory; }
public Calculator(INumberFactory numberFactory, IOutputService outputService) { this.numberFactory = numberFactory; this.outputService = outputService; }