Package org.scijava.parse
Class SyntaxTree
- java.lang.Object
-
- org.scijava.parse.SyntaxTree
-
- All Implemented Interfaces:
java.lang.Iterable<SyntaxTree>
public class SyntaxTree extends java.lang.Object implements java.lang.Iterable<SyntaxTree>
A syntax tree corresponding to an expression.- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description SyntaxTree(java.util.LinkedList<java.lang.Object> tokens)
Creates a syntax tree built from the given postfix token queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyntaxTree
child(int index)
int
count()
boolean
equals(java.lang.Object o)
int
hashCode()
java.util.Iterator<SyntaxTree>
iterator()
java.util.LinkedList<java.lang.Object>
postfix()
Converts the syntax tree into a token queue in postfix order.java.lang.Object
token()
java.lang.String
toString()
-
-
-
Constructor Detail
-
SyntaxTree
public SyntaxTree(java.util.LinkedList<java.lang.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 java.lang.Object token()
-
child
public SyntaxTree child(int index)
-
count
public int count()
-
postfix
public java.util.LinkedList<java.lang.Object> postfix()
Converts the syntax tree into a token queue in postfix order.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
iterator
public java.util.Iterator<SyntaxTree> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<SyntaxTree>
-
-