diff options
Diffstat (limited to 'src/main/model/html')
-rw-r--r-- | src/main/model/html/ElementNode.java | 9 | ||||
-rw-r--r-- | src/main/model/html/HtmlParser.java | 8 | ||||
-rw-r--r-- | src/main/model/html/Node.java | 5 | ||||
-rw-r--r-- | src/main/model/html/TextNode.java | 10 |
4 files changed, 3 insertions, 29 deletions
diff --git a/src/main/model/html/ElementNode.java b/src/main/model/html/ElementNode.java index ef241e4..6f0a556 100644 --- a/src/main/model/html/ElementNode.java +++ b/src/main/model/html/ElementNode.java @@ -1,15 +1,13 @@ package model.html; import org.javatuples.Pair; -import org.json.JSONObject; -import persistance.JsonAble; import java.util.ArrayList; /** * This ElementNode class represents an HTML tag and nested tags. */ -public class ElementNode implements Node, JsonAble { +public class ElementNode implements Node { private String tag; private ArrayList<Pair<String,String>> attributes; @@ -67,9 +65,4 @@ public class ElementNode implements Node, JsonAble { public String getData() { return getTag() + " " + getAttributes().toString(); } - - @Override - public JSONObject serialize() { - return new JSONObject(this); - } } diff --git a/src/main/model/html/HtmlParser.java b/src/main/model/html/HtmlParser.java index 5170205..e50f713 100644 --- a/src/main/model/html/HtmlParser.java +++ b/src/main/model/html/HtmlParser.java @@ -3,8 +3,6 @@ package model.html; import java.util.*; import org.javatuples.*; -import org.json.JSONObject; -import persistance.JsonAble; /** * This class represents the state of and implements an LL(1) HTML parser. @@ -19,7 +17,7 @@ import persistance.JsonAble; * SELF_CLOSING_TAG ::= 'img' | ... * (note that \forall T \in SELF_CLOSING_TAG, T \notin TAG) */ -public class HtmlParser implements JsonAble { +public class HtmlParser { /** * HTML is not nice to parse. We manage to get away with a relatively small number of parser states regardless. @@ -346,10 +344,6 @@ public class HtmlParser implements JsonAble { return false; } } - - public JSONObject serialize() { - return new JSONObject(this); - } } /* diff --git a/src/main/model/html/Node.java b/src/main/model/html/Node.java index 5c3ea41..9a846ee 100644 --- a/src/main/model/html/Node.java +++ b/src/main/model/html/Node.java @@ -1,7 +1,5 @@ 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. @@ -9,7 +7,4 @@ import org.json.JSONObject; public interface Node { // Return a representation of the Node. Useful for debugging. public String getData(); - - // EFFECTS: returns a serialized form of the data - public JSONObject serialize(); } diff --git a/src/main/model/html/TextNode.java b/src/main/model/html/TextNode.java index 82ae245..464180f 100644 --- a/src/main/model/html/TextNode.java +++ b/src/main/model/html/TextNode.java @@ -1,12 +1,9 @@ package model.html; -import org.json.JSONObject; -import persistance.JsonAble; - /** * This TextNode class represents raw text, with no nested tags. */ -public class TextNode implements Node, JsonAble { +public class TextNode implements Node { private String text = ""; /** @@ -25,9 +22,4 @@ public class TextNode implements Node, JsonAble { public String getData() { return getText(); } - - @Override - public JSONObject serialize() { - return new JSONObject(this); - } } |