private void invariant() {
        Assert.isTrue(index >= first);
        Assert.isTrue(index <= last);
    }
An <code>IDocument</code> based implementation of
<code>CharacterIterator</code> and <code>CharSequence</code>. Note that
the supplied document is not copied; if the document is modified during the
lifetime of a <code>DocumentCharacterIterator</code>, the methods
returning document content may not always return the same values. Also, if
accessing the document fails with a {@link BadLocationException}, any of
<code>CharacterIterator</code> methods as well as <code>charAt</code>may
return {@link CharacterIterator#DONE}.

@since 3.0
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLDocumentCharacterIterator.java