Package com.ibm.icu.util

Examples of com.ibm.icu.util.VersionInfo


                case UProperty.AGE:
                    {
                        // Must munge name, since
                        // VersionInfo.getInstance() does not do
                        // 'loose' matching.
                        VersionInfo version = VersionInfo.getInstance(mungeCharName(valueAlias));
                        applyFilter(new VersionFilter(version), UCharacterProperty.SRC_PROPSVEC);
                        return this;
                    }
                }
View Full Code Here


    private static class VersionFilter implements Filter {
        VersionInfo version;
        VersionFilter(VersionInfo version) { this.version = version; }
        public boolean contains(int ch) {
            VersionInfo v = UCharacter.getAge(ch);
            // Reference comparison ok; VersionInfo caches and reuses
            // unique objects.
            return v != NO_VERSION &&
                   v.compareTo(version) <= 0;
        }
View Full Code Here

     * Test toString()
     */
    public void TesttoString()
    {
        for (int i = 0; i < TOSTRING_STRING_.length; i ++) {
            VersionInfo v = VersionInfo.getInstance(TOSTRING_STRING_[i]);
            if (!v.toString().equals(TOSTRING_RESULT_[i])) {
                errln("toString() for " + TOSTRING_STRING_[i] +
                      " should produce " + TOSTRING_RESULT_[i]);
            }
            v = getInstance(TOSTRING_INT_[i]);
            if (!v.toString().equals(TOSTRING_RESULT_[i])) {
                errln("toString() for " + TOSTRING_INT_[i] +
                      " should produce " + TOSTRING_RESULT_[i]);
            }
        }
    }
View Full Code Here

    /**
     * Test Comparable interface
     */
    public void TestComparable() {
        try {
            VersionInfo v = VersionInfo.ICU_VERSION;
            String s  = "Some String";
            if(v.compareTo(s) >0) {
                errln("VersionInfo.compareTo(String) returned >0, should have thrown exception");
            } else {
                errln("VersionInfo.compareTo(String) returned <=0, should have thrown exception");
            }
        } catch(ClassCastException cce) {
            logln("Pass: compareTo(String) returned " + cce.toString());
        }
        for (int i = 0; i < COMPARE_NOT_EQUAL_STRING_.length; i += 2) {
            VersionInfo v1 =
                        VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i]);
            Object v2 =
                    VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i + 1]);
            if (v1.compareTo(v2) == 0) {
                errln(COMPARE_NOT_EQUAL_STRING_[i] + " should not equal " +
                      COMPARE_NOT_EQUAL_STRING_[i + 1]);
            }
        }
        for (int i = 0; i < COMPARE_EQUAL_STRING_.length - 1; i ++) {
            VersionInfo v1 =
                        VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i]);
            Object v2 =
                    VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i + 1]);
            if (v1.compareTo(v2) != 0) {
                errln(COMPARE_EQUAL_STRING_[i] + " should equal " +
                      COMPARE_EQUAL_STRING_[i + 1]);
            }
        }
    }
View Full Code Here

        /*
         * The following checks work only starting from Unicode 4.0.
         * Check the version number here.
         */
        VersionInfo version =    UCharacter.getUnicodeVersion();
        if(version.getMajor()<4 || version.equals(VersionInfo.getInstance(4, 0, 1))) {
            return;
        }



View Full Code Here

                      0x3f4,   3, 1, 0, 0,
                      0x10300, 3, 1, 0, 0,
                      0x220,   3, 2, 0, 0,
                      0xff603, 2, 0, 0};
        for (int i = 0; i < ages.length; i += 5) {
            VersionInfo age = UCharacter.getAge(ages[i]);
            if (age != VersionInfo.getInstance(ages[i + 1], ages[i + 2],
                                               ages[i + 3], ages[i + 4])) {
                errln("error: getAge(\\u" + Integer.toHexString(ages[i]) +
                      ") == " + age.toString() + " instead of " +
                      ages[i + 1] + "." + ages[i + 2] + "." + ages[i + 3] +
                      "." + ages[i + 4]);
            }
        }
    }
View Full Code Here

        }
        if( UCharacter.getIntPropertyMaxValue(UProperty.EAST_ASIAN_WIDTH) !=  (UCharacter.EastAsianWidth.COUNT -1)) {
            errln("error: UCharacter.getIntPropertyMaxValue(UProperty.EAST_ASIAN_WIDTH) wrong\n");
        }

        VersionInfo version = UCharacter.getUnicodeVersion();

        // test hasBinaryProperty()
        for (int i = 0; i < props.length; ++ i) {
            if (props[i][0] < 0) {
                if (version.compareTo(VersionInfo.getInstance(props[i][1] >> 8,
                                                          (props[i][1] >> 4) & 0xF,
                                                          props[i][1] & 0xF,
                                                          0)) < 0) {
                    break;
                }
View Full Code Here

        if (readICUHeader) {
            byte[] UnicodeVersion = ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
                                 UCA_AUTHENTICATE_);
            // weiv: check that we have the correct Unicode version in
            // binary files
            VersionInfo UCDVersion = UCharacter.getUnicodeVersion();
            if(UnicodeVersion[0] != UCDVersion.getMajor()
            || UnicodeVersion[1] != UCDVersion.getMinor()) {
                throw new IOException(WRONG_UNICODE_VERSION_ERROR_);
            }
        }
        m_dataInputStream_ = new DataInputStream(inputStream);
    }
View Full Code Here

         byte[] UnicodeVersion = ICUBinary.readHeader(inputStream, INVERSE_UCA_DATA_FORMAT_ID_,
                              INVERSE_UCA_AUTHENTICATE_);
                             
        // weiv: check that we have the correct Unicode version in
        // binary files
        VersionInfo UCDVersion = UCharacter.getUnicodeVersion();
        if(UnicodeVersion[0] != UCDVersion.getMajor()
        || UnicodeVersion[1] != UCDVersion.getMinor()) {
            throw new IOException(WRONG_UNICODE_VERSION_ERROR_);
        }
                             
        CollationParsedRuleBuilder.InverseUCA result =
                                  new CollationParsedRuleBuilder.InverseUCA();
View Full Code Here

        version[0] = input.readByte();
        version[1] = input.readByte();
        version[2] = input.readByte();
        version[3] = input.readByte();
       
        VersionInfo result =
        VersionInfo.getInstance(
            (int)version[0], (int)version[1],
            (int)version[2], (int)version[3]);
       
        return result;
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.VersionInfo

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.