org.eclipse.xtext.ui.editor.model
Class DocumentCharacterIterator
java.lang.Object
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
.
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). |
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 |
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 iteratorfirst
- 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 iteratorfirst
- the first character to considerlast
- the last character index to consider
- Throws:
org.eclipse.jface.text.BadLocationException
- if the indices are out of bounds
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