Index
All Classes and Interfaces|All Packages|Serialized Form
A
- accept(Deque<SyntaxNode>) - Method in class com.maroontress.intexpr.impl.Constant
-
Interacts with the specified stack of the
SyntaxNode
object to build aSyntaxTree
object. - accept(Deque<SyntaxNode>) - Method in interface com.maroontress.intexpr.impl.Instruction
-
Interacts with the specified stack of the
SyntaxNode
object to build aSyntaxTree
object. - accept(Deque<SyntaxNode>) - Method in class com.maroontress.intexpr.impl.Operator
-
Interacts with the specified stack of the
SyntaxNode
object to build aSyntaxTree
object. - accept(Deque<SyntaxNode>) - Method in class com.maroontress.intexpr.impl.OperatorSpec
- ADD - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Addition.
- AND - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Bitwise AND.
- apply(int) - Method in interface com.maroontress.intexpr.impl.IntUnaryOperation
-
Returns the value operated with the specified operand.
- apply(int[], int) - Method in class com.maroontress.intexpr.impl.Constant
-
Interacts with the specified stack of an integer.
- apply(int[], int) - Method in interface com.maroontress.intexpr.impl.Instruction
-
Interacts with the specified stack of an integer.
- apply(int[], int) - Method in class com.maroontress.intexpr.impl.Operator
-
Interacts with the specified stack of an integer.
- apply(int, int) - Method in interface com.maroontress.intexpr.impl.IntBinaryOperation
-
Returns the value operated with the specified operands.
- apply(Opcode) - Method in enum class com.maroontress.intexpr.impl.OperatorType
B
- BINARY - Enum constant in enum class com.maroontress.intexpr.impl.OperatorType
-
Represents binary operators.
- BinaryOperatorNode - Class in com.maroontress.intexpr.syntaxtree
-
The syntax node representing a binary operator.
- BinaryOperatorNode(Opcode, SyntaxNode, SyntaxNode) - Constructor for class com.maroontress.intexpr.syntaxtree.BinaryOperatorNode
-
Creates a new instance.
C
- com.maroontress.intexpr - module com.maroontress.intexpr
-
This module provides the implementation that evaluates an integer expression and returns the result.
- com.maroontress.intexpr - package com.maroontress.intexpr
-
This package provides an API to evaluate integer expressions.
- com.maroontress.intexpr.impl - package com.maroontress.intexpr.impl
-
This package provides the implementation that must not be exported outside the module.
- com.maroontress.intexpr.syntaxtree - package com.maroontress.intexpr.syntaxtree
-
This package provides the facility to visualize the syntax tree of the instructions in reverse Polish notation.
- comparePrecedence(Operator) - Method in interface com.maroontress.intexpr.impl.PendedOperator
-
Compares the precedences of this and the specified operator.
- Compiler - Class in com.maroontress.intexpr.impl
-
This class provides a tiny compiler that translates code written in the little language into
Instruction
s that theInterpreter
class can execute. - CONST - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Constant (immediate value).
- Constant - Class in com.maroontress.intexpr.impl
-
This class provides the instruction that places an integer constant (as an operand) to a stack.
- Constant(Token) - Constructor for class com.maroontress.intexpr.impl.Constant
-
Creates a new instance.
D
- DIV - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Division.
- DivideByZeroException - Exception in com.maroontress.intexpr.impl
-
The exception that the
Interpreter
throws when there is an attempt to divide an integer value by zero. - DivideByZeroException() - Constructor for exception com.maroontress.intexpr.impl.DivideByZeroException
E
- eval(String) - Static method in class com.maroontress.intexpr.IntExpr
-
Evaluates the specified string representing an expression and returns the evaluated value.
- Executable - Interface in com.maroontress.intexpr.impl
-
The code that each operator executes.
- execute(int[], int, Token) - Method in interface com.maroontress.intexpr.impl.Executable
-
Interacts with the specified stack and returns the new offset of the stack.
G
- getCode() - Method in class com.maroontress.intexpr.impl.OperatorSpec
-
Returns the executable code associated with this.
- getPrecedence() - Method in class com.maroontress.intexpr.impl.OperatorSpec
-
Returns the precedence of the operator.
- getSpec() - Method in class com.maroontress.intexpr.impl.Operator
-
Returns the
OperatorSpec
object of this operator. - getToken() - Method in interface com.maroontress.intexpr.impl.PendedOperator
-
Returns the token if this is a left parenthesis or throws
IllegalStateException
otherwise.
I
- Instruction - Interface in com.maroontress.intexpr.impl
-
The instruction that the
Interpreter
runs. - IntBinaryOperation - Interface in com.maroontress.intexpr.impl
-
A function representing operation with a binary operator.
- IntConstantNode - Class in com.maroontress.intexpr.syntaxtree
-
The syntax node representing an operand and an integer constant.
- IntConstantNode(int) - Constructor for class com.maroontress.intexpr.syntaxtree.IntConstantNode
-
Creates a new instance.
- Interpreter - Class in com.maroontress.intexpr.impl
-
A tiny interpreter that is an implementation of a stack machine, retrieves instructions from an iterator, and executes them.
- IntExpr - Class in com.maroontress.intexpr
-
A utility class to evaluate
int
expressions. - IntUnaryOperation - Interface in com.maroontress.intexpr.impl
-
A function representing operation with a unary operator.
L
- LAND - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Logical AND.
- LEQ - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Equal to.
- LGE - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Greater than or equal to.
- LGT - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Greater than.
- LLE - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Less than or equal to.
- LLT - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Less than.
- LNE - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Not equal to.
- LNOT - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Logical negation.
- LOR - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Logical OR.
M
- Messages - Class in com.maroontress.intexpr.impl
-
Provides messages for exceptions that
Compiler
andInterpreter
throw. - MOD - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Modulo.
- MUL - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Multiplication.
N
- NEG - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Negation.
- newLeftParen(Token) - Static method in interface com.maroontress.intexpr.impl.PendedOperator
-
Returns a new
PendedOperator
object that represents a left parenthesis. - NOT - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Bitwise NOT.
O
- of(Token, OperatorType) - Static method in class com.maroontress.intexpr.impl.Operator
-
Creates a new
Operator
object corresponding to the specified token andOperatorType
. - of(Token, String) - Static method in class com.maroontress.intexpr.impl.Messages
-
Returns a new message for the exception.
- of(Operator) - Static method in interface com.maroontress.intexpr.impl.PendedOperator
-
Returns a new
PendedOperator
object that represents the specified operator. - Opcode - Enum Class in com.maroontress.intexpr.impl
-
Provides constants of opcodes to visualize the syntax tree.
- Operation - Interface in com.maroontress.intexpr.impl
-
This interface provides the factory of an
Executable
object. - Operations - Class in com.maroontress.intexpr.impl
-
This class provides the utility methods for operations.
- Operator - Class in com.maroontress.intexpr.impl
-
The instruction that pops the operand(s) from the stack, executes the function with the operand(s), and pushes the return value to the stack.
- OperatorSpec - Class in com.maroontress.intexpr.impl
-
This class provides the class objects of operators.
- OperatorType - Enum Class in com.maroontress.intexpr.impl
-
This class represents the types of operators.
- OR - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Bitwise OR.
- OverflowException - Exception in com.maroontress.intexpr.impl
-
The exception that the
Interpreter
throws when an arithmetic operation results in an overflow. - OverflowException() - Constructor for exception com.maroontress.intexpr.impl.OverflowException
P
- PendedOperator - Interface in com.maroontress.intexpr.impl
-
This interface represents the operator wrapper temporally created while the
Compiler
creates the list ofInstruction
objects in Reverse Polish notation. - perform(Token, IntSupplier) - Static method in class com.maroontress.intexpr.impl.Operations
-
Performs an operation.
- POS - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Positive (NOP).
Q
- query(String, OperatorType) - Static method in class com.maroontress.intexpr.impl.OperatorSpec
-
Returns the
OperatorSpec
object corresponding to the specified symbol and operator type.
R
- run(int, Iterable<Instruction>) - Static method in class com.maroontress.intexpr.impl.Interpreter
-
Executes the instructions retrieved from the specified iterator with the stack that has the specified size and returns the result value.
S
- SHL - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Bitwise left shift.
- SHR - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Bitwise right shift.
- SUB - Enum constant in enum class com.maroontress.intexpr.impl.Opcode
-
Subtraction.
- SyntaxNode - Interface in com.maroontress.intexpr.syntaxtree
-
The node of
SyntaxTree
. - SyntaxTree - Class in com.maroontress.intexpr.impl
-
This class represents the tree of
SyntaxNode
to visualize instructions in Reverse Polish notation. - SyntaxTree(Iterable<Instruction>) - Constructor for class com.maroontress.intexpr.impl.SyntaxTree
-
Creates a new instance.
T
- toExecutable() - Method in interface com.maroontress.intexpr.impl.IntBinaryOperation
-
Returns the
Executable
object. - toExecutable() - Method in interface com.maroontress.intexpr.impl.IntUnaryOperation
-
Returns the
Executable
object. - toExecutable() - Method in interface com.maroontress.intexpr.impl.Operation
-
Returns the
Executable
object. - toOperator() - Method in interface com.maroontress.intexpr.impl.PendedOperator
-
Returns the operator that this wraps if this is not a left parenthesis, otherwise
Optional.empty()
. - toRpn(Reader) - Static method in class com.maroontress.intexpr.impl.Compiler
-
Creates a new list containing
Instruction
objects from the expression that the specified reader provides. - toString() - Method in class com.maroontress.intexpr.impl.Constant
- toString() - Method in class com.maroontress.intexpr.impl.Operator
- toString() - Method in class com.maroontress.intexpr.impl.OperatorSpec
- toString() - Method in class com.maroontress.intexpr.impl.SyntaxTree
- toString(String, String) - Method in class com.maroontress.intexpr.syntaxtree.BinaryOperatorNode
-
Returns the string visualizing the syntax tree.
- toString(String, String) - Method in class com.maroontress.intexpr.syntaxtree.IntConstantNode
-
Returns the string visualizing the syntax tree.
- toString(String, String) - Method in interface com.maroontress.intexpr.syntaxtree.SyntaxNode
-
Returns the string visualizing the syntax tree.
- toString(String, String) - Method in class com.maroontress.intexpr.syntaxtree.UnaryOperatorNode
-
Returns the string visualizing the syntax tree.
- toTree(String) - Static method in class com.maroontress.intexpr.IntExpr
-
Returns the string to visualize the syntax tree representing the expression in Reverse Polish notation, which is equivalent to the specified expression.
U
- UNARY - Enum constant in enum class com.maroontress.intexpr.impl.OperatorType
-
Represents unary operators.
- UnaryOperatorNode - Class in com.maroontress.intexpr.syntaxtree
-
The syntax node representing a unary operator.
- UnaryOperatorNode(Opcode, SyntaxNode) - Constructor for class com.maroontress.intexpr.syntaxtree.UnaryOperatorNode
-
Creates a new instance.
V
- valueOf(String) - Static method in enum class com.maroontress.intexpr.impl.Opcode
-
Returns the enum constant of this class with the specified name.
- valueOf(String) - Static method in enum class com.maroontress.intexpr.impl.OperatorType
-
Returns the enum constant of this class with the specified name.
- values() - Static method in enum class com.maroontress.intexpr.impl.Opcode
-
Returns an array containing the constants of this enum class, in the order they are declared.
- values() - Static method in enum class com.maroontress.intexpr.impl.OperatorType
-
Returns an array containing the constants of this enum class, in the order they are declared.
X
A B C D E G I L M N O P Q R S T U V XAll Classes and Interfaces|All Packages|Serialized Form