Package java.text

Examples of java.text.CollationElementIterator


 
  
   
  private final int[] getFirstCaseDiff(final String text, final String pattern, final Locale locale){
       
        final CollationElementIterator targIter = m_collator.getCollationElementIterator(text);
        final CollationElementIterator patIter = m_collator.getCollationElementIterator(pattern)
        int startTarg = -1;
        int endTarg = -1;
        int startPatt = -1;
        int endPatt = -1;
        final int done = getElement(CollationElementIterator.NULLORDER);
        int patternElement = 0, targetElement = 0;
        boolean getPattern = true, getTarget = true;
       
        while (true) {
            if (getPattern){
                 startPatt = patIter.getOffset();
                 patternElement = getElement(patIter.next());
                 endPatt = patIter.getOffset();
            }
            if ((getTarget)){              
                 startTarg  = targIter.getOffset();
                 targetElement   = getElement(targIter.next());
                 endTarg  = targIter.getOffset();
View Full Code Here


    }

    intArray = new int[getLength()];

    RuleBasedCollator rbc = getLocaleFinder().getCollator();
    CollationElementIterator cei = rbc.getCollationElementIterator(getString());
    int nextInt;
    while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
    {
      /* Believe it or not, a String might have more
       * collation elements than characters.
       * So, we handle that case by increasing the int array
       * by 5 and copying array elements.
View Full Code Here

    }

    Boolean result;

    // get the collation integer representing "_"
    CollationElementIterator cei =
                  collator.getCollationElementIterator("_");
    anyCharInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyCharInts.length + 1];
        for (int index = 0; index < anyCharInts.length; index++)
        {
          temp[index] = anyCharInts[index];
        }
        temp[anyCharInts.length] = nextInt;
        anyCharInts = temp;
      }
    }
    // get the collation integer representing "%"
    cei = collator.getCollationElementIterator("%");
    anyStringInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyStringInts.length + 1];
        for (int index = 0; index < anyStringInts.length; index++)
        {
          temp[index] = anyStringInts[index];
View Full Code Here

 
  
   
  private final int[] getFirstCaseDiff(final String text, final String pattern, final Locale locale){
       
        final CollationElementIterator targIter = m_collator.getCollationElementIterator(text);
        final CollationElementIterator patIter = m_collator.getCollationElementIterator(pattern)
        int startTarg = -1;
        int endTarg = -1;
        int startPatt = -1;
        int endPatt = -1;
        final int done = getElement(CollationElementIterator.NULLORDER);
        int patternElement = 0, targetElement = 0;
        boolean getPattern = true, getTarget = true;
       
        while (true) {
            if (getPattern){
                 startPatt = patIter.getOffset();
                 patternElement = getElement(patIter.next());
                 endPatt = patIter.getOffset();
            }
            if ((getTarget)){              
                 startTarg  = targIter.getOffset();
                 targetElement   = getElement(targIter.next());
                 endTarg  = targIter.getOffset();
View Full Code Here

    }
       

    collationElementsForString = new int[stringData.getLength()];

    CollationElementIterator cei =
            collatorForCharacterDatatypes.getCollationElementIterator(
                stringData.getString());

    int nextInt;
    while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
    {
      /* Believe it or not, a String might have more
       * collation elements than characters.
       * So, we handle that case by increasing the int array
       * by 5 and copying array elements.
View Full Code Here

    }

    intArray = new int[getLength()];

    RuleBasedCollator rbc = getLocaleFinder().getCollator();
    CollationElementIterator cei = rbc.getCollationElementIterator(getString());
    int nextInt;
    while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
    {
      /* Believe it or not, a String might have more
       * collation elements than characters.
       * So, we handle that case by increasing the int array
       * by 5 and copying array elements.
View Full Code Here

    }

    Boolean result;

    // get the collation integer representing "_"
    CollationElementIterator cei =
                  collator.getCollationElementIterator("_");
    anyCharInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyCharInts.length + 1];
        for (int index = 0; index < anyCharInts.length; index++)
        {
          temp[index] = anyCharInts[index];
        }
        temp[anyCharInts.length] = nextInt;
        anyCharInts = temp;
      }
    }
    // get the collation integer representing "%"
    cei = collator.getCollationElementIterator("%");
    anyStringInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyStringInts.length + 1];
        for (int index = 0; index < anyStringInts.length; index++)
        {
          temp[index] = anyStringInts[index];
View Full Code Here

        {
            Locale locale = new Locale("es", "", "TRADITIONAL");
            RuleBasedCollator coll = (RuleBasedCollator) Collator
                    .getInstance(locale);
            String source = "cha";
            CollationElementIterator iterator = coll
                    .getCollationElementIterator(source);
            int[] e_offset = { 0, 2, 3 };
            int offset = iterator.getOffset();
            int i = 0;
            assertEquals(e_offset[i++], offset);
            while (offset != source.length()) {
                iterator.next();
                offset = iterator.getOffset();
                assertEquals(e_offset[i++], offset);
            }
        }

        {
            Locale locale = new Locale("de", "DE");
            RuleBasedCollator coll = (RuleBasedCollator) Collator
                    .getInstance(locale);
            String source = "\u00E6b";
            CollationElementIterator iterator = coll
                    .getCollationElementIterator(source);
            int[] e_offset = { 0, 1, 1, 2 };
            int offset = iterator.getOffset();
            int i = 0;
            assertEquals(e_offset[i++], offset);
            while (offset != source.length()) {
                iterator.next();
                offset = iterator.getOffset();
                assertEquals(e_offset[i++], offset);
            }
        }
        //Regression for HARMONY-1352
        try {
View Full Code Here

            Locale locale = new Locale("es", "", "TRADITIONAL");
            RuleBasedCollator coll = (RuleBasedCollator) Collator
                    .getInstance(locale);
            String text = "cha";
            StringCharacterIterator source = new StringCharacterIterator(text);
            CollationElementIterator iterator = coll
                    .getCollationElementIterator(source);
            int[] e_offset = { 0, 2, 3 };
            int offset = iterator.getOffset();
            int i = 0;
            assertEquals(e_offset[i++], offset);
            while (offset != text.length()) {
                iterator.next();
                offset = iterator.getOffset();
                // System.out.println(offset);
                assertEquals(e_offset[i++], offset);
            }
        }

        {
            Locale locale = new Locale("de", "DE");
            RuleBasedCollator coll = (RuleBasedCollator) Collator
                    .getInstance(locale);
            String text = "\u00E6b";
            StringCharacterIterator source = new StringCharacterIterator(text);
            CollationElementIterator iterator = coll
                    .getCollationElementIterator(source);
            int[] e_offset = { 0, 1, 1, 2 };
            int offset = iterator.getOffset();
            int i = 0;
            assertEquals(e_offset[i++], offset);
            while (offset != text.length()) {
                iterator.next();
                offset = iterator.getOffset();
                assertEquals(e_offset[i++], offset);
            }
        }
        //Regression for HARMONY-1352
        try {
View Full Code Here

 
  
   
  private final int[] getFirstCaseDiff(final String text, final String pattern, final Locale locale){
       
        final CollationElementIterator targIter = m_collator.getCollationElementIterator(text);
        final CollationElementIterator patIter = m_collator.getCollationElementIterator(pattern)
        int startTarg = -1;
        int endTarg = -1;
        int startPatt = -1;
        int endPatt = -1;
        final int done = getElement(CollationElementIterator.NULLORDER);
        int patternElement = 0, targetElement = 0;
        boolean getPattern = true, getTarget = true;
       
        while (true) {
            if (getPattern){
                 startPatt = patIter.getOffset();
                 patternElement = getElement(patIter.next());
                 endPatt = patIter.getOffset();
            }
            if ((getTarget)){              
                 startTarg  = targIter.getOffset();
                 targetElement   = getElement(targIter.next());
                 endTarg  = targIter.getOffset();
View Full Code Here

TOP

Related Classes of java.text.CollationElementIterator

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.