org.eclipse.xtext.ui.editor.model
Class DocumentCharacterIterator

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.model.DocumentCharacterIterator
All Implemented Interfaces:
java.lang.CharSequence, java.lang.Cloneable, java.text.CharacterIterator

public class DocumentCharacterIterator
extends java.lang.Object
implements java.text.CharacterIterator, java.lang.CharSequence

Copied from org.eclipse.jdt.internal.ui.text.DocumentCharacterIterator.

See Also:
DocumentCharacterIterator

Field Summary
 
Fields inherited from interface java.text.CharacterIterator
DONE
 
Constructor Summary
DocumentCharacterIterator(org.eclipse.jface.text.IDocument document)
          Creates an iterator for the entire document.
DocumentCharacterIterator(org.eclipse.jface.text.IDocument document, int first)
          Creates an iterator, starting at offset first.
DocumentCharacterIterator(org.eclipse.jface.text.IDocument document, int first, int last)
          Creates an iterator for the document contents from first (inclusive) to last (exclusive).
 
Method Summary
 char charAt(int index)
           Note that, if the document is modified concurrently, this method may return CharacterIterator.DONE if a BadLocationException was thrown when accessing the backing document.
 java.lang.Object clone()
           
 char current()
           
 char first()
           
 int getBeginIndex()
           
 int getEndIndex()
           
 int getIndex()
           
 char last()
           
 int length()
           
 char next()
           
 char previous()
           
 char setIndex(int position)
           
 java.lang.CharSequence subSequence(int start, int end)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.CharSequence
toString
 

Constructor Detail

DocumentCharacterIterator

public DocumentCharacterIterator(org.eclipse.jface.text.IDocument document)
                          throws org.eclipse.jface.text.BadLocationException
Creates an iterator for the entire document.

Parameters:
document - the document backing this iterator
Throws:
org.eclipse.jface.text.BadLocationException - if the indices are out of bounds

DocumentCharacterIterator

public DocumentCharacterIterator(org.eclipse.jface.text.IDocument document,
                                 int first)
                          throws org.eclipse.jface.text.BadLocationException
Creates an iterator, starting at offset first.

Parameters:
document - the document backing this iterator
first - the first character to consider
Throws:
org.eclipse.jface.text.BadLocationException - if the indices are out of bounds

DocumentCharacterIterator

public DocumentCharacterIterator(org.eclipse.jface.text.IDocument document,
                                 int first,
                                 int last)
                          throws org.eclipse.jface.text.BadLocationException
Creates an iterator for the document contents from first (inclusive) to last (exclusive).

Parameters:
document - the document backing this iterator
first - the first character to consider
last - the last character index to consider
Throws:
org.eclipse.jface.text.BadLocationException - if the indices are out of bounds
Method Detail

first

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

last

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

current

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

next

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

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

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

clone

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

length

public int length()
Specified by:
length in interface java.lang.CharSequence

charAt

public char charAt(int index)

Note that, if the document is modified concurrently, this method may return CharacterIterator.DONE if a BadLocationException was thrown when accessing the backing document.

Specified by:
charAt in interface java.lang.CharSequence
Parameters:
index -
Returns:

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Specified by:
subSequence in interface java.lang.CharSequence