/// <summary> /// Parse a Long or Double from the specified String starting at the index /// specified by the ParsePosition. If the string is successfully parsed, the /// index of the ParsePosition is updated to the index following the parsed /// text. /// </summary> /// /// <param name="string">the String to parse</param> /// <param name="position">the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred</param> /// <returns>a Long or Double resulting from the parse, or null if there is an /// error. The result will be a Long if the parsed number is an /// integer in the range of a long, otherwise the result is a Double.</returns> public override object Parse(String str0, ParsePosition position) { object number = dform.Parse(str0, position); if (null == number) { return(null); } if (this.IsParseBigDecimal()) { if (number is Int64) { return(new Decimal(Convert.ToInt64(number))); } if ((number is Double) && !Double.IsInfinity((double)((Double)number)) && !ILOG.J2CsMapping.Util.DoubleHelper.IsNaN(((Double)number))) { return(new Decimal(Convert.ToDouble(number))); } if (number is Int64) { return(new Decimal(Convert.ToDouble(number))); } if (number is IBM.ICU.Math.BigDecimal) { return(Decimal.Parse(number.ToString())); } return(number); } if ((number is IBM.ICU.Math.BigDecimal)) { return(((IBM.ICU.Math.BigDecimal)number).DoubleValue()); } /* * TODO: Here Int64 is BigInteger ... * if (number is Int64) { * return (double) Convert.ToInt64(number); * }*/ if (this.IsParseIntegerOnly() && number.Equals(NEGATIVE_ZERO_DOUBLE)) { return((long)(0)); } return(number); }