Package org.eclipse.m2m.atl.emftvm.impl.resource

# Class ConstantPool

java.lang.Object
org.eclipse.m2m.atl.emftvm.impl.resource.ConstantPool

public class ConstantPool extends Object
Constant pool implementation for binary EMFTVM file format.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`ConstantPool.CreateConstantsSwitch`
Creates constant pool entries for EMFTVM elements.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected ConstantPool.CreateConstantsSwitch`
`createConstants`

## Constructor Summary

Constructors
Constructor
Description
`ConstantPool()`
Creates a new `ConstantPool`.
`ConstantPool(int size)`
Creates a new `ConstantPool`.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Object value)`
Adds
`void`
`createConstants(Module module)`
Creates a constant table for the given module.
`Object`
`get(int i)`
Returns the constant at index
`int`
`indexOf(Object value)`
Returns the index of
`void`
`read(DataInputStream in)`
Reads constant table from
`int`
`size()`
Returns the size of the constant pool.
`void`
`write(DataOutputStream out)`
Writes constant pool to

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

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

## Field Details

### createConstants

protected ConstantPool.CreateConstantsSwitch createConstants

## Constructor Details

### ConstantPool

public ConstantPool()
Creates a new `ConstantPool`.

### ConstantPool

public ConstantPool(int size)
Creates a new `ConstantPool`.

Parameters:
  `size` - the initial pool size

## Method Details

### get

public Object get(int i)
Returns the constant at index

    i

.

Parameters:
  `i` - the constant index
Returns:
  the constant, or `null`

### indexOf

public int indexOf(Object value) throws IllegalArgumentException
Returns the index of

    value

in the constant pool.

Parameters:
  `value` - the value to look up
Returns:
  the index of value in the constant pool
Throws:
  `IllegalArgumentException` - if value not found

### size

public int size()
Returns the size of the constant pool.

Returns:
  The size of the constant pool

### add

public void add(Object value)
Adds

    value

to the constant pool, if necessary.

Parameters:
  `value` - the value to add

### read

public void read(DataInputStream in) throws IOException
Reads constant table from

    in

.

Parameters:
  `in` - the input stream
Throws:
  `IOException`

### createConstants

public void createConstants(Module module)
Creates a constant table for the given module.

Parameters:
  `module` - the module

### write

public void write(DataOutputStream out) throws IOException
Writes constant pool to

    out

.

Parameters:
  `out` - the output stream
Throws:
  `IOException`