From 82a78cb44ddb8d195faa67900ab398a349d951a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20L=C3=A4ufer?= Date: Mon, 22 Sep 2025 09:48:47 -0500 Subject: [PATCH 1/3] Update MainLeaky.java --- src/main/java/edu/luc/cs/consoleapp/MainLeaky.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java b/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java index 4dd6eee..624e9cf 100644 --- a/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java +++ b/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java @@ -39,7 +39,8 @@ public static void main(final String[] args) { } final var input = new Scanner(System.in).useDelimiter("(?U)[^\\p{Alpha}0-9']+"); - final var result = new LeakyQueue(lastNWords, input).process(); + final var coreLogic = new LeakyQueue(lastNWords, input); + final var result = coreLogic.process(); result.forEach( value -> { From 3e1db1508ce208869cbd909b23e91f26bb641c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20L=C3=A4ufer?= Date: Mon, 22 Sep 2025 09:56:08 -0500 Subject: [PATCH 2/3] Update MainLeaky.java --- src/main/java/edu/luc/cs/consoleapp/MainLeaky.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java b/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java index 624e9cf..45e8757 100644 --- a/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java +++ b/src/main/java/edu/luc/cs/consoleapp/MainLeaky.java @@ -56,6 +56,8 @@ public static void main(final String[] args) { * A sliding window queue that retains the last N elements. * This component is independent of the user interface and can be tested independently. * Nevertheless, it violates an important nonfunctional requirement: it leaks memory. + * In addition, it violates the functional requirement of + * interactively responding to each input. */ static class LeakyQueue { From 549657848827588e76b397b1e7e8d6684d56db99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20L=C3=A4ufer?= Date: Mon, 22 Sep 2025 15:43:45 +0000 Subject: [PATCH 3/3] added OutputToList source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Konstantin Läufer --- .../edu/luc/cs/consoleapp/OutputToList.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/java/edu/luc/cs/consoleapp/OutputToList.java diff --git a/src/test/java/edu/luc/cs/consoleapp/OutputToList.java b/src/test/java/edu/luc/cs/consoleapp/OutputToList.java new file mode 100644 index 0000000..b4259eb --- /dev/null +++ b/src/test/java/edu/luc/cs/consoleapp/OutputToList.java @@ -0,0 +1,17 @@ +package edu.luc.cs.consoleapp; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +class OutputToList implements OutputHandler { + + final List> result = new ArrayList<>(); + + @Override + public void accept(final Queue value) { + final var snapshot = new LinkedList<>(value); + result.add(snapshot); + } +} \ No newline at end of file