Package org.biojava.utils.bytecode

# Class LocalVariable

java.lang.Object
org.biojava.utils.bytecode.LocalVariable

public final class LocalVariable extends Object
A local variable.

Local variables are used as identifiers for things that can be stored and loaded from the local variable slots associated with each method. By using LocalVariable intances, you are removed from the taudry task of book-keeping these slots.

To use a local variable, create an intance and then use it in a code generator. The method will keep track of which local variables are in scope, and will handle all the nastiness for you. You can re-use the same local variable instance in different contexts, and it will be sanely allocated different or the same slots.

The JVM stores some things in single words, and others in pairs of words. To hide this detail from you, local variables take a class that indicates the type of thing they will store. Please populate this sensibly.

Author:
  Thomas Down, Matthew Pocock

## Constructor Summary

Constructors
Constructor
Description
`LocalVariable(CodeClass clazz)`
Create a new local variable that will store values of a given type.
`LocalVariable(CodeClass clazz, String name)`
Create a new local variable with a type and a name.

## Method Summary

Modifier and Type
Method
Description
`String`
`getName()`
`CodeClass`
`getType()`
`int`
`needSlots()`
`String`
`toString()`

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

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

## Constructor Details

### LocalVariable

public LocalVariable(CodeClass clazz)
Create a new local variable that will store values of a given type.

Parameters:
  `clazz` - the type of the values stored in this variable

### LocalVariable

public LocalVariable(CodeClass clazz, String name)
Create a new local variable with a type and a name.

The name may appear in debug output from the generator, and possibly in stack-traces.

Parameters:
  `clazz` - the type of the values stored in this variable
  `name` - the name of the variable

## Method Details

### getName

public String getName()

### needSlots

public int needSlots()

### getType

public CodeClass getType()

### toString

public String toString()

Overrides:
  `toString` in class `Object`