@FunctionalInterface
public interface Instruction
extends java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
static @NotNull Instruction |
create(@NotNull Instruction instruction)
Wrap the given
instruction with another instruction delegates to the given
instruction when executed. |
static @NotNull Instruction |
create(@NotNull Tree tree,
@NotNull Instruction instruction)
Wrap the given
instruction with another instruction delegates to the given
instruction when executed and return the given tree when its getTree() is called. |
void |
exec(@NotNull Environment environment,
@NotNull Memory memory)
Execute this instruction with the given
environment and memory. |
default @Nullable Tree |
getTree()
Return the tree from where this instruction was declared.
|
@NotNull
@Contract(value="_->new",
pure=true)
static @NotNull Instruction create(@NotNull
@NotNull Instruction instruction)
instruction with another instruction delegates to the given
instruction when executed.instruction - the instruction to be delegated to by the returned instruction.instruction.java.lang.NullPointerException - if the given instruction is null.@NotNull
@Contract(value="_,_->new",
pure=true)
static @NotNull Instruction create(@NotNull
@NotNull Tree tree,
@NotNull
@NotNull Instruction instruction)
instruction with another instruction delegates to the given
instruction when executed and return the given tree when its getTree() is called.tree - the tree to be returned by the returned instruction.instruction - the instruction to be delegated to by the returned instruction.instruction and has
the given tree.java.lang.NullPointerException - if the given tree or instruction is
null.@Nullable @Contract(pure=true) default @Nullable Tree getTree()
@Contract(mutates="param1,param2")
void exec(@NotNull
@NotNull Environment environment,
@NotNull
@NotNull Memory memory)
environment and memory.environment - the environment this instruction is executed in.memory - the memory holding the variables for this instruction to depend
on.java.lang.NullPointerException - if the given environment or memory is
null.ExecutionException - if this instruction failed to be executed.