Package org.codehaus.groovy.classgen

# Class BytecodeSequence

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.stmt.Statement
org.codehaus.groovy.classgen.BytecodeSequence

All Implemented Interfaces:
  `NodeMetaDataHandler`

public class BytecodeSequence extends Statement
This class represents a sequence of `BytecodeInstruction`s or `ASTNode`s. The evaluation is depending on the type of the visitor.

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BytecodeInstruction`
  `getBytecodeInstruction()`
  Returns the singular BytecodeInstruction.
  `List<?>`
  `getInstructions()`
  Returns an immutable view of the instructions in this sequence.
  `void`
  `visit(GroovyCodeVisitor visitor)`
  Delegates to the visit method used for this class.

  ### Methods inherited from class org.codehaus.groovy.ast.stmt.Statement

  `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Constructor Details

  - ### BytecodeSequence

    public BytecodeSequence(BytecodeInstruction instruction)
    Creates a bytecode sequence containing a single bytecode instruction.
    Parameters:
      `instruction` - the bytecode instruction to include

  - ### BytecodeSequence

    public BytecodeSequence(List<?> instructions)
    Creates a bytecode sequence containing multiple instructions or AST nodes.
    Parameters:
      `instructions` - the list of instructions or AST nodes

- ## Method Details

  - ### getInstructions

    public List<?> getInstructions()
    Returns an immutable view of the instructions in this sequence.
    Returns:
      the list of instructions

  - ### getBytecodeInstruction

    public BytecodeInstruction getBytecodeInstruction()
    Returns the singular BytecodeInstruction.
    Returns:
      `null` if instruction(s) is not a BytecodeInstruction

  - ### visit

    public void visit(GroovyCodeVisitor visitor)
    Delegates to the visit method used for this class. If the visitor is a ClassGenerator, then `ClassGenerator.visitBytecodeSequence(BytecodeSequence)` 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.
    Overrides:
      `visit` in class `ASTNode`
    Parameters:
      `visitor` - the `GroovyCodeVisitor` to process this node
    See Also:
      - `ClassGenerator`