Package java.text

Examples of java.text.Collator$CollatorGetter


        }
        else if (s2 == null) {
            return 1;
        }
        else {
            Collator c = (Collator)collators.get(locale);
            if (c == null) {
                c = Collator.getInstance(locale);
                c.setDecomposition(LocaleSupport.decompositionFlag(locale));
                collators.put(locale, c);
            }
            return c.compare(s1, s2);
        }
    }
View Full Code Here


   * @return  Comparator for sorting hits.
   * @throws IOException If an error occurs reading the index.
   */
  static ScoreDocComparator comparatorStringLocale (final IndexReader reader, final String fieldname, final Locale locale)
  throws IOException {
    final Collator collator = Collator.getInstance (locale);
    final String field = fieldname.intern();
    final String[] index = FieldCache.DEFAULT.getStrings (reader, field);
    return new ScoreDocComparator() {

      public final int compare(final ScoreDoc i, final ScoreDoc j) {
      String is = index[i.doc];
      String js = index[j.doc];
      if (is == js) {
        return 0;
      } else if (is == null) {
        return -1;
      } else if (js == null) {
        return 1;
      } else {
        return collator.compare(is, js);
      }
    }

      public Comparable sortValue (final ScoreDoc i) {
        return index[i.doc];
View Full Code Here

  }


  Comparator comparatorStringLocale(final String fieldName,
      Locale locale) {
    final Collator collator = Collator.getInstance(locale);
    return new ShardComparator(fieldName) {
      public final int compare(final Object o1, final Object o2) {
        ShardDoc sd1 = (ShardDoc) o1;
        ShardDoc sd2 = (ShardDoc) o2;
        Comparable v1 = (Comparable)sortVal(sd1);
        Comparable v2 = (Comparable)sortVal(sd2);
        if (v1==v2)
          return 0;
        if (v1==null)
          return 1;
        if(v2==null)
          return -1;
        return -collator.compare(v1,v2);
      }
    };
  }
View Full Code Here

    public List<GWTJahiaNode> searchSQL(String searchString, int limit, List<String> nodeTypes, List<String> mimeTypes,
                                        List<String> filters, List<String> fields,boolean sortOnDisplayName) throws GWTJahiaServiceException {
        List<GWTJahiaNode> gwtJahiaNodes = search.searchSQL(searchString, limit, nodeTypes, mimeTypes, filters, fields,
                retrieveCurrentSession());
        if (sortOnDisplayName) {
            final Collator collator = Collator.getInstance(retrieveCurrentSession().getLocale());
            Collections.sort(gwtJahiaNodes, new Comparator<GWTJahiaNode>() {
                public int compare(GWTJahiaNode o1, GWTJahiaNode o2) {
                    return collator.compare(o1.getDisplayName(), o2.getDisplayName());
                }
            });
        }
        return gwtJahiaNodes;
    }
View Full Code Here

     * @return the result of the comparison
     * @see java.util.Comparator#compare(Object, Object)
     */
    public int compare( Principal o1, Principal o2 )
    {
        Collator collator = Collator.getInstance();
        return collator.compare( o1.getName(), o2.getName() );
    }
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

      /***/

   }
   public int compare( String content, String facetValue ){
      Locale    loc       = Locale.getDefault();
      Collator  collator  = Collator.getInstance( loc );
      return collator.compare( content, facetValue );
   }
View Full Code Here

    }


    public int compare( String value1, String value2 ) {
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( value1, value2 );
    }
View Full Code Here

        }
    }

    public int compare( String content, String facetValue ){
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( content, facetValue );
    }
View Full Code Here

     *            the source string to compare with this string
     */
    public int collate(String source) {
        if (source == null)
            data_RaiseNilOperandExcpt();
        Collator myCollator = Collator.getInstance();
        return myCollator.compare(source, theString.toString());
    }
View Full Code Here

TOP

Related Classes of java.text.Collator$CollatorGetter

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.