Package java.text

Examples of java.text.RuleBasedCollator$CollationElement


        if (collator == null && stringCollator == null) {
            String rulesAtt = props.getProperty("rules");
            if (rulesAtt != null) {
                try {
                    collator = new RuleBasedCollator(rulesAtt);
                } catch (ParseException e) {
                    throw new XPathException("Invalid collation rules: " + e.getMessage());
                }
            }
View Full Code Here


        // available from the GNU Classpath library.

        String rulesAtt = props.getProperty("rules");
        if (rulesAtt!=null && stringCollator==null) {
            try {
                stringCollator = new NamedCollation(uri, new RuleBasedCollator(rulesAtt));
            } catch (ParseException e) {
                throw new XPathException("Invalid collation rules: " + e.getMessage());
            }
        }
View Full Code Here

            if (!(collator instanceof RuleBasedCollator)) {
                dynamicError("The collation for " + getDisplayName(context.getController().getNamePool()) +
                        " must be a RuleBaseCollator", context);
                return null;
            }
            RuleBasedCollator rbc = (RuleBasedCollator)collator;
            CollationElementIterator iter0 = rbc.getCollationElementIterator(s0);
            CollationElementIterator iter1 = rbc.getCollationElementIterator(s1);

            switch (operation) {
                case STARTSWITH:
                    return BooleanValue.get( collationStartsWith(iter0, iter1) );
                case CONTAINS:
View Full Code Here

        if (rulesAtt!=null) {
            if (langAtt != null || strengthAtt != null || decompositionAtt != null) {
                compileError("The rules attribute cannot be combined with lang, strength, or decomposition");
            }
            try {
                collator = new RuleBasedCollator(rulesAtt);
            } catch (ParseException e) {
                collator = Collator.getInstance()// so that error paths work
                compileError("Invalid collation rules: " + e.getMessage());
            }
        }
View Full Code Here

    //If we are dealing with territory based collation and returnDVD is
    //of type StringDataValue, then we need to return a StringDataValue  
    //with territory based collation.
    if (returnDVD instanceof StringDataValue) {
      try {
        RuleBasedCollator rbs = ConnectionUtil.getCurrentLCC().getDataValueFactory().
        getCharacterCollator(typeDescriptor.getCollationType());
        return ((StringDataValue)returnDVD).getValue(rbs);
      }
      catch( java.sql.SQLException sqle)
      {
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

     * RESOLVE - unfinished LIKE test with dataset of all unicode characters
     **/
    private static final void printRuleBasedCollator()
    {
        // get en_US Collator rules
        RuleBasedCollator en_USCollator =
            (RuleBasedCollator)Collator.getInstance(Locale.US);
        String en_rules = en_USCollator.getRules();

        System.out.println("ENGLISH RULES: " + en_rules);
        System.out.println("ENGLISH RULES: " + formatString(en_rules, true));
        System.out.println("ENGLISH RULES: " + formatString(en_rules, false));
    }
View Full Code Here

        while (lastNonspaceChar > 0 &&
               rawData[lastNonspaceChar - 1] == '\u0020')
            lastNonspaceChar--;         // count off the trailing spaces.

        RuleBasedCollator rbc = getCollatorForCollation();     
        cKey = rbc.getCollationKey(new String(rawData, 0, lastNonspaceChar));

        return cKey;
    }
View Full Code Here

    throw noLocale();
  }

  /** @exception StandardException  Thrown on error */
  public RuleBasedCollator getCollator() throws StandardException {
    RuleBasedCollator retval = ruleBasedCollator;

    if (retval == null) {
      if (databaseLocale != null) {
        retval = ruleBasedCollator =
          (RuleBasedCollator) Collator.getInstance(databaseLocale);
View Full Code Here

        doTest(comp);
    }


    public void testRuleComparator() {
        RuleBasedCollator comp = (RuleBasedCollator)RuleBasedCollator.getInstance();
        doTest(comp);
    }
View Full Code Here

TOP

Related Classes of java.text.RuleBasedCollator$CollationElement

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.