org.scijava.sjep
Class SyntaxTree

java.lang.Object
  extended by org.scijava.sjep.SyntaxTree
All Implemented Interfaces:
Iterable<SyntaxTree>

public class SyntaxTree
extends Object
implements Iterable<SyntaxTree>

A syntax tree corresponding to an expression.

Author:
Curtis Rueden

Constructor Summary
SyntaxTree(LinkedList<Object> tokens)
          Creates a syntax tree built from the given postfix token queue.
 
Method Summary
 SyntaxTree child(int index)
           
 int count()
           
 Iterator<SyntaxTree> iterator()
           
 LinkedList<Object> postfix()
          Converts the syntax tree into a token queue in postfix order.
 Object token()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SyntaxTree

public SyntaxTree(LinkedList<Object> tokens)
Creates a syntax tree built from the given postfix token queue. This process will consume the entire queue.

Parameters:
tokens - The token queue, in postfix order.
Method Detail

token

public Object token()

child

public SyntaxTree child(int index)

count

public int count()

postfix

public LinkedList<Object> postfix()
Converts the syntax tree into a token queue in postfix order.


toString

public String toString()
Overrides:
toString in class Object

iterator

public Iterator<SyntaxTree> iterator()
Specified by:
iterator in interface Iterable<SyntaxTree>


Copyright © 2015 SciJava. All rights reserved.