Esempio n. 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 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()));
        }
Esempio n. 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 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));
        }
Esempio n. 3
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, 2);
            if (paramArrayOfExpr[0] is ExprVariable)
            {
                paramArrayOfExpr[0] = paramIEvaluationContext.evaluateVariable((ExprVariable)paramArrayOfExpr[0]);
            }
            if (!(paramArrayOfExpr[0] is ExprLocation))
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a Location.");
            }
            if (!(paramArrayOfExpr[1] is ExprNumber))
            {
                throw new ExprException("Input " + paramArrayOfExpr[1].ToString() + " is not a Number.");
            }
            ExprLocation exprLocation = (ExprLocation)paramArrayOfExpr[0];
            ExprNumber   exprNumber   = (ExprNumber)paramArrayOfExpr[1];

            if (exprLocation.Factors.Count == 0)
            {
                return(new ExprDouble(1.0D));
            }
            LocalizationFactorTable localizationFactorTable = exprLocation.FirstFactor;

            if (exprNumber.intValue() == 0)
            {
                return(new ExprDouble(localizationFactorTable.AssemblyFactor.doubleValue()));
            }
            if (exprNumber.intValue() == 1)
            {
                return(new ExprDouble(localizationFactorTable.EquipmentFactor.doubleValue()));
            }
            if (exprNumber.intValue() == 2)
            {
                return(new ExprDouble(localizationFactorTable.SubcontractorFactor.doubleValue()));
            }
            if (exprNumber.intValue() == 3)
            {
                return(new ExprDouble(localizationFactorTable.LaborFactor.doubleValue()));
            }
            if (exprNumber.intValue() == 4)
            {
                return(new ExprDouble(localizationFactorTable.MaterialFactor.doubleValue()));
            }
            if (exprNumber.intValue() == 5)
            {
                return(new ExprDouble(localizationFactorTable.ConsumableFactor.doubleValue()));
            }
            throw new ExprException("Invalid factorType value " + exprNumber.intValue() + " valid values are: 0,1,2,3,4,5");
        }
//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);
            if (paramArrayOfExpr[0] is ExprVariable)
            {
                paramArrayOfExpr[0] = paramIEvaluationContext.evaluateVariable((ExprVariable)paramArrayOfExpr[0]);
            }
            if (!(paramArrayOfExpr[0] is ExprLocation))
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a Location.");
            }
            ExprLocation exprLocation = (ExprLocation)paramArrayOfExpr[0];

            return(new ExprString(exprLocation.State));
        }