use of org.eclipse.titan.designer.AST.TTCN3.types.EnumeratedGenerator.Enum_field in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Enumerated_Type method generateCode.
/**
* Add generated java code on this level.
* @param aData only used to update imports if needed
* @param source the source code generated
*/
@Override
public /**
* {@inheritDoc}
*/
void generateCode(final JavaGenData aData, final StringBuilder source) {
final String ownName = getGenNameOwn();
final String displayName = getFullName();
generateCodeTypedescriptor(aData, source);
final List<EnumItem> items = new ArrayList<EnumItem>();
if (enumerations != null) {
if (enumerations.enumItems1 != null) {
items.addAll(enumerations.enumItems1.getItems());
}
if (enumerations.enumItems2 != null) {
items.addAll(enumerations.enumItems2.getItems());
}
}
final boolean hasRaw = getGenerateCoderFunctions(MessageEncoding_type.RAW);
final ArrayList<Enum_field> fields = new ArrayList<EnumeratedGenerator.Enum_field>(items.size());
for (int i = 0; i < items.size(); i++) {
final EnumItem tempItem = items.get(i);
fields.add(new Enum_field(tempItem.getId().getName(), tempItem.getId().getDisplayName(), ((Integer_Value) tempItem.getValue()).getValue()));
}
final Enum_Defs e_defs = new Enum_Defs(fields, ownName, displayName, getGenNameTemplate(aData, source, myScope), hasRaw);
EnumeratedGenerator.generateValueClass(aData, source, e_defs);
EnumeratedGenerator.generateTemplateClass(aData, source, e_defs);
generateCodeForCodingHandlers(aData, source);
}
use of org.eclipse.titan.designer.AST.TTCN3.types.EnumeratedGenerator.Enum_field in project titan.EclipsePlug-ins by eclipse.
the class TTCN3_Enumerated_Type method generateCode.
/**
* Add generated java code on this level.
* @param aData only used to update imports if needed
* @param source the source code generated
*/
@Override
public /**
* {@inheritDoc}
*/
void generateCode(final JavaGenData aData, final StringBuilder source) {
final String ownName = getGenNameOwn();
final String displayName = getFullName();
generateCodeTypedescriptor(aData, source);
final boolean hasRaw = getGenerateCoderFunctions(MessageEncoding_type.RAW);
final ArrayList<Enum_field> fields = new ArrayList<EnumeratedGenerator.Enum_field>(items.getItems().size());
for (int i = 0; i < items.getItems().size(); i++) {
final EnumItem tempItem = items.getItems().get(i);
fields.add(new Enum_field(tempItem.getId().getName(), tempItem.getId().getDisplayName(), ((Integer_Value) tempItem.getValue()).getValue()));
}
final Enum_Defs e_defs = new Enum_Defs(fields, ownName, displayName, getGenNameTemplate(aData, source, myScope), hasRaw);
EnumeratedGenerator.generateValueClass(aData, source, e_defs);
EnumeratedGenerator.generateTemplateClass(aData, source, e_defs);
if (hasDoneAttribute()) {
generateCodeDone(aData, source);
}
if (subType != null) {
subType.generateCode(aData, source);
}
generateCodeForCodingHandlers(aData, source);
}
Aggregations