public ArithmeticExpression MakeAssignmentRHS(Value value)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();
            arithmeticExpression.AddValue(value);

            return arithmeticExpression;
        }
Exemple #2
0
        public ArithmeticExpression MakeArithmeticExperssion(Value value)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();

            arithmeticExpression.AddValue(value);

            return arithmeticExpression;
        }
Exemple #3
0
        public ArithmeticExpression MakeArithmeticExperssion(SubExpressionType expression)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();

            arithmeticExpression.AddSubExpression(expression);

            return arithmeticExpression;
        }
		public RelationalType MakeRelational(RelationalOperator op, ArithmeticExpression lhs, ArithmeticExpression rhs)
        {
            RelationalType newRelational = new RelationalType();

            newRelational.AddLHSArithmeticExpression(lhs);
            newRelational.AddRelationalOperator(op);
            newRelational.AddRHSArithmeticExpression(rhs);

            return newRelational;

        }
		public LogicalExpression MakeRelationalExperssion(string op, ArithmeticExpression lhs, ArithmeticExpression rhs)
        {
            RelationalOperator relationalOp = new RelationalOperator();
            if (op == "==")
                relationalOp.AddEquals(new Altova.Types.SchemaString("Equals"));
            else if (op == "!=")
                relationalOp.AddNotEquals(new Altova.Types.SchemaString("NotEquals"));
            else if (op == "<")
                relationalOp.AddLessThan(new Altova.Types.SchemaString("LessThan"));
            else if (op == "<=")
                relationalOp.AddLessThanOrEquals(new Altova.Types.SchemaString("LessThanOrEquals"));
            else if (op == ">")
                relationalOp.AddGreaterThan(new Altova.Types.SchemaString("GreaterThan"));
            else if (op == "<=")
                relationalOp.AddGreaterThanOrEquals(new Altova.Types.SchemaString("GreaterThanOrEquals"));

			RelationalType relationalExpression = MakeRelational(relationalOp, lhs, rhs);

            LogicalExpression newLogical = new LogicalExpression();
			newLogical.AddRelational(relationalExpression);

            return newLogical;
        }
Exemple #6
0
        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);
        }
		public void ReplaceExpressionAt(ArithmeticExpression newValue, int index)
		{
			ReplaceDomElementAt("", "Expression", index, newValue);
		}
		public void InsertExpressionAt(ArithmeticExpression newValue, int index)
		{
			InsertDomElementAt("", "Expression", index, newValue);
		}
		public void AddExpression(ArithmeticExpression newValue)
		{
			AppendDomElement("", "Expression", newValue);
		}
Exemple #10
0
 public void ReplaceRHSArithmeticExpressionAt(ArithmeticExpression newValue, int index)
 {
     ReplaceDomElementAt("", "RHSArithmeticExpression", index, newValue);
 }
Exemple #11
0
 public void InsertRHSArithmeticExpressionAt(ArithmeticExpression newValue, int index)
 {
     InsertDomElementAt("", "RHSArithmeticExpression", index, newValue);
 }
Exemple #12
0
 public void AddRHSArithmeticExpression(ArithmeticExpression newValue)
 {
     AppendDomElement("", "RHSArithmeticExpression", newValue);
 }
		NodeBase CreateArithmeticNode(ArithmeticExpression exp)
		{
			NodeBase node = null;
			
			if (exp.HasSubExpression())
			{
				node = CreateMathNode(exp.GetSubExpression());
			}
			else
			{
				if (exp.GetValue().HasConstant())
				{
					node = new ConstantNode(m_Container);
					if (exp.GetValue().GetConstant().HasFloat2())
					{
						((ConstantNode)node).m_ConstantValue = (float)exp.GetValue().GetConstant().GetFloat2().Value;
						((ConstantNode)node).m_ConstantType = VariableType.FLOAT;
					}
					else if (exp.GetValue().GetConstant().HasInteger())
					{
						((ConstantNode)node).m_ConstantValue = (int)exp.GetValue().GetConstant().GetInteger().Value;
						((ConstantNode)node).m_ConstantType = VariableType.INT;
					}
					else if (exp.GetValue().GetConstant().HasBoolean())
					{
						((ConstantNode)node).m_ConstantValue = (bool)exp.GetValue().GetConstant().GetBoolean().Value;
						((ConstantNode)node).m_ConstantType = VariableType.BOOLEAN;
					}
					else if (exp.GetValue().GetConstant().HasString2())
					{
						((ConstantNode)node).m_ConstantValue = (string)exp.GetValue().GetConstant().GetString2().Value;
						((ConstantNode)node).m_ConstantType = VariableType.STRING;
					}
				}
				else
				{
					node = new VariableNode(m_Container);
					((VariableNode)node).m_VariableName = exp.GetValue().GetVariable().GetName().Value;
					((VariableNode)node).m_VariableType = (VariableType)exp.GetValue().GetVariable().GetType2().Value;
				}
			}
			
			return node;
		}
			public ValueEnumerator(ArithmeticExpression par) 
			{
				parent = par;
				nIndex = -1;
			}
		public XMLRules.ActionType MakeStateChangeAction(string name, AiRuleEngine.VariableType type, ArithmeticExpression value)
		{
			XMLRules.ActionType action = new XMLRules.ActionType();
			AssignmentExpression assignment = new AssignmentExpression();
			assignment.AddVariable(MakeVariable(name, type).GetVariable());
			assignment.AddExpression(value);
			
			action.AddCertainty(new Altova.Types.SchemaDecimal(100));
			action.AddChangeState(assignment);
			
			return action;
		}
 public ValueEnumerator(ArithmeticExpression par)
 {
     parent = par;
     nIndex = -1;
 }