diff options
Diffstat (limited to 'src/main/model/html/ElementNode.java')
-rw-r--r-- | src/main/model/html/ElementNode.java | 30 |
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(); } |