phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snakhoda-sfdc <...@git.apache.org>
Subject [GitHub] phoenix pull request #275: PHOENIX-4237: Add function to calculate Java coll...
Date Thu, 19 Oct 2017 16:07:10 GMT
Github user snakhoda-sfdc commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/275#discussion_r145747600
  
    --- Diff: phoenix-core/src/main/java/com/ibm/icu/impl/jdkadapter/NumberFormatICU.java
---
    @@ -0,0 +1,229 @@
    +// © 2016 and later: Unicode, Inc. and others.
    +// License & terms of use: http://www.unicode.org/copyright.html#License
    +/*
    + *******************************************************************************
    + * Copyright (C) 2008, International Business Machines Corporation and         *
    + * others. All Rights Reserved.                                                *
    + *******************************************************************************
    + */
    +package com.ibm.icu.impl.jdkadapter;
    +
    +import java.math.RoundingMode;
    +import java.text.FieldPosition;
    +import java.text.ParseException;
    +import java.text.ParsePosition;
    +import java.util.Currency;
    +
    +import com.ibm.icu.impl.icuadapter.NumberFormatJDK;
    +import com.ibm.icu.text.NumberFormat;
    +
    +/**
    + * NumberFormatICU is an adapter class which wraps ICU4J NumberFormat and
    + * implements java.text.NumberFormat APIs.
    + */
    +public class NumberFormatICU extends java.text.NumberFormat {
    +
    +    private static final long serialVersionUID = 4892903815641574060L;
    +
    +    private NumberFormat fIcuNfmt;
    +
    +    private NumberFormatICU(NumberFormat icuNfmt) {
    +        fIcuNfmt = icuNfmt;
    +    }
    +
    +    public static java.text.NumberFormat wrap(NumberFormat icuNfmt) {
    +        if (icuNfmt instanceof NumberFormatJDK) {
    +            return ((NumberFormatJDK)icuNfmt).unwrap();
    +        }
    +        return new NumberFormatICU(icuNfmt);
    +    }
    +
    +    public NumberFormat unwrap() {
    +        return fIcuNfmt;
    +    }
    +
    +    @Override
    +    public Object clone() {
    +        NumberFormatICU other = (NumberFormatICU)super.clone();
    +        other.fIcuNfmt = (NumberFormat)fIcuNfmt.clone();
    +        return other;
    +    }
    +
    +    @Override
    +    public boolean equals(Object obj) {
    +        if (obj instanceof NumberFormatICU) {
    +            return ((NumberFormatICU)obj).fIcuNfmt.equals(fIcuNfmt);
    +        }
    +        return false;
    +    }
    +
    +    //public String format(double number)
    --- End diff --
    
    Thanks for taking a look at this PR, @solzy. This code is external and simply copied over
from ICU4J 59.1. The reason it's here at all is that that project doesn't have all its artifacts
in maven. I'm hoping to have a new PR in the near future to remove this external code and
replace it with maven dependencies. CC: @JamesRTaylor 


---

Mime
View raw message