From 9a512732accf6869764fedc7c5d1abad57c6cb28 Mon Sep 17 00:00:00 2001 From: j-james Date: Tue, 18 Oct 2022 15:33:25 -0700 Subject: Pass checkstyle --- src/main/ui/BrowserApp.java | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/main/ui') diff --git a/src/main/ui/BrowserApp.java b/src/main/ui/BrowserApp.java index fa47f48..8a50ea4 100644 --- a/src/main/ui/BrowserApp.java +++ b/src/main/ui/BrowserApp.java @@ -33,22 +33,30 @@ public class BrowserApp { println(border); ArrayList rawHtml = new ArrayList<>(); rawHtml.add(file); - while (true) { - println("Page rendered. Input additional raw HTML if desired."); - rawHtml.add(input.next()); - println(border); - for (String s : rawHtml) { - parser = new HtmlParser(); - renderHtml(parser.parseHtml(s)); - } - println(border); - } + mainLoop(rawHtml, border, parser); } catch (Exception e) { println("Reading from the file failed with " + e.toString()); println("Please try again."); } } + + /** + * EFFECTS: Runs the main loop + */ + private void mainLoop(ArrayList rawHtml, String border, HtmlParser parser) { + while (true) { + println("Page rendered. Input additional raw HTML if desired."); + rawHtml.add(input.next()); + println(border); + for (String s : rawHtml) { + parser = new HtmlParser(); + renderHtml(parser.parseHtml(s)); + } + println(border); + } + } + /** * EFFECTS: Barebones HTML rendering. Iterates through a list of Nodes and their children and prints any text. */ -- cgit v1.2.3-70-g09d2