Package java.text

Examples of java.text.AttributedCharacterIterator.current()


                System.out.println("glyph count: " + layout.getGlyphCount()); //=getNumGlyphs()
            }
            //Gather all characters of the run
            StringBuffer chars = new StringBuffer();
            for (runaci.first(); runaci.getIndex() < runaci.getEndIndex();) {
                chars.append(runaci.current());
                runaci.next();
            }
            runaci.first();
            if (DEBUG) {
                System.out.println("Text: " + chars);
View Full Code Here


    // as - Attributed string to attribute with Word extents.
    public static void findLineBrk(AttributedString as) {
        AttributedCharacterIterator aci = as.getIterator();
        if (aci.getEndIndex() == 0)
            return;
        char ch = aci.current(), prevCh = (char)-1;
        byte         cls = getCharCharClass(ch);
        if (cls == CHAR_CLASS_LF) cls = CHAR_CLASS_BK;
        byte      curCls = cls;
        byte     prevCls = cls;
        byte prevPrevCls = -1;
View Full Code Here

        checkIterator(imr.getCommittedText(0, 14, null), 0, 0, 14);
        AttributedCharacterIterator it = imr.getCommittedText(0, 14, null);
        String committedText = "IM fitestfghij";
        for (int i = 0; i < 14; i++) {
            it.setIndex(i);
            assertEquals(committedText.charAt(i), it.current());
        }
        checkIterator(imr.getCommittedText(3, 8, null), 0, 0, 5);
        try {
            imr.getCommittedText(2, 20, null);
        } catch (IllegalArgumentException e) {
View Full Code Here

   */
  public void test_current() {
    String test = "Test 23ring";
    AttributedString attrString = new AttributedString(test);
    AttributedCharacterIterator it = attrString.getIterator();
    assertEquals("Wrong first", 'T', it.current());
    it.next();
    assertEquals("Wrong second", 'e', it.current());
    for (int i = 0; i < 9; i++)
      it.next();
    assertEquals("Wrong last", 'g', it.current());
View Full Code Here

    String test = "Test 23ring";
    AttributedString attrString = new AttributedString(test);
    AttributedCharacterIterator it = attrString.getIterator();
    assertEquals("Wrong first", 'T', it.current());
    it.next();
    assertEquals("Wrong second", 'e', it.current());
    for (int i = 0; i < 9; i++)
      it.next();
    assertEquals("Wrong last", 'g', it.current());
    it.next();
    assertTrue("Wrong final", it.current() == CharacterIterator.DONE);
View Full Code Here

    assertEquals("Wrong first", 'T', it.current());
    it.next();
    assertEquals("Wrong second", 'e', it.current());
    for (int i = 0; i < 9; i++)
      it.next();
    assertEquals("Wrong last", 'g', it.current());
    it.next();
    assertTrue("Wrong final", it.current() == CharacterIterator.DONE);

    it = attrString.getIterator(null, 2, 8);
    assertEquals("Wrong first2", 's', it.current());
View Full Code Here

    assertEquals("Wrong second", 'e', it.current());
    for (int i = 0; i < 9; i++)
      it.next();
    assertEquals("Wrong last", 'g', it.current());
    it.next();
    assertTrue("Wrong final", it.current() == CharacterIterator.DONE);

    it = attrString.getIterator(null, 2, 8);
    assertEquals("Wrong first2", 's', it.current());
  }
View Full Code Here

    assertEquals("Wrong last", 'g', it.current());
    it.next();
    assertTrue("Wrong final", it.current() == CharacterIterator.DONE);

    it = attrString.getIterator(null, 2, 8);
    assertEquals("Wrong first2", 's', it.current());
  }

  /**
   * @tests java.text.AttributedCharacterIterator#first()
   */
 
View Full Code Here

  public void test_setIndexI() {
    String test = "Test 23ring";
    AttributedString attrString = new AttributedString(test);
    AttributedCharacterIterator it = attrString.getIterator();
    it.setIndex(5);
    assertEquals("Wrong first", '2', it.current());
  }

  /**
   * @tests java.text.AttributedCharacterIterator#getRunLimit(java.text.AttributedCharacterIterator$Attribute)
   */
 
View Full Code Here

                Map map = acit.getAttributes();
                int limit = acit.getRunLimit();
                if (map.isEmpty()) {
                    // Must be pattern literal - '~'
                    while (acit.getIndex() < limit) {
                        if (acit.current() != SEPCHAR) {
                            errln("FAIL: Invalid pattern literal at " + acit.current() + " in patterns[" + i + "]");
                        }
                        acit.next();
                    }
                } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.