Esempio n. 1
0
        public Value MakeConstant(AiRuleEngine.VariableType type, object value)
        {
            Value        newValue    = new Value();
            ConstantType newConstant = new ConstantType();

            switch (type)
            {
            case AiRuleEngine.VariableType.BOOLEAN:
                newConstant.AddBoolean(new Altova.Types.SchemaBoolean((bool)value));
                break;

            case AiRuleEngine.VariableType.INT:
                newConstant.AddInteger(new Altova.Types.SchemaLong((long)(int)value));
                break;

            case AiRuleEngine.VariableType.FLOAT:
                newConstant.AddFloat2(new Altova.Types.SchemaDecimal((decimal)(float)value));
                break;

            case AiRuleEngine.VariableType.STRING:
                newConstant.AddString2(new Altova.Types.SchemaString((string)value));
                break;
            }

            newValue.AddConstant(newConstant);

            return(newValue);
        }
Esempio n. 2
0
        public Value MakeVariable(string name, AiRuleEngine.VariableType type)
        {
            Value newValue = new Value();

            XMLRules.VariableType newVariable = new XMLRules.VariableType();
            newVariable.AddName(new Altova.Types.SchemaString(name));
            newVariable.AddType2(new Altova.Types.SchemaLong((long)type));
            newValue.AddVariable(newVariable);

            return(newValue);
        }
Esempio n. 3
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);
        }