]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / main / classes / core / src / com / ibm / icu / text / NFRuleSet.java
similarity index 98%
rename from jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
rename to jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
index 1c2a8740f38fd86757e875855bb84fd9d05fd327..32ea676957779aef894bc05d59c701697c46ad1e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *******************************************************************************
- * Copyright (C) 1996-2011, International Business Machines Corporation and    *
+ * Copyright (C) 1996-2012, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -58,6 +58,11 @@ final class NFRuleSet {
      */
     private boolean isFractionRuleSet = false;
     
+    /**
+     * True if the rule set is parseable.  
+     */
+    private boolean isParseable = true;
+    
     /**
      * Used to limit recursion for bad rule sets.
      */
@@ -114,6 +119,11 @@ final class NFRuleSet {
             throw new IllegalArgumentException("Empty rule set description");
         }
 
+        if ( name.endsWith("@noparse")) {
+            name = name.substring(0,name.length()-8); // Remove the @noparse from the name
+            isParseable = false;
+        }
+        
         // all of the other members of NFRuleSet are initialized
         // by parseRules()
     }
@@ -311,6 +321,11 @@ final class NFRuleSet {
             return true;
         }
     }
+    
+    public int hashCode() {
+        assert false : "hashCode not designed";
+        return 42;
+    }
 
 
     /**
@@ -380,14 +395,7 @@ final class NFRuleSet {
      * @return true if the rule set can be used for parsing.
      */
     public boolean isParseable() {
-        //TODO:
-        //  In CLDR 1.7, we have no distinction between
-        //  parseable/unparseable.  Rules which have one of
-        //  3 suffixes below are know as unparseable for now.
-        //  We should add the information in CLDR data.
-        return !(name.endsWith("-prefixpart")
-                || name.endsWith("-postfixpart")
-                || name.endsWith("-postfx"));
+        return (isParseable);
     }
 
     //-----------------------------------------------------------------------
@@ -529,7 +537,7 @@ final class NFRuleSet {
         int hi = rules.length;
     if (hi > 0) {
         while (lo < hi) {
-        int mid = (lo + hi) / 2;
+        int mid = (lo + hi) >>> 1;
         if (rules[mid].getBaseValue() == number) {
             return rules[mid];
         }
@@ -716,7 +724,7 @@ final class NFRuleSet {
         // that determines the value we return.
 
         ParsePosition highWaterMark = new ParsePosition(0);
-        Number result = new Long(0);
+        Number result = Long.valueOf(0);
         Number tempResult = null;
 
         // dump out if there's no text to parse