Class ConstantPool
java.lang.Object
org.eclipse.m2m.atl.emftvm.impl.resource.ConstantPool
Constant pool implementation for binary EMFTVM file format.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Creates constant pool entries for EMFTVM elements. -
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a newConstantPool
.ConstantPool
(int size) Creates a newConstantPool
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Addsvoid
createConstants
(Module module) Creates a constant table for the given module.get
(int i) Returns the constant at indexint
Returns the index ofvoid
read
(DataInputStream in) Reads constant table fromint
size()
Returns the size of the constant pool.void
write
(DataOutputStream out) Writes constant pool to
-
Field Details
-
createConstants
-
-
Constructor Details
-
ConstantPool
public ConstantPool()Creates a newConstantPool
. -
ConstantPool
public ConstantPool(int size) Creates a newConstantPool
.- Parameters:
size
- the initial pool size
-
-
Method Details
-
get
Returns the constant at indexi
.- Parameters:
i
- the constant index- Returns:
- the constant, or
null
-
indexOf
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:
IllegalArgumentException
- if value not found
-
size
public int size()Returns the size of the constant pool.- Returns:
- The size of the constant pool
-
add
Addsvalue
to the constant pool, if necessary.- Parameters:
value
- the value to add
-
read
Reads constant table fromin
.- Parameters:
in
- the input stream- Throws:
IOException
-
createConstants
Creates a constant table for the given module.- Parameters:
module
- the module
-
write
Writes constant pool toout
.- Parameters:
out
- the output stream- Throws:
IOException
-