package model.html;
import model.util.Node;
import org.javatuples.Pair;
import java.util.ArrayList;
import java.util.Optional;
public class ElementNode implements Node {
private String tag;
private ArrayList> attributes;
private ArrayList children;
/**
* EFFECTS: Constructs a new ElementNode from the arguments provided.
* MODIFIES: this
*/
public ElementNode(String tag, ArrayList> attributes, ArrayList 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> attributes) {
this(tag, attributes, new ArrayList());
}
/**
* 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 getChildren() {
return this.children;
}
// We implement this method for easy debugging.
public String getData() {
return getTag();
}
}