//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr evaluateArray(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException private Expr evaluateArray(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) { Expr expr = paramExprAbstractEvaluationContext.parseStatement(this.fTable.Implementation); if (!(expr is ExprArray)) { throw new ExprException("Function " + this.fTable.Name + " does not return a Array!"); } return(expr); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr evaluateBoolean(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException private Expr evaluateBoolean(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) { Expr expr = paramExprAbstractEvaluationContext.parseStatement(this.fTable.Implementation); if (!(expr is org.boris.expr.ExprNumber)) { throw new ExprException("Function " + this.fTable.Name + " does not return a Boolean!"); } return(expr); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void popVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException private void popVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) { foreach (FunctionArgumentTable functionArgumentTable in this.inputArguments) { paramExprAbstractEvaluationContext.removeAdditionalVariable(functionArgumentTable.Name.ToUpper()); } foreach (FunctionArgumentTable functionArgumentTable in this.constArguments) { paramExprAbstractEvaluationContext.removeAdditionalVariable(functionArgumentTable.Name.ToUpper()); } foreach (string str in this.previousArgs.Keys) { paramExprAbstractEvaluationContext.addAdditionalVariable(str, (Expr)this.previousArgs[str]); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr evaluateArrayJS(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException private Expr evaluateArrayJS(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) { try { Invocable invocable = (Invocable)Engine; object @object = invocable.invokeFunction(this.fTable.Name, new object[0]); Console.WriteLine("RESULT IS: " + @object); if (@object == null) { throw new ScriptException("Function " + this.fTable.Name + " does not return an array value", this.fTable.Name, 2); } if (@object is NativeArray) { return(ExprArrayUtil.toExprArray((NativeArray)@object)); } if (@object is object[]) { return(ExprArrayUtil.toExprArray((object[])@object)); } if (@object is object[][]) { return(ExprArrayUtil.toExprArray((object[][])@object)); } //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: Console.WriteLine("ARRAY IS OF TYPE: " + @object + " OR " + @object.GetType().FullName); throw new ScriptException("Function " + this.fTable.Name + " does not return an array value", this.fTable.Name, 2); } catch (ScriptException scriptException) { string str = scriptException.Message; if (scriptException.InnerException != null) { str = scriptException.InnerException.Message; } if (str.IndexOf(":", StringComparison.Ordinal) != -1) { str = str.Substring(str.LastIndexOf(":", StringComparison.Ordinal) + 1); } throw new ExprException(str); } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); throw new ExprException(exception.Message); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr innerEvaluate(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException private Expr innerEvaluate(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, Expr[] paramArrayOfExpr) { assertArgCount(paramArrayOfExpr, InputArguments.Count); ExprType[] arrayOfExprType = InputArgTypes; for (sbyte b = 0; b < paramArrayOfExpr.Length; b++) { Expr expr = paramArrayOfExpr[b]; if (expr is ExprEvaluatable) { paramArrayOfExpr[b] = ((ExprEvaluatable)expr).evaluate(paramExprAbstractEvaluationContext); } if (!(paramArrayOfExpr[b] is ExprEvaluatable) && (!(paramArrayOfExpr[b] is org.boris.expr.ExprNumber) || !arrayOfExprType[b].Equals(ExprType.String))) { assertArgType(paramArrayOfExpr[b], arrayOfExprType[b]); } } pushVariables(paramExprAbstractEvaluationContext, paramArrayOfExpr); if (this.fTable.ResultType.Equals("datatype.integer")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateIntegerJS(paramExprAbstractEvaluationContext) : evaluateInteger(paramExprAbstractEvaluationContext)); } if (this.fTable.ResultType.Equals("datatype.decimal")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateDecimalJS(paramExprAbstractEvaluationContext) : evaluateDecimal(paramExprAbstractEvaluationContext)); } if (this.fTable.ResultType.Equals("datatype.date")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateDecimalJS(paramExprAbstractEvaluationContext) : evaluateDecimal(paramExprAbstractEvaluationContext)); } if (this.fTable.ResultType.Equals("datatype.list")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateStringJS(paramExprAbstractEvaluationContext) : evaluateString(paramExprAbstractEvaluationContext)); } if (this.fTable.ResultType.Equals("datatype.boolean")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateBooleanJS(paramExprAbstractEvaluationContext) : evaluateBoolean(paramExprAbstractEvaluationContext)); } if (this.fTable.ResultType.Equals("datatype.array")) { return((!string.ReferenceEquals(this.fTable.Language, null) && this.fTable.Language.Equals("JS")) ? evaluateArrayJS(paramExprAbstractEvaluationContext) : evaluateArray(paramExprAbstractEvaluationContext)); } throw new ExprException("Unknown function return type: " + this.fTable.ResultType); }
//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) { if (this.locked) { throw new ExprException("Can not Invoke a Function from the same Function."); } if (!(paramIEvaluationContext is ExprAbstractEvaluationContext)) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new ExprException("Invalid context class: " + paramIEvaluationContext.GetType().FullName); } ExprAbstractEvaluationContext exprAbstractEvaluationContext = (ExprAbstractEvaluationContext)paramIEvaluationContext; this.locked = true; try { Expr expr = innerEvaluate(exprAbstractEvaluationContext, paramArrayOfExpr); this.locked = false; popVariables(exprAbstractEvaluationContext); return(expr); } catch (ExprException exprException) { this.locked = false; popVariables(exprAbstractEvaluationContext); throw exprException; } catch (Exception exception) { this.locked = false; popVariables(exprAbstractEvaluationContext); Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); throw new ExprException(exception); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr evaluateIntegerJS(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException private Expr evaluateIntegerJS(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) { try { Invocable invocable = (Invocable)Engine; object @object = invocable.invokeFunction(this.fTable.Name, new object[0]); if (@object == null) { throw new ScriptException("Function " + this.fTable.Name + " does not return an integer value", this.fTable.Name, 2); } return(new ExprInteger(int.Parse(@object.ToString()))); } catch (ScriptException scriptException) { string str = scriptException.Message; if (scriptException.InnerException != null) { str = scriptException.InnerException.Message; } if (str.IndexOf(":", StringComparison.Ordinal) != -1) { str = str.Substring(str.LastIndexOf(":", StringComparison.Ordinal) + 1); } throw new ExprException(str); } catch (System.FormatException) { throw new ExprException("Function " + this.fTable.Name + " does not return an integer value"); } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); throw new ExprException(exception.Message); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.boris.expr.Expr evaluateConstant(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, nomitech.common.db.local.FunctionArgumentTable paramFunctionArgumentTable) throws org.boris.expr.ExprException private Expr evaluateConstant(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, FunctionArgumentTable paramFunctionArgumentTable) { if (paramFunctionArgumentTable.Type.Equals("datatype.image")) { return(new ExprString(paramFunctionArgumentTable.DefaultValue)); } if (paramFunctionArgumentTable.Type.Equals("datatype.calcvalue")) { try { return(new ExprDouble((new double?(paramFunctionArgumentTable.ValidationStatement)))); } catch (Exception) { } } Expr expr = paramExprAbstractEvaluationContext.parseStatement(paramFunctionArgumentTable.ValidationStatement); if (paramFunctionArgumentTable.Type.Equals("datatype.calcvalue") && !(expr is org.boris.expr.ExprNumber) && !(expr is ExprString)) { throw new ExprException("Function " + this.fTable.Name + " has constant " + paramFunctionArgumentTable.Name + " that does not return a Number or Text"); } return(expr); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void pushVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException public virtual void pushVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, Expr[] paramArrayOfExpr) { bool @bool = false; if (this.jsLanguage && this.engine == null) { @bool = true; } this.previousArgs.Clear(); sbyte b = 0; foreach (FunctionArgumentTable functionArgumentTable in this.inputArguments) { if (paramExprAbstractEvaluationContext.hasAdditionalVariable(this.fTable.Name.ToUpper())) { this.previousArgs[functionArgumentTable.Name] = paramExprAbstractEvaluationContext.getAdditionalVariableValue(functionArgumentTable.Name); } paramExprAbstractEvaluationContext.addAdditionalVariable(functionArgumentTable.Name.ToUpper(), paramArrayOfExpr[b]); if (this.jsLanguage) { if (paramArrayOfExpr[b] is ExprDouble) { Engine.put(functionArgumentTable.Name, Convert.ToDouble(((ExprDouble)paramArrayOfExpr[b]).doubleValue())); } else if (paramArrayOfExpr[b] is ExprInteger) { Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprInteger)paramArrayOfExpr[b]).intValue())); } else if (paramArrayOfExpr[b] is ExprBoolean) { Engine.put(functionArgumentTable.Name, Convert.ToBoolean(((ExprBoolean)paramArrayOfExpr[b]).booleanValue())); } else if (paramArrayOfExpr[b] is ExprArray) { Engine.put(functionArgumentTable.Name, ExprArrayUtil.toObjectArray((ExprArray)paramArrayOfExpr[b])); } else { Engine.put(functionArgumentTable.Name, ((ExprString)paramArrayOfExpr[b]).str); } } b++; } foreach (FunctionArgumentTable functionArgumentTable in this.constArguments) { if (paramExprAbstractEvaluationContext.hasAdditionalVariable(this.fTable.Name.ToUpper())) { this.previousArgs[functionArgumentTable.Name] = paramExprAbstractEvaluationContext.getAdditionalVariableValue(functionArgumentTable.Name); } Expr expr = evaluateConstant(paramExprAbstractEvaluationContext, functionArgumentTable); paramExprAbstractEvaluationContext.addAdditionalVariable(functionArgumentTable.Name.ToUpper(), expr); if (this.jsLanguage) { if (expr is ExprDouble) { Engine.put(functionArgumentTable.Name, Convert.ToDouble(((ExprDouble)expr).doubleValue())); continue; } if (expr is ExprInteger) { Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprInteger)expr).intValue())); continue; } if (expr is ExprBoolean) { Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprBoolean)expr).intValue())); continue; } if (paramArrayOfExpr[b] is ExprArray) { Engine.put(functionArgumentTable.Name, ExprArrayUtil.toObjectArray((ExprArray)paramArrayOfExpr[b])); continue; } Engine.put(functionArgumentTable.Name, ((ExprString)expr).str); } } if (@bool) { string str = "function " + this.fTable.Name + "() {" + this.fTable.Implementation + "\n}"; try { Engine.eval(str); } catch (ScriptException scriptException) { string str1 = scriptException.Message; if (scriptException.InnerException != null) { str1 = scriptException.InnerException.Message; } if (str1.IndexOf(":", StringComparison.Ordinal) != -1) { str1 = str1.Substring(str1.LastIndexOf(":", StringComparison.Ordinal)); } throw new ExprException(str1); } catch (Exception exception) { throw new ExprException(exception.Message); } } }