public ArithmeticExpression MakeArithmeticExperssion(SubExpressionType expression) { ArithmeticExpression arithmeticExpression = new ArithmeticExpression(); arithmeticExpression.AddSubExpression(expression); return arithmeticExpression; }
public ArithmeticExpression MakeArithmeticSubExperssion(string op, ArithmeticExpression lhs, ArithmeticExpression rhs) { ArithemticOperator arithmeticOP = new ArithemticOperator(); SubExpressionType newArithmetic = new SubExpressionType(); if (op == "+") arithmeticOP.AddAdd(new Altova.Types.SchemaString("Addition")); else if (op == "-") arithmeticOP.AddSubtract(new Altova.Types.SchemaString("Subtract")); else if (op == "*") arithmeticOP.AddMultiply(new Altova.Types.SchemaString("Multiply")); else if (op == "/") arithmeticOP.AddDivide(new Altova.Types.SchemaString("Divide")); else if (op == "^") arithmeticOP.AddPower(new Altova.Types.SchemaString("Mod")); else if (op == "Log") arithmeticOP.AddLog(new Altova.Types.SchemaString("Log")); newArithmetic.AddLHSArithmeticExpression(lhs); newArithmetic.AddArithmeticOperator(arithmeticOP); newArithmetic.AddRHSArithmeticExpression(rhs); return MakeArithmeticExperssion(newArithmetic); }
NodeBase CreateMathNode(SubExpressionType exp) { ArithemticOperator op = exp.GetArithmeticOperator(); OperationType operationType = OperationType.ADD; //Add if (op.HasAdd()) { operationType = OperationType.ADD; } //Subtract else if (op.HasSubtract()) { operationType = OperationType.SUBTRACT; } //Divide else if (op.HasDivide()) { operationType = OperationType.DIVIDE; } //Multiply else if (op.HasMultiply()) { operationType = OperationType.MULTIPLY; } //Power else if (op.HasPower()) { operationType = OperationType.POWER; } //Log : assumes that RHS is the base and LHS is the number. else if (op.HasLog()) { operationType = OperationType.LOG; } ArithmeticNode node = new ArithmeticNode(m_Container); node.m_OperationType = operationType; node.AddChild(CreateArithmeticNode(exp.GetLHSArithmeticExpression())); node.AddChild(CreateArithmeticNode(exp.GetRHSArithmeticExpression())); return node; }
public RHSArithmeticExpressionEnumerator(SubExpressionType par) { parent = par; nIndex = -1; }
public ArithmeticOperatorEnumerator(SubExpressionType par) { parent = par; nIndex = -1; }
public void ReplaceSubExpressionAt(SubExpressionType newValue, int index) { ReplaceDomElementAt("", "SubExpression", index, newValue); }
public void InsertSubExpressionAt(SubExpressionType newValue, int index) { InsertDomElementAt("", "SubExpression", index, newValue); }
public void AddSubExpression(SubExpressionType newValue) { AppendDomElement("", "SubExpression", newValue); }