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)
        {
            assertMinArgCount(paramArrayOfExpr, 2);
            assertMaxArgCount(paramArrayOfExpr, 2);
            if ((paramArrayOfExpr[0]).evaluatable)
            {
                paramArrayOfExpr[0] = evalArg(paramIEvaluationContext, paramArrayOfExpr[0]);
            }
            if ((paramArrayOfExpr[1]).evaluatable)
            {
                paramArrayOfExpr[1] = evalArg(paramIEvaluationContext, paramArrayOfExpr[1]);
            }
            string str1 = asString(paramIEvaluationContext, paramArrayOfExpr[0], false);
            string str2 = asString(paramIEvaluationContext, paramArrayOfExpr[1], false);

            string[]  arrayOfString = str1.Split(str2, true);
            ExprArray exprArray     = new ExprArray(arrayOfString.Length, 1);
            sbyte     b             = 0;

            foreach (string str in arrayOfString)
            {
                exprArray.set(b++, new ExprString(str));
            }
            return(exprArray);
        }
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);
            ExprArray exprArray = asArray(paramIEvaluationContext, paramArrayOfExpr[0], true);

            return(new ExprInteger(exprArray.rows()));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.boris.expr.ExprArray addColumnToArray(org.boris.expr.ExprArray paramExprArray1, org.boris.expr.ExprArray paramExprArray2) throws org.boris.expr.ExprException
        private ExprArray addColumnToArray(ExprArray paramExprArray1, ExprArray paramExprArray2)
        {
            int       i         = paramExprArray1.rows();
            int       j         = paramExprArray1.columns() + paramExprArray2.columns();
            ExprArray exprArray = new ExprArray(i, j);

            for (sbyte b = 0; b < i; b++)
            {
                for (int k = 0; k < j; k++)
                {
                    ExprInteger exprInteger = null;
                    if (k < paramExprArray1.columns())
                    {
                        exprInteger = paramExprArray1.get(b, k);
                    }
                    else
                    {
                        int m = k - paramExprArray1.columns();
                        if (b < paramExprArray2.rows() && m < paramExprArray2.columns())
                        {
                            exprInteger = paramExprArray2.get(b, m);
                        }
                        else
                        {
                            exprInteger = new ExprInteger(0);
                        }
                    }
                    exprArray.set(b, k, exprInteger);
                }
            }
            return(exprArray);
        }
//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);
            ExprArray exprArray = asArray(paramIEvaluationContext, paramArrayOfExpr[0], true);

            if (exprArray.length() == 0)
            {
                return(new ExprDouble(0.0D));
            }
            Expr expr = exprArray.get(0, 0);

            if (expr is org.boris.expr.ExprError)
            {
                throw new ExprException("Error:" + expr.ToString());
            }
            return(!(expr is org.boris.expr.ExprNumber) ? new ExprDouble(0.0D) : expr);
        }
//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)
        {
            assertMinArgCount(paramArrayOfExpr, 2);
            ExprArray exprArray = null;

            foreach (Expr expr in paramArrayOfExpr)
            {
                ExprArray exprArray1 = asArray(paramIEvaluationContext, expr, true);
                if (exprArray == null)
                {
                    exprArray = exprArray1;
                }
                else
                {
                    exprArray = calcArrays(exprArray, exprArray1);
                }
            }
            return(exprArray);
        }
        private ExprArray calcArrays(ExprArray paramExprArray1, ExprArray paramExprArray2)
        {
            int       i         = paramExprArray1.rows();
            int       j         = paramExprArray1.columns();
            int       k         = paramExprArray2.rows();
            int       m         = paramExprArray2.columns();
            ExprArray exprArray = new ExprArray(i, j);

            for (sbyte b = 0; b < i; b++)
            {
                for (sbyte b1 = 0; b1 < j; b1++)
                {
                    Expr expr = paramExprArray1.get(b, b1);
                    if (!expr.evaluatable && expr is ExprNumber && b < k && b1 < m)
                    {
                        Expr expr1 = paramExprArray2.get(b, b1);
                        if (!expr1.evaluatable && expr1 is ExprNumber)
                        {
                            ExprNumber exprNumber1 = (ExprNumber)expr;
                            ExprNumber exprNumber2 = (ExprNumber)expr1;
                            if (exprNumber2.doubleValue() == 0.0D)
                            {
                                exprArray.set(b, b1, new ExprDouble(0.0D));
                            }
                            else if (exprNumber1 is ExprDouble)
                            {
                                exprArray.set(b, b1, new ExprDouble(exprNumber1.doubleValue() / exprNumber2.doubleValue()));
                            }
                            else
                            {
                                exprArray.set(b, b1, new ExprInteger(exprNumber1.intValue() / exprNumber2.intValue()));
                            }
                        }
                    }
                    else
                    {
                        exprArray.set(b, b1, expr);
                    }
                }
            }
            return(exprArray);
        }