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 -------------- 5 files changed, 14 insertions(+), 18 deletions(-) create mode 100644 src/main/model/html/Node.java delete mode 100644 src/main/model/util/Node.java (limited to 'src/main/model') 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(); -} -- cgit v1.2.3-70-g09d2