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 Details

    • addValue

      public void addValue​(String newValue)
      Adds a new value to this node and updates the document.
      Parameters:
      newValue - The new value.
    • removeValue

      public void removeValue​(String value)
      Removes the specified value from this node. If the value is not a value of this node, an IllegalArgumentException will be thrown. Otherwise, the document this node is in will be updated.
      Parameters:
      value - The value to be removed.
    • removeChild

      public void removeChild​(Node child)
      Removes the specified child from this node. If the node is not a child of this node, an IllegalArgumentException will be thrown. Otherwise, the document this node is in will be updated.
      Parameters:
      child - The child to be removed.
    • removeChildrenByName

      public void removeChildrenByName​(String name)
      Removes all children of this node with the specified name.
      Parameters:
      name - The name of the children to be removed.
    • getName

      public String getName()
      Returns this node's name.
      Returns:
      This node's name.
    • getParent

      public Node getParent()
      Returns this node's parent.
      Returns:
      This node's parent.
    • getChildren

      public List<Node> getChildren()
      Returns this node's children.
      Returns:
      This node's children.
    • getChildrenByName

      public List<Node> getChildrenByName​(String name)
      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

      public List<String> getValues()
      Returns this node's values.
      Returns:
      This node's values.