Пример #1
0
        public object EvaluateVariable(Variable var)
        {
            var expressionValue = EvaluateVariableExpression(var.GetHashCode());
            var actualValue = var.Value;

            if (var.Formula == Variable.CALCULATION_NONE)
            {
                var.Value = expressionValue;
                return expressionValue;
            }

            if (actualValue == null) actualValue = 0.0;

            var val = (double) actualValue;
            if (var.Formula == Variable.CALCULATION_COUNT)
            {
                val ++;
                var.Value = val;
            }
            else if (var.Formula == Variable.CALCULATION_SUM)
            {
                val = var.sum + (double) expressionValue;
                var.sum = val;
                var.Value = val;
            }
            else if (var.Formula == Variable.CALCULATION_AVERAGE)
            {
            }
            else if (var.Formula == Variable.CALCULATION_HIGHEST)
            {
            }
            else if (var.Formula == Variable.CALCULATION_LOWEST)
            {
            }
            return val;
        }
Пример #2
0
 private static string Case(Variable variable)
 {
     return "		case " + variable.GetHashCode() + ":\n" +
            "		o = " + variable.Expression.Trim() + ";\n" +
            "		break;\n";
 }