コード例 #1
0
        public ArithmeticExpression MakeAssignmentRHS(Value value)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();
            arithmeticExpression.AddValue(value);

            return arithmeticExpression;
        }
コード例 #2
0
ファイル: RuleMaker.cs プロジェクト: Exospector/Cthulours
        public ArithmeticExpression MakeArithmeticExperssion(Value value)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();

            arithmeticExpression.AddValue(value);

            return arithmeticExpression;
        }
コード例 #3
0
ファイル: RuleMaker.cs プロジェクト: Exospector/Cthulours
        public ArithmeticExpression MakeArithmeticExperssion(SubExpressionType expression)
        {
            ArithmeticExpression arithmeticExpression = new ArithmeticExpression();

            arithmeticExpression.AddSubExpression(expression);

            return arithmeticExpression;
        }
コード例 #4
0
		public RelationalType MakeRelational(RelationalOperator op, ArithmeticExpression lhs, ArithmeticExpression rhs)
        {
            RelationalType newRelational = new RelationalType();

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

            return newRelational;

        }
コード例 #5
0
		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;
        }
コード例 #6
0
ファイル: RuleMaker.cs プロジェクト: Exospector/Cthulours
        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);
        }
コード例 #7
0
		public void ReplaceExpressionAt(ArithmeticExpression newValue, int index)
		{
			ReplaceDomElementAt("", "Expression", index, newValue);
		}
コード例 #8
0
		public void InsertExpressionAt(ArithmeticExpression newValue, int index)
		{
			InsertDomElementAt("", "Expression", index, newValue);
		}
コード例 #9
0
		public void AddExpression(ArithmeticExpression newValue)
		{
			AppendDomElement("", "Expression", newValue);
		}
コード例 #10
0
 public void ReplaceRHSArithmeticExpressionAt(ArithmeticExpression newValue, int index)
 {
     ReplaceDomElementAt("", "RHSArithmeticExpression", index, newValue);
 }
コード例 #11
0
 public void InsertRHSArithmeticExpressionAt(ArithmeticExpression newValue, int index)
 {
     InsertDomElementAt("", "RHSArithmeticExpression", index, newValue);
 }
コード例 #12
0
 public void AddRHSArithmeticExpression(ArithmeticExpression newValue)
 {
     AppendDomElement("", "RHSArithmeticExpression", newValue);
 }
コード例 #13
0
		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;
		}
コード例 #14
0
			public ValueEnumerator(ArithmeticExpression par) 
			{
				parent = par;
				nIndex = -1;
			}
コード例 #15
0
		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;
		}
コード例 #16
0
 public ValueEnumerator(ArithmeticExpression par)
 {
     parent = par;
     nIndex = -1;
 }