Module syntaxnbt

Class PathNode

java.lang.Object
at.syntaxerror.syntaxnbt.path.PathNode
Direct Known Subclasses:
PathNodeCompound, PathNodeIndex, PathNodeList, PathNodeListTag, PathNodeNamed, PathNodeRoot, PathNodeSubList

public abstract class PathNode extends Object
The base class for all NBT path nodes
Author:
SyntaxError404
  • Constructor Details

    • PathNode

      public PathNode()
  • Method Details

    • setNext

      public void setNext(PathNode next)
      Sets the next node in the path sequence. Must not be a PathNodeRoot
      Parameters:
      next - the next node
    • traverseSelf

      protected abstract List<Tag<?>> traverseSelf(Tag<?> tag)
      Traverse through the tag's tree structure and return the matching tags. This does not respect the next node
      Parameters:
      tag - tag to traverse through
      Returns:
      the matching tags
    • traverse

      public final List<Tag<?>> traverse(Tag<?> tag)
      Traverse recursively through the tag's tree structure and return the matching tags
      Parameters:
      tag - tag to traverse through
      Returns:
      the matching tags
    • traverseAll

      public final List<Tag<?>> traverseAll(List<Tag<?>> tags)
      Traverse recursively through the tree structures of all tags and return the matching tags
      Parameters:
      tags - tags to traverse through
      Returns:
      the matching tags
    • getNamed

      protected Tag<?> getNamed(String name, Tag<?> tag)
      Returns the tag with the specified name in a compound, if present
      Parameters:
      name - name of the element
      tag - a compound tag
      Returns:
      the named tag
    • stringify

      protected abstract String stringify()
      Stringifies only this node, without respecting the next node
      Returns:
      the string representation of this node
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNext

      public PathNode getNext()
      Returns the next node in the path sequence
      Returns:
      the next node in the path sequence