com.rabbitmq.jms.parse.ParseTree Maven / Gradle / Ivy
/* Copyright (c) 2013 Pivotal Software, Inc. All rights reserved. */
/**
* Parse trees capture a structured view of a parsed token stream.
* They encapsulate the result of a parse() operation.
*
*
*
*
* Traversal algorithms will assume that there are no loops in the tree (no child can be its own ancestor).
*
*/
package com.rabbitmq.jms.parse;
/**
* A non-empty tree of {@link Node}s which can be traversed.
*
* The tree is a {@link Node} and a(n array of) children (if there are no children this must be a zero-length array and must not be null
).
* Each child in the array is a {@link ParseTree ParseTree<Node>}.
*
* @param - the type of nodes in the tree, a {@link Node} is attached to the root of each subtree.
*/
public interface ParseTree {
/**
* @return the node at the root of the tree.
*/
Node getNode();
/**
* Convenience method to avoid creating children prematurely. Must be the same as getChildren().length
.
* @return the number of children of the root.
*/
int getNumberOfChildren();
/**
* Get the immediate children of the root of the tree.
* @return an array of children.
*/
ParseTree[] getChildren();
/**
* Get the nodes of the immediate children of the root of the tree.
* @return an array of {@link Node}s.
*/
Node[] getChildNodes();
}