Package java.text

Examples of java.text.Collator


  public boolean equals(Object other) {

    if (other instanceof RangeCollatorAttributeImpl) {
      RangeCollatorAttributeImpl rangeCollatorAttr = (RangeCollatorAttributeImpl) other;
     
      Collator thisCollator = getRangeCollator();
      Collator otherCollator = rangeCollatorAttr.getRangeCollator();

      if (otherCollator == thisCollator
          || otherCollator.equals(thisCollator)) {

        return true;

      }
View Full Code Here


  }

  @Override
  public int hashCode() {
    Collator collator = getRangeCollator();
    return (collator == null) ? 0 : collator.hashCode();
  }
View Full Code Here

  }
 
  public void testThreadSafe() throws Exception {
    int iters = 20 * RANDOM_MULTIPLIER;
    for (int i = 0; i < iters; i++) {
      Collator collator = Collator.getInstance(Locale.GERMAN);
      collator.setStrength(Collator.PRIMARY);
      assertThreadSafe(new CollationKeyAnalyzer(collator));
    }
  }
View Full Code Here

    RangeCollatorAttribute rangeCollatorAttr = config
        .addAttribute(RangeCollatorAttribute.class);

    Assert.assertTrue(null == rangeCollatorAttr.getRangeCollator());
    Assert.assertTrue(null == config.get(ConfigurationKeys.RANGE_COLLATOR));
    Collator collator = new Collator() {

      @Override
      public int compare(String arg0, String arg1) {
        return 0;
      }
View Full Code Here

      boolean inclusive = false;
     
      Locale locale = getQueryConfigHandler().get(ConfigurationKeys.LOCALE,
          Locale.getDefault());
     
      Collator collator = getQueryConfigHandler().get(
          ConfigurationKeys.RANGE_COLLATOR);
     
     
      CharSequence field = parametricRangeNode.getField();
      String fieldStr = null;
View Full Code Here

    QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "content", new WhitespaceAnalyzer(TEST_VERSION_CURRENT));

    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator.  However, the Arabic Locale seems to order the Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));
    qp.setRangeCollator(c);

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
    // index Term below should NOT be returned by a ConstantScoreRangeQuery
View Full Code Here

    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator. However, the Arabic Locale seems to order the
    // Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));
    qp.setRangeCollator(c);

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the
    // single
View Full Code Here

     * If it does, the tests that use Swedish locale will fail.
     *
     * @return true if the bug is present, false otherwise
     */
    private static boolean hasBuggySwedishLocale() {
        Collator c = Collator.getInstance(new Locale("sv"));
        if (c.compare("aa", "ab") < 0) {
            // OK, aa should be less than ab with Swedish collation
            return false;
        } else {
            // this is a bug
            return true;
View Full Code Here

            m_sorter = new PageSorter( HumanComparator.DEFAULT_HUMAN_COMPARATOR );
        }
        else
            try
            {
                Collator collator = new RuleBasedCollator( order );
                collator.setStrength( Collator.PRIMARY );
                m_sorter = new PageSorter( new CollatorComparator( collator ) );
            }
            catch( ParseException pe )
            {
                log.info( "Failed to parse requested collator - using default ordering", pe );
View Full Code Here

                          //System.out.println("File ADDDED !!!!");
                        }
                    }
                    Collections.sort(files, new Comparator() {
                        public int compare(Object arg0, Object arg1) {
                            Collator comp = Collator.getInstance(Locale.US);
                            comp.setStrength(Collator.PRIMARY);
                            return comp.compare(((StoredFile) arg0).getName().toLowerCase(), ((StoredFile) arg1).getName().toLowerCase() );
                        }
                    });
                    folder.setStoredFiles(files);
                   
                    this.isStoredFilesInit = true;
View Full Code Here

TOP

Related Classes of java.text.Collator

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.