X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SequenceCharacterIterator.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SequenceCharacterIterator.java
index 7613b77..33a9906 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SequenceCharacterIterator.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SequenceCharacterIterator.java
@@ -14,63 +14,76 @@ import java.text.CharacterIterator;
import org.eclipse.jface.text.Assert;
-
/**
- * A CharSequence
based implementation of CharacterIterator
.
+ * A CharSequence
based implementation of
+ * CharacterIterator
.
*
* @since 3.0
*/
public class SequenceCharacterIterator implements CharacterIterator {
- private int fIndex= -1;
+ private int fIndex = -1;
+
private final CharSequence fSequence;
+
private final int fFirst;
+
private final int fLast;
-
+
private void invariant() {
Assert.isTrue(fIndex >= fFirst);
Assert.isTrue(fIndex <= fLast);
}
-
+
/**
* Creates an iterator for the entire sequence.
*
- * @param sequence the sequence backing this iterator
+ * @param sequence
+ * the sequence backing this iterator
*/
public SequenceCharacterIterator(CharSequence sequence) {
this(sequence, 0);
}
-
+
/**
* Creates an iterator.
*
- * @param sequence the sequence backing this iterator
- * @param first the first character to consider
- * @throws IllegalArgumentException if the indices are out of bounds
+ * @param sequence
+ * the sequence backing this iterator
+ * @param first
+ * the first character to consider
+ * @throws IllegalArgumentException
+ * if the indices are out of bounds
*/
- public SequenceCharacterIterator(CharSequence sequence, int first) throws IllegalArgumentException {
+ public SequenceCharacterIterator(CharSequence sequence, int first)
+ throws IllegalArgumentException {
this(sequence, first, sequence.length());
}
/**
* Creates an iterator.
*
- * @param sequence the sequence backing this iterator
- * @param first the first character to consider
- * @param last the last character index to consider
- * @throws IllegalArgumentException if the indices are out of bounds
+ * @param sequence
+ * the sequence backing this iterator
+ * @param first
+ * the first character to consider
+ * @param last
+ * the last character index to consider
+ * @throws IllegalArgumentException
+ * if the indices are out of bounds
*/
- public SequenceCharacterIterator(CharSequence sequence, int first, int last) throws IllegalArgumentException {
+ public SequenceCharacterIterator(CharSequence sequence, int first, int last)
+ throws IllegalArgumentException {
if (sequence == null)
throw new NullPointerException();
if (first < 0 || first > last)
throw new IllegalArgumentException();
if (last > sequence.length())
throw new IllegalArgumentException();
- fSequence= sequence;
- fFirst= first;
- fLast= last;
- fIndex= first;
+ fSequence = sequence;
+ fFirst = first;
+ fLast = last;
+ fIndex = first;
invariant();
}
@@ -124,10 +137,10 @@ public class SequenceCharacterIterator implements CharacterIterator {
*/
public char setIndex(int position) {
if (position >= getBeginIndex() && position <= getEndIndex())
- fIndex= position;
+ fIndex = position;
else
throw new IllegalArgumentException();
-
+
invariant();
return current();
}