Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 1);
            string str1 = null;

            if (paramArrayOfExpr[0] is ExprString)
            {
                str1 = paramArrayOfExpr[0].ToString();
            }
            else if (paramArrayOfExpr[0] is ExprVariable)
            {
                ExprVariable exprVariable = (ExprVariable)paramArrayOfExpr[0];
                Expr         expr         = paramIEvaluationContext.evaluateVariable(exprVariable);
                if (!(expr is ExprString))
                {
                    throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String");
                }
                str1 = expr.ToString();
            }
            else
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String");
            }
            string str2 = Unit1ToUnit2Util.Instance.getUnit2(str1);

            return(new ExprString(str2));
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertArgCount(paramArrayOfExpr, 1);
            string str = null;

            if (paramArrayOfExpr[0] is org.boris.expr.ExprString)
            {
                str = paramArrayOfExpr[0].ToString();
            }
            else if (paramArrayOfExpr[0] is ExprVariable)
            {
                ExprVariable exprVariable = (ExprVariable)paramArrayOfExpr[0];
                Expr         expr         = paramIEvaluationContext.evaluateVariable(exprVariable);
                if (!(expr is org.boris.expr.ExprString))
                {
                    throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String");
                }
                str = expr.ToString();
            }
            else
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String");
            }
            decimal bigDecimal = Unit1ToUnit2Util.Instance.getUnitDiv(str);

            if (bigDecimal == null)
            {
                bigDecimal = BigDecimalMath.ZERO;
            }
            return(new ExprDouble(bigDecimal.doubleValue()));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void validate(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual void validate(ExprVariable paramExprVariable)
        {
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(IEvaluationContext paramIEvaluationContext, ExprVariable paramExprVariable)
        {
            return(paramExprVariable.evaluate(paramIEvaluationContext));
        }