commit | 9b6b845b07d066faa20ccd8685fd3d5c143d36e6 | [log] [tgz] |
---|---|---|
author | Marc Kupietz <kupietz@ids-mannheim.de> | Tue Nov 08 13:44:54 2022 +0100 |
committer | Marc Kupietz <kupietz@ids-mannheim.de> | Tue Nov 08 15:04:17 2022 +0100 |
tree | ad3ebedbba580adf73e8a1ace312c57e6eb24935 | |
parent | 097f35a31e474b3aea6f33187ae9c0ecf8f422e2 [diff] |
Extend LinkedList<String> correctly Change-Id: Ic146186b53b2a2a68ebef69e112149a7d2355fba
diff --git a/src/main/java/org/ids_mannheim/PaddedSlidingWindowQueue.java b/src/main/java/org/ids_mannheim/PaddedSlidingWindowQueue.java index 7c141bd..68c4b87 100644 --- a/src/main/java/org/ids_mannheim/PaddedSlidingWindowQueue.java +++ b/src/main/java/org/ids_mannheim/PaddedSlidingWindowQueue.java
@@ -32,9 +32,10 @@ } @Override - public void add(String k) { + public boolean add(String k) { super.add(k); needsFlush = true; + return true; } @Override
diff --git a/src/main/java/org/ids_mannheim/SlidingWindowQueue.java b/src/main/java/org/ids_mannheim/SlidingWindowQueue.java index 32e0f60..39f0471 100644 --- a/src/main/java/org/ids_mannheim/SlidingWindowQueue.java +++ b/src/main/java/org/ids_mannheim/SlidingWindowQueue.java
@@ -2,7 +2,7 @@ import java.util.LinkedList; -public class SlidingWindowQueue extends LinkedList { +public class SlidingWindowQueue extends LinkedList<String> { final int maxSize; final Increaser flush; final boolean with_lemma_and_pos; @@ -14,12 +14,13 @@ this.with_lemma_and_pos = with_lemma_and_pos; } - public void add(String k) { - boolean r = super.add(k); + public boolean add(String k) { + super.add(k); if (size() == maxSize) { this.flush.accept(String.join("\t", this)); remove(0); } + return true; } public void reset(int fold) {