From f68781603c7c77ac62d90c224e171c31064b50a6 Mon Sep 17 00:00:00 2001 From: j-james Date: Sun, 27 Nov 2022 03:33:28 -0800 Subject: Refactor Node into html package --- src/main/model/html/ElementNode.java | 2 -- src/main/model/html/HtmlParser.java | 1 - src/main/model/html/Node.java | 14 ++++++++++++++ src/main/model/html/TextNode.java | 1 - src/main/model/util/Node.java | 14 -------------- src/main/ui/BrowserApp.java | 2 +- src/main/ui/BrowserCanvas.java | 2 +- 7 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 src/main/model/html/Node.java delete mode 100644 src/main/model/util/Node.java (limited to 'src/main') diff --git a/src/main/model/html/ElementNode.java b/src/main/model/html/ElementNode.java index 5ff4a0f..ef241e4 100644 --- a/src/main/model/html/ElementNode.java +++ b/src/main/model/html/ElementNode.java @@ -1,12 +1,10 @@ package model.html; -import model.util.Node; import org.javatuples.Pair; import org.json.JSONObject; import persistance.JsonAble; import java.util.ArrayList; -import java.util.Optional; /** * This ElementNode class represents an HTML tag and nested tags. diff --git a/src/main/model/html/HtmlParser.java b/src/main/model/html/HtmlParser.java index f0829f4..e1ebaa1 100644 --- a/src/main/model/html/HtmlParser.java +++ b/src/main/model/html/HtmlParser.java @@ -2,7 +2,6 @@ package model.html; import java.util.*; -import model.util.Node; import org.javatuples.*; import org.json.JSONObject; import persistance.JsonAble; diff --git a/src/main/model/html/Node.java b/src/main/model/html/Node.java new file mode 100644 index 0000000..3284b3c --- /dev/null +++ b/src/main/model/html/Node.java @@ -0,0 +1,14 @@ +package model.html; + +import org.json.JSONObject; + +/** + * This Node represents an abstract relationship between ElementNode and TextNode. + * It's extremely helpful / necessary for Lists of arbitrary ElementNodes/TextNodes. + */ +public interface Node { + // Return a representation of the Node. Useful for debugging. + public String getData(); + + public JSONObject serialize(); +} diff --git a/src/main/model/html/TextNode.java b/src/main/model/html/TextNode.java index 2e89326..82ae245 100644 --- a/src/main/model/html/TextNode.java +++ b/src/main/model/html/TextNode.java @@ -1,6 +1,5 @@ package model.html; -import model.util.Node; import org.json.JSONObject; import persistance.JsonAble; diff --git a/src/main/model/util/Node.java b/src/main/model/util/Node.java deleted file mode 100644 index a6fedaf..0000000 --- a/src/main/model/util/Node.java +++ /dev/null @@ -1,14 +0,0 @@ -package model.util; - -import org.json.JSONObject; - -/** - * This Node represents an abstract relationship between ElementNode and TextNode. - * It's extremely helpful / necessary for Lists of arbitrary ElementNodes/TextNodes. - */ -public interface Node { - // Return a representation of the Node. Useful for debugging. - public String getData(); - - public JSONObject serialize(); -} diff --git a/src/main/ui/BrowserApp.java b/src/main/ui/BrowserApp.java index 194f9e1..5e73144 100644 --- a/src/main/ui/BrowserApp.java +++ b/src/main/ui/BrowserApp.java @@ -3,7 +3,7 @@ package ui; import model.html.ElementNode; import model.html.HtmlParser; import model.html.TextNode; -import model.util.Node; +import model.html.Node; import org.json.JSONArray; import org.json.JSONObject; import persistance.JsonUtils; diff --git a/src/main/ui/BrowserCanvas.java b/src/main/ui/BrowserCanvas.java index 86ccd58..6fea735 100644 --- a/src/main/ui/BrowserCanvas.java +++ b/src/main/ui/BrowserCanvas.java @@ -2,7 +2,7 @@ package ui; import model.html.ElementNode; import model.html.TextNode; -import model.util.Node; +import model.html.Node; import javax.swing.*; import java.awt.*; -- cgit v1.2.3-70-g09d2