diff --git a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java index 3c8ab8717..0efb66e4b 100644 --- a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java +++ b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java @@ -23,10 +23,6 @@ public class TypeInsertPoint { } public String insert(String intoSource, List 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 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 {