Class DocumentCharacterIterator

  • All Implemented Interfaces:
    java.lang.Cloneable, java.text.CharacterIterator

    public class DocumentCharacterIterator
    extends java.lang.Object
    implements java.text.CharacterIterator
    A CharacterIterator over a Document. Only a partial implementation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.swing.text.Document doc  
      private int docPos
      Position of iterator in document.
      private int segmentEnd
      Index of end of current segment in document.
      private javax.swing.text.Segment text  
      • Fields inherited from interface java.text.CharacterIterator

        DONE
    • Field Detail

      • doc

        private final javax.swing.text.Document doc
      • text

        private final javax.swing.text.Segment text
      • docPos

        private int docPos
        Position of iterator in document.
      • segmentEnd

        private int segmentEnd
        Index of end of current segment in document.
    • Constructor Detail

      • DocumentCharacterIterator

        DocumentCharacterIterator​(javax.swing.text.Document doc)
    • Method Detail

      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface java.text.CharacterIterator
        Overrides:
        clone in class java.lang.Object
      • current

        public char current()
        Specified by:
        current in interface java.text.CharacterIterator
      • first

        public char first()
        Specified by:
        first in interface java.text.CharacterIterator
      • getBeginIndex

        public int getBeginIndex()
        Specified by:
        getBeginIndex in interface java.text.CharacterIterator
      • getEndIndex

        public int getEndIndex()
        Specified by:
        getEndIndex in interface java.text.CharacterIterator
      • getIndex

        public int getIndex()
        Specified by:
        getIndex in interface java.text.CharacterIterator
      • last

        public char last()
        Specified by:
        last in interface java.text.CharacterIterator
      • next

        public char next()
        Increments the iterator's index by one and returns the character at the new index.
        Specified by:
        next in interface java.text.CharacterIterator
        Returns:
        the character at the new position, or DONE if the new position is off the end
      • previous

        public char previous()
        Specified by:
        previous in interface java.text.CharacterIterator
      • setIndex

        public char setIndex​(int position)
        Specified by:
        setIndex in interface java.text.CharacterIterator