aboutsummaryrefslogtreecommitdiff
path: root/src/main/model/html/ElementNode.java
diff options
context:
space:
mode:
authorj-james2022-10-17 13:54:35 +0000
committerj-james2022-10-17 13:54:35 +0000
commitbfa72127cf120f0e98410b45a043b95ad522b729 (patch)
tree877f2a3e38d2a65213794fa0877c84e434c9611b /src/main/model/html/ElementNode.java
parent453372247c8c173c16fa2234b9645bf7a542ed8d (diff)
Sweeping refactor to check CheckStyle boxes
Diffstat (limited to 'src/main/model/html/ElementNode.java')
-rw-r--r--src/main/model/html/ElementNode.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/main/model/html/ElementNode.java b/src/main/model/html/ElementNode.java
index 1d427e8..a1ad90c 100644
--- a/src/main/model/html/ElementNode.java
+++ b/src/main/model/html/ElementNode.java
@@ -12,28 +12,42 @@ public class ElementNode implements Node {
private ArrayList<Node> children;
- public String getTag() {
- return this.tag;
- }
-
- public ArrayList<Node> getChildren() {
- return this.children;
- }
-
+ /**
+ * EFFECTS: Constructs a new ElementNode from the arguments provided.
+ * MODIFIES: this
+ */
public ElementNode(String tag, ArrayList<Pair<String, String>> attributes, ArrayList<Node> children) {
this.tag = tag;
this.attributes = attributes;
this.children = children;
}
+ /**
+ * Overloads the constructor for ease of use. We often don't provide children, at first.
+ * EFFECTS: Constructs a new ElementNode from the arguments provided.
+ * MODIFIES: this
+ */
public ElementNode(String tag, ArrayList<Pair<String, String>> attributes) {
this(tag, attributes, new ArrayList<Node>());
}
+ /**
+ * EFFECTS: Adds a child to the children ArrayList.
+ * MODIFIES: this
+ */
public void addChild(Node child) {
this.children.add(child);
}
+ public String getTag() {
+ return this.tag;
+ }
+
+ public ArrayList<Node> getChildren() {
+ return this.children;
+ }
+
+ // We implement this method for easy debugging.
public String getData() {
return getTag();
}