| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 68 | 2 | 5 | 0.969 | class_body_declarations[10] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 68 | 34 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/DocumentCharacterIterator.java |
| 2 | 67 | 25 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/SequenceCharacterIterator.java |
| ||||
private int fIndex = -1;
private final IDocument fDocument;
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 document.
*
* @param document the document backing this iterator
*/
public DocumentCharacterIterator(IDocument document) {
this(document, 0);
}
/**
* Creates an iterator, starting at offset <code>first</code>.
*
* @param document the document backing this iterator
* @param first the first character to consider
* @throws IllegalArgumentException if the indices are out of bounds
*/
public DocumentCharacterIterator(IDocument document, int first) throws IllegalArgumentException {
this(document, first, document.getLength());
}
/**
* Creates an iterator for the document contents from <code>first</code>
* (inclusive) to <code>last</code> (exclusive).
*
* @param document the document 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 DocumentCharacterIterator(IDocument document, int first, int last) throws IllegalArgumentException {
if (document == null)
throw new NullPointerException();
if (first < 0 || first > last)
throw new IllegalArgumentException();
if (last > document.getLength())
throw new IllegalArgumentException();
fDocument = document;
fFirst = first;
fLast = last;
fIndex = first;
invariant();
}
/*
* @see java.text.CharacterIterator#first()
*/
public char first() {
return setIndex(getBeginIndex());
}
/*
* @see java.text.CharacterIterator#last()
*/
public char last() {
if (fFirst == fLast)
return setIndex(getEndIndex());
else
return setIndex(getEndIndex() - 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
*/
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
*/
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
*/
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;
invariant();
}
/*
* @see java.text.CharacterIterator#first()
*/
public char first() {
return setIndex(getBeginIndex());
}
/*
* @see java.text.CharacterIterator#last()
*/
public char last() {
if (fFirst == fLast)
return setIndex(getEndIndex());
else
return setIndex(getEndIndex() - 1);
}
|
| |||
private int fIndex = -1;
private final [[#variable97f0b1a0]] [[#variable97f0b0e0]];
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 document.
*
* @param document the document backing this iterator
*/
/**
* Creates an iterator for the entire sequence.
*
* @param sequence the sequence backing this iterator
*/
public [[#variable564a99a0]]( [[#variable97f0b1a0]] [[#variable97f0afe0]]) {
this( [[#variable97f0afe0]], 0);
}
/**
* Creates an iterator, starting at offset <code>first</code>.
*
* @param document the document backing this iterator
* @param first the first character to consider
* @throws IllegalArgumentException if the indices are out of bounds
*/
/**
* 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
*/
public [[#variable564a99a0]]( [[#variable97f0b1a0]] [[#variable97f0afe0]], int first) throws IllegalArgumentException {
this( [[#variable97f0afe0]], first, [[#variable97f0afe0]]. [[#variable97f0afc0]]());
}
/**
* Creates an iterator for the document contents from <code>first</code>
* (inclusive) to <code>last</code> (exclusive).
*
* @param document the document 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
*/
/**
* 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
*/
public [[#variable564a99a0]]( [[#variable97f0b1a0]] [[#variable97f0afe0]], int first, int last) throws IllegalArgumentException {
if ( [[#variable97f0afe0]]== null)
throw new NullPointerException();
if (first < 0 || first > last)
throw new IllegalArgumentException();
if (last > [[#variable97f0afe0]]. [[#variable97f0afc0]]())
throw new IllegalArgumentException();
[[#variable97f0b0e0]]= [[#variable97f0afe0]];
fFirst = first;
fLast = last;
fIndex = first;
invariant();
}
/*
* @see java.text.CharacterIterator#first()
*/
public char first() {
return setIndex(getBeginIndex());
}
/*
* @see java.text.CharacterIterator#last()
*/
public char last() {
if (fFirst == fLast)
return setIndex(getEndIndex());
else
return setIndex(getEndIndex() - 1);
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#97f0b1a0]] | IDocument |
| 1 | 2 | [[#97f0b1a0]] | CharSequence |
| 2 | 1 | [[#97f0b0e0]] | fDocument |
| 2 | 2 | [[#97f0b0e0]] | fSequence |
| 3 | 1 | [[#564a99a0]] | DocumentCharacterIterator |
| 3 | 2 | [[#564a99a0]] | SequenceCharacterIterator |
| 4 | 1 | [[#97f0afe0]] | document |
| 4 | 2 | [[#97f0afe0]] | sequence |
| 5 | 1 | [[#97f0afc0]] | getLength |
| 5 | 2 | [[#97f0afc0]] | length |