/// <summary> /// This methods takes a string of input function arguments, evaluates each /// argument and creates a one String and two Integers value for each /// argument from the result of the evaluations. /// </summary> /// <param name="arguments"> /// The arguments of values to parse. </param> /// <param name="delimiter"> /// The delimiter to use while parsing. /// </param> /// <returns> An array list of object values found in the input string. /// </returns> /// <exception cref="FunctionException"> /// Thrown if the stirng does not properly parse into the /// proper objects. </exception> //ORIGINAL LINE: public static java.util.ArrayList getOneStringAndTwoIntegers(final String arguments, final char delimiter) throws FunctionException public static ArrayList getOneStringAndTwoIntegers(string arguments, char delimiter) { //ORIGINAL LINE: final java.util.ArrayList returnValues = new java.util.ArrayList(); ArrayList returnValues = new ArrayList(); try { //ORIGINAL LINE: final net.sourceforge.jeval.ArgumentTokenizer tokenizer = new net.sourceforge.jeval.ArgumentTokenizer(arguments, delimiter); ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, delimiter); int tokenCtr = 0; while (tokenizer.hasMoreTokens()) { if (tokenCtr == 0) { //ORIGINAL LINE: final String token = tokenizer.nextToken().trim(); string token = tokenizer.nextToken().Trim(); returnValues.Add(token); } else if (tokenCtr == 1 || tokenCtr == 2) { //ORIGINAL LINE: final String token = tokenizer.nextToken().trim(); string token = tokenizer.nextToken().Trim(); //returnValues.Add(new int((Convert.ToDouble(token)).intValue())); } else { throw new FunctionException("Invalid values in string."); } tokenCtr++; } } catch (Exception e) { throw new FunctionException("Invalid values in string.", e); } return(returnValues); }
protected internal virtual string processNestedFunctions(string arguments) { StringBuilder evaluatedArguments = new StringBuilder(); // Process nested function calls. if (arguments.Length > 0) { Evaluator argumentsEvaluator = new Evaluator(quoteCharacter, loadMathVariables, loadMathFunctions, loadStringFunctions, processNestedFunctions_Renamed); argumentsEvaluator.Functions = Functions; argumentsEvaluator.Variables = Variables; argumentsEvaluator.VariableResolver = VariableResolver; ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); IList evalautedArgumentList = new ArrayList(); while (tokenizer.hasMoreTokens()) { string argument = tokenizer.nextToken().Trim(); try { argument = argumentsEvaluator.evaluate(argument); } catch (Exception e) { throw new EvaluationException(e.Message, e); } evalautedArgumentList.Add(argument); } IEnumerator evaluatedArgumentIterator = evalautedArgumentList.GetEnumerator(); while (evaluatedArgumentIterator.MoveNext()) { if (evaluatedArguments.Length > 0) { evaluatedArguments.Append(EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); } string evaluatedArgument = (string)evaluatedArgumentIterator.Current; evaluatedArguments.Append(evaluatedArgument); } } return(evaluatedArguments.ToString()); }
/// <summary> /// This methods takes a string of input function arguments, evaluates each /// argument and creates a Double value for each argument from the result of /// the evaluations. /// </summary> /// <param name="arguments"> /// The arguments to parse. </param> /// <param name="delimiter"> /// The delimiter to use while parsing. /// </param> /// <returns> An array list of Double values found in the input string. /// </returns> /// <exception cref="FunctionException"> /// Thrown if the string does not properly parse into Double /// values. </exception> //ORIGINAL LINE: public static java.util.ArrayList getDoubles(final String arguments, final char delimiter) throws FunctionException public static ArrayList getDoubles(string arguments, char delimiter) { ArrayList returnValues = new ArrayList(); try { //ORIGINAL LINE: final net.sourceforge.jeval.ArgumentTokenizer tokenizer = new net.sourceforge.jeval.ArgumentTokenizer(arguments, delimiter); ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, delimiter); while (tokenizer.hasMoreTokens()) { //ORIGINAL LINE: final String token = tokenizer.nextToken().trim(); string token = tokenizer.nextToken().Trim(); returnValues.Add(Convert.ToDouble(token)); } } catch (Exception e) { throw new FunctionException("Invalid values in string.", e); } return(returnValues); }
/// <summary> /// This methods takes a string of input function arguments, evaluates each /// argument and creates a String value for each argument from the result of /// the evaluations. /// </summary> /// <param name="arguments"> /// The arguments of values to parse. </param> /// <param name="delimiter"> /// The delimiter to use while parsing. /// </param> /// <returns> An array list of String values found in the input string. /// </returns> /// <exception cref="FunctionException"> /// Thrown if the stirng does not properly parse into String /// values. </exception> //ORIGINAL LINE: public static java.util.ArrayList getStrings(final String arguments, final char delimiter) throws FunctionException public static ArrayList getStrings(string arguments, char delimiter) { //ORIGINAL LINE: final java.util.ArrayList returnValues = new java.util.ArrayList(); ArrayList returnValues = new ArrayList(); try { ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, delimiter); while (tokenizer.hasMoreTokens()) { //ORIGINAL LINE: final String token = tokenizer.nextToken(); string token = tokenizer.nextToken(); returnValues.Add(token); } } catch (Exception e) { throw new FunctionException("Invalid values in string.", e); } return(returnValues); }