Class ConstantPool
- java.lang.Object
-
- org.eclipse.m2m.atl.emftvm.impl.resource.ConstantPool
-
public class ConstantPool extends java.lang.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 newConstantPool
.ConstantPool(int size)
Creates a newConstantPool
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object value)
Addsvoid
createConstants(Module module)
Creates a constant table for the given module.java.lang.Object
get(int i)
Returns the constant at indexint
indexOf(java.lang.Object value)
Returns the index ofvoid
read(java.io.DataInputStream in)
Reads constant table fromint
size()
Returns the size of the constant pool.void
write(java.io.DataOutputStream out)
Writes constant pool to
-
-
-
Field Detail
-
createConstants
protected ConstantPool.CreateConstantsSwitch createConstants
-
-
Constructor Detail
-
ConstantPool
public ConstantPool()
Creates a newConstantPool
.
-
ConstantPool
public ConstantPool(int size)
Creates a newConstantPool
.- Parameters:
size
- the initial pool size
-
-
Method Detail
-
get
public java.lang.Object get(int i)
Returns the constant at indexi
.- Parameters:
i
- the constant index- Returns:
- the constant, or
null
-
indexOf
public int indexOf(java.lang.Object value) throws java.lang.IllegalArgumentException
Returns the index ofvalue
in the constant pool.- Parameters:
value
- the value to look up- Returns:
- the index of value in the constant pool
- Throws:
java.lang.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(java.lang.Object value)
Addsvalue
to the constant pool, if necessary.- Parameters:
value
- the value to add
-
read
public void read(java.io.DataInputStream in) throws java.io.IOException
Reads constant table fromin
.- Parameters:
in
- the input stream- Throws:
java.io.IOException
-
createConstants
public void createConstants(Module module)
Creates a constant table for the given module.- Parameters:
module
- the module
-
write
public void write(java.io.DataOutputStream out) throws java.io.IOException
Writes constant pool toout
.- Parameters:
out
- the output stream- Throws:
java.io.IOException
-
-