Package org.eolang.opeo.decompilation
Class OperandStack
- java.lang.Object
-
- org.eolang.opeo.decompilation.OperandStack
-
-
Constructor Summary
Constructors Constructor Description OperandStack()Default constructor.OperandStack(AstNode... nodes)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddup()Duplicate the higher value on the stack.Optional<AstNode>first()Pop one node from the stack or return empty.AstNodepop()Pop one node from the stack.List<AstNode>pop(int number)Pop N nodes from the stack.Stringpretty()Pretty representation of the stack.voidpush(AstNode node)Push one more node to the stack.
-
-
-
Constructor Detail
-
OperandStack
public OperandStack()
Default constructor.
-
OperandStack
public OperandStack(AstNode... nodes)
Constructor.- Parameters:
nodes- Initial stack nodes.
-
-
Method Detail
-
first
public Optional<AstNode> first()
Pop one node from the stack or return empty.- Returns:
- Optional node.
-
pop
public AstNode pop()
Pop one node from the stack.- Returns:
- Node.
-
pop
public List<AstNode> pop(int number)
Pop N nodes from the stack.- Parameters:
number- Number of nodes to pop.- Returns:
- Collection of nodes.
-
push
public void push(AstNode node)
Push one more node to the stack.- Parameters:
node- Node to add to the stack.
-
dup
public void dup()
Duplicate the higher value on the stack.
-
pretty
public String pretty()
Pretty representation of the stack.- Returns:
- Human-readable string that represents the stack state.
-
-