Skip to content

Commit

Permalink
0.31
Browse files Browse the repository at this point in the history
0.31
  • Loading branch information
XenoAmess committed Dec 16, 2018
1 parent 30aa3b9 commit 3e58d39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/main/java/com/xenoamess/x8l/ContentNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@
import java.util.Map;

public class ContentNode extends TreeNode {
public List<TreeNode> children = null;
public Map<String, String> attributes = null;
public List<String> attributesKeyList = null;
public List<TreeNode> children = new ArrayList<TreeNode>();
public Map<String, String> attributes = new HashMap<String, String>();
public List<String> attributesKeyList = new ArrayList<String>();

public ContentNode(ContentNode parent) {
super(parent);
this.children = new ArrayList<TreeNode>();
this.attributes = new HashMap<String, String>();
this.attributesKeyList = new ArrayList<String>();
}

public ContentNode(ContentNode parent, int index) {
super(parent, index);
this.children = new ArrayList<TreeNode>();
this.attributes = new HashMap<String, String>();
this.attributesKeyList = new ArrayList<String>();
}

public void addAttribute(String key, String value) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/xenoamess/x8l/TreeNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ public TreeNode changeParent(ContentNode contentNode) {
return this;
}

public TreeNode changeParent(ContentNode contentNode, int index) {
public TreeNode changeParentAndRegister(ContentNode contentNode, int index) {
this.changeParent(contentNode);
this.parent.children.add(index, this);
return this;
}

public TreeNode changeParentAndRegister(ContentNode contentNode) {
return this.changeParentAndRegister(contentNode, this.parent.children.size());
}

public abstract void output(Writer writer);

public abstract void format(int space);
Expand Down

0 comments on commit 3e58d39

Please sign in to comment.