Package: org.codehaus.groovy.classgen

## [Java] Class BytecodeSequence

- org.codehaus.groovy.classgen.BytecodeSequence

-     public class BytecodeSequence
      extends Statement

  This class represents a sequence of BytecodeInstructions or ASTNodes. The evaluation is depending on the type of the visitor.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `BytecodeSequence(BytecodeInstruction instruction)` Creates a bytecode sequence containing a single bytecode instruction.
    `BytecodeSequence(List<?> instructions)` Creates a bytecode sequence containing multiple instructions or AST nodes.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public BytecodeInstruction` | `getBytecodeInstruction()` Returns the singular BytecodeInstruction.
    `` | `public List<?>` | `getInstructions()` Returns an immutable view of the instructions in this sequence.
    `` | `public void` | `visit(GroovyCodeVisitor visitor)` Delegates to the visit method used for this class.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Statement` | `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public BytecodeSequence(BytecodeInstruction instruction)

      Creates a bytecode sequence containing a single bytecode instruction.

      Parameters:
        `instruction` - the bytecode instruction to include

    - #### public BytecodeSequence(List<?> instructions)

      Creates a bytecode sequence containing multiple instructions or AST nodes.

      Parameters:
        `instructions` - the list of instructions or AST nodes

  - ### Method Detail

    - #### public BytecodeInstruction getBytecodeInstruction()

      Returns the singular BytecodeInstruction.

      Returns:
        `null` if instruction(s) is not a BytecodeInstruction

    - #### public List<?> getInstructions()

      Returns an immutable view of the instructions in this sequence.

      Returns:
        the list of instructions

    - #### public void visit(GroovyCodeVisitor visitor)

      Delegates to the visit method used for this class. If the visitor is a ClassGenerator, then ClassGenerator.visitBytecodeSequence is called with this instance. If the visitor is no ClassGenerator, then this method will call visit on each ASTNode element sorted by this class. If one element is a BytecodeInstruction, then it will be skipped as it is no ASTNode.

      See Also:
        ClassGenerator