diff --git a/src/main/resources/patchfiles/SourcePosition.txt b/src/main/resources/patchfiles/SourcePosition.txt index ef6cd9cc3b3f05cb52fc05578b516a043599ef54..44291d26a5f2edfcf16491c9a8908117aab8219b 100644 --- a/src/main/resources/patchfiles/SourcePosition.txt +++ b/src/main/resources/patchfiles/SourcePosition.txt @@ -6,7 +6,7 @@ package de.hhu.stups.sablecc.patch; -public class SourcePosition { +public class SourcePosition implements Comparable<SourcePosition> { private final int line; @@ -24,4 +24,11 @@ public class SourcePosition { public int getPos() { return pos; } + + public int compareTo(SourcePosition that) { + if (that.line < line) return 1; + if (that.line > line) return -1; + return pos-that.pos; + } + }