public class ReprntConst extends java.lang.Object implements Instruction
REPRNT( CONST )
Modifier and Type | Field and Description |
---|---|
protected @NotNull java.lang.String |
constant
The constant to be printed.
|
protected @Nullable Tree |
tree
The tree from where this instruction was declared.
|
Constructor and Description |
---|
ReprntConst(@NotNull java.lang.String constant)
Construct a new instruction that prints the given
constant to the console
when executed. |
ReprntConst(@NotNull Tree tree)
Construct a new instruction that prints the content of the given
tree to
the console when executed. |
ReprntConst(@NotNull Tree tree,
@NotNull java.lang.String constant)
Construct a new instruction that prints the given
constant to the console
when executed. |
Modifier and Type | Method and Description |
---|---|
void |
exec(@NotNull Environment environment,
@NotNull Memory memory)
Execute this instruction with the given
environment and memory . |
@Nullable Tree |
getTree()
Return the tree from where this instruction was declared.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, create
@NotNull protected final @NotNull java.lang.String constant
@Nullable protected final @Nullable Tree tree
public ReprntConst(@NotNull @NotNull Tree tree)
tree
to
the console when executed.tree
- the tree of the constructed instruction.java.lang.NullPointerException
- if the given tree
is null.public ReprntConst(@NotNull @NotNull java.lang.String constant)
constant
to the console
when executed.constant
- the constant to be printed.java.lang.NullPointerException
- if the given constant
is null.public ReprntConst(@NotNull @NotNull Tree tree, @NotNull @NotNull java.lang.String constant)
constant
to the console
when executed.tree
- the tree of the constructed instruction.constant
- the constant to be printed.java.lang.NullPointerException
- if the given tree
or constant
is
null.public void exec(@NotNull @NotNull Environment environment, @NotNull @NotNull Memory memory)
Instruction
environment
and memory
.exec
in interface Instruction
environment
- the environment this instruction is executed in.memory
- the memory holding the variables for this instruction to depend
on.@Nullable public @Nullable Tree getTree()
Instruction
getTree
in interface Instruction