From 0861f74ce72e041f1d0bf31a0c2c104306d53c95 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 2 Apr 2020 22:20:31 +0200 Subject: [PATCH] Bug 171: Beim Typeinsert werden Marker jetzt richtig verschoben. --- .../typedeployment/TypeInsertPoint.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java index 3c8ab871..0efb66e4 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 {