diff options
Diffstat (limited to 'src/main/model/html/ElementNode.java')
-rw-r--r-- | src/main/model/html/ElementNode.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/model/html/ElementNode.java b/src/main/model/html/ElementNode.java index a1ad90c..98995d0 100644 --- a/src/main/model/html/ElementNode.java +++ b/src/main/model/html/ElementNode.java @@ -28,7 +28,16 @@ public class ElementNode implements Node { * MODIFIES: this */ public ElementNode(String tag, ArrayList<Pair<String, String>> attributes) { - this(tag, attributes, new ArrayList<Node>()); + this(tag, attributes, new ArrayList<>()); + } + + /** + * Overloads the constructor for ease of use. Should probably only be used for tests. + * EFFECTS: Constructs a new ElementNode from the arguments provided. + * MODIFIES: this + */ + public ElementNode(String tag) { + this(tag, new ArrayList<>(), new ArrayList<>()); } /** @@ -43,12 +52,16 @@ public class ElementNode implements Node { return this.tag; } + public ArrayList<Pair<String, String>> getAttributes() { + return this.attributes; + } + public ArrayList<Node> getChildren() { return this.children; } // We implement this method for easy debugging. public String getData() { - return getTag(); + return getTag() + " " + getAttributes().toString(); } } |