Merge branch 'simplifyRes' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into simplifyRes

This commit is contained in:
pl@gohorb.ba-horb.de 2020-04-13 16:23:09 +02:00
commit cdc6a3f2dd
2 changed files with 13 additions and 9 deletions

View File

@ -20,7 +20,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.7</version>
<version>4.8-1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>

View File

@ -23,10 +23,6 @@ public class TypeInsertPoint {
}
public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
int offset = additionalOffset.stream().filter((token ->
//token.point.getLine() != point.getLine() && token.point.getCharPositionInLine() <= point.getCharPositionInLine()))
token.point.getStartIndex() <= point.getStartIndex()))
.mapToInt((typeInsertPoint -> typeInsertPoint.insertString.length())).sum();
return new StringBuilder(intoSource).insert(point.getStartIndex()+extraOffset, insertString).toString();
}
@ -48,13 +44,21 @@ public class TypeInsertPoint {
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return this == obj;
/*
if(!(obj instanceof TypeInsertPoint)) {
return false;
}
else {
return ((TypeInsertPoint)obj).point.equals(this.point) &&
((TypeInsertPoint)obj).insertString.equals(this.insertString);
}
return
((TypeInsertPoint)obj).getPositionInCode() == this.getPositionInCode() &&
((TypeInsertPoint)obj).insertString.equals(this.insertString);
}
*/
}
public int hashCode() {
return getPositionInCode() * 11 * insertString.hashCode();
}
public Set<TypeInsertPoint> getAdditionalPoints() {
@ -62,7 +66,7 @@ public class TypeInsertPoint {
}
public String toString() {
return point.toString() + " " + insertString.toString();
return point.getLine() + ":" + point.getCharPositionInLine() + ":" + insertString;
}
public static final class TypeInsertPointPositionComparator implements Comparator<TypeInsertPoint> {