Package com.ibm.icu.math

Examples of com.ibm.icu.math.BigDecimal


           
            return bds;
        }
       
        public boolean hasSameBehavior(Object a, Object b) {
            BigDecimal bda = (BigDecimal) a;
            BigDecimal bdb = (BigDecimal) b;
           
            return bda.toString().equals(bdb.toString());
        }
View Full Code Here


     * @stable ICU 3.2
     */
    public static BigDecimal bigDecimalFrom(double otherTime, int timeScale)
    {
        TimeScaleData data     = getTimeScaleData(timeScale);
        BigDecimal other       = new BigDecimal(String.valueOf(otherTime));
        BigDecimal units       = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return other.add(epochOffset).multiply(units);
    }
View Full Code Here

     * @stable ICU 3.2
     */
    public static BigDecimal bigDecimalFrom(long otherTime, int timeScale)
    {
        TimeScaleData data     = getTimeScaleData(timeScale);
        BigDecimal other       = new BigDecimal(otherTime);
        BigDecimal units       = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return other.add(epochOffset).multiply(units);
    }
View Full Code Here

     */
    public static BigDecimal bigDecimalFrom(BigDecimal otherTime, int timeScale)
    {
        TimeScaleData data = getTimeScaleData(timeScale);
       
        BigDecimal units = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return otherTime.add(epochOffset).multiply(units);
    }
View Full Code Here

     * @stable ICU 3.2
     */
    public static BigDecimal toBigDecimal(long universalTime, int timeScale)
    {
        TimeScaleData data     = getTimeScaleData(timeScale);
        BigDecimal universal   = new BigDecimal(universalTime);
        BigDecimal units       = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return universal.divide(units, BigDecimal.ROUND_HALF_UP).subtract(epochOffset);
    }
View Full Code Here

     * @stable ICU 3.2
     */
    public static BigDecimal toBigDecimal(BigDecimal universalTime, int timeScale)
    {
        TimeScaleData data     = getTimeScaleData(timeScale);
        BigDecimal units       = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return universalTime.divide(units, BigDecimal.ROUND_HALF_UP).subtract(epochOffset);
    }
View Full Code Here

     * @deprecated This API is ICU internal only.
     */
    public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale)
    {
        TimeScaleData data = getTimeScaleData(timeScale);
        BigDecimal units = new BigDecimal(data.units);
        BigDecimal epochOffset = new BigDecimal(data.epochOffset);
       
        return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset);
    }
View Full Code Here

   *
   * @stable ICU 3.2
   */
  public static BigDecimal bigDecimalFrom(double otherTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);
    BigDecimal other = new BigDecimal(String.valueOf(otherTime));
    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return other.add(epochOffset).multiply(units);
  }
View Full Code Here

   *
   * @stable ICU 3.2
   */
  public static BigDecimal bigDecimalFrom(long otherTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);
    BigDecimal other = new BigDecimal(otherTime);
    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return other.add(epochOffset).multiply(units);
  }
View Full Code Here

   * @stable ICU 3.2
   */
  public static BigDecimal bigDecimalFrom(BigDecimal otherTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);

    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return otherTime.add(epochOffset).multiply(units);
  }
View Full Code Here

TOP

Related Classes of com.ibm.icu.math.BigDecimal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.