Package miniml
Class Node
java.lang.Object
miniml.Node
public class Node extends Object
Represents a node in a MiniML document.
A node is a container, containing values and other nodes.
- See Also:
Document
-
Method Summary
Modifier and Type Method Description voidaddValue(String newValue)Adds a new value to this node and updates the document.List<Node>getChildren()Returns this node's children.List<Node>getChildrenByName(String name)Returns all children of this node with the same name as the given one.StringgetName()Returns this node's name.NodegetParent()Returns this node's parent.List<String>getValues()Returns this node's values.voidremoveChild(Node child)Removes the specified child from this node.voidremoveChildrenByName(String name)Removes all children of this node with the specified name.voidremoveValue(String value)Removes the specified value from this node.
-
Method Details
-
addValue
Adds a new value to this node and updates the document.- Parameters:
newValue- The new value.
-
removeValue
Removes the specified value from this node. If the value is not a value of this node, anIllegalArgumentExceptionwill be thrown. Otherwise, the document this node is in will be updated.- Parameters:
value- The value to be removed.
-
removeChild
Removes the specified child from this node. If the node is not a child of this node, anIllegalArgumentExceptionwill be thrown. Otherwise, the document this node is in will be updated.- Parameters:
child- The child to be removed.
-
removeChildrenByName
Removes all children of this node with the specified name.- Parameters:
name- The name of the children to be removed.
-
getName
Returns this node's name.- Returns:
- This node's name.
-
getParent
Returns this node's parent.- Returns:
- This node's parent.
-
getChildren
Returns this node's children.- Returns:
- This node's children.
-
getChildrenByName
Returns all children of this node with the same name as the given one.- Parameters:
name- The name of the children.- Returns:
- All children with the given name.
-
getValues
Returns this node's values.- Returns:
- This node's values.
-