Package org.biojava.utils.bytecode
Class InstructionVector
java.lang.Object
org.biojava.utils.bytecode.InstructionVector
- All Implemented Interfaces:
CodeGenerator
A list of Instructions and/or other CodeGenerator objects.
- Author:
- Thomas Down, Matthew Pocock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int pos, CodeGenerator g) voidadd(CodeGenerator g) generatorAt(int pos) voidremove(int pos) intsize()intReturn the change in the stack dept this generator will cause.intReturn the total depth of the stack required by this CodeGenerator.voidwriteCode(CodeContext ctx) Write the byte or bytes for this CodeGenerator to a CodeContext.
-
Constructor Details
-
InstructionVector
public InstructionVector()
-
-
Method Details
-
add
-
size
public int size() -
add
-
remove
public void remove(int pos) -
generatorAt
-
getStartLabel
-
getEndLabel
-
writeCode
Description copied from interface:CodeGeneratorWrite the byte or bytes for this CodeGenerator to a CodeContext.- Specified by:
writeCodein interfaceCodeGenerator- Parameters:
ctx- a CodeContext to write to- Throws:
CodeException- if there was some failure in writing to the context
-
stackDepth
public int stackDepth()Description copied from interface:CodeGeneratorReturn the total depth of the stack required by this CodeGenerator.For single byte-code instructions, this will be the same as stackDelta() if stackDelta() is positive, zero otherwise. For a compound instruction, this will be the maximum stack depth required to execute all sub-instructions.
- Specified by:
stackDepthin interfaceCodeGenerator- Returns:
- the stack depth needed
-
stackDelta
public int stackDelta()Description copied from interface:CodeGeneratorReturn the change in the stack dept this generator will cause.In the case of an instruction that adds items to the stack, stackDelta will be positive. For instructions that removes items from the stack, this will be negative.
- Specified by:
stackDeltain interfaceCodeGenerator- Returns:
- the change between stack depth before and after execution of this code
-