while (j < statements.size() && statements.get(j).getValue().equals(first.getValue())) {
j++;
}
+ filtered.add(statements.get(i));
if (i < j - 1) {
- Statement last = statements.get(j - 1);
- filtered.add(new Statement(first.getStartLine(), last.getEndLine(), first.getValue()));
- } else {
- filtered.add(statements.get(i));
+ filtered.add(statements.get(j - 1));
}
i = j;
}
while (j < fragments.size() && fragments.get(j).getValue().equals(first.getValue())) {
j++;
}
+ filtered.add(fragments.get(i));
if (i < j - 1) {
- TokensLine last = fragments.get(j - 1);
- filtered.add(new TokensLine(first.getStartUnit(), last.getEndUnit(), first.getStartLine(), last.getEndLine(), first.getValue()));
- } else {
- filtered.add(fragments.get(i));
+ filtered.add(fragments.get(j - 1));
}
i = j;
}
private final String value;
private final int startLine;
- private final int endLine;
private final int hashCode;
private final int startUnit;
public TokensLine(int startUnit, int endUnit, int startLine, String value) {
- this(startUnit, endUnit, startLine, startLine, value);
- }
-
- public TokensLine(int startUnit, int endUnit, int startLine, int endLine, String value) {
Preconditions.checkArgument(startLine > 0);
// TODO do we have requirements for length and hashcode ?
this.startLine = startLine;
- this.endLine = endLine;
this.value = value;
this.hashCode = value.hashCode();
return startLine;
}
+ /**
+ * Same as {@link #getStartLine()}
+ */
public int getEndLine() {
- return endLine;
+ return startLine;
}
public int getHashCode() {