Commit de2e9c78 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ support for collections, anonymous data element uses, &27

parent c1577646
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import org.etsi.mts.tdl.ComponentType;
import org.etsi.mts.tdl.CompoundBehaviour;
import org.etsi.mts.tdl.ConditionalBehaviour;
import org.etsi.mts.tdl.DataElementUse;
import org.etsi.mts.tdl.DataType;
import org.etsi.mts.tdl.DataUse;
import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.EnumDataType;
@@ -274,7 +275,6 @@ public class TTCN3Renderer {

	String render(DataElementUse e, String indent) {
		String output = "";
		if (e.getDataElement()!=null) {
		//TODO: arguments, reduction, other..
		//TODO: anonymous types
		//TODO: with or without parameters, {} vs ()
@@ -284,7 +284,11 @@ public class TTCN3Renderer {
		String assignedArguments =e.getArgument().stream()
				.map(m -> ttcnName(m.getParameter())+" := "+render(m.getParameter(), m.getDataUse(), ""))
				.collect(Collectors.joining(", "));
		String items =e.getItem().stream()
				.map(m -> render(m, ""))
				.collect(Collectors.joining(", "));

		if (e.getDataElement()!=null) {
			NamedElement dataElement = e.getDataElement();
			output+=switch (dataElement) {
			case StructuredDataType d -> output+="{"+assignedArguments+"}";
@@ -292,8 +296,18 @@ public class TTCN3Renderer {
			case Function d -> output+=ttcnName(e.getDataElement())+"("+arguments+")";
			case Parameter d -> output+=ttcnName(e.getDataElement());
			case SimpleDataInstance d -> output+=ttcnName(e.getDataElement());
			case CollectionDataType d -> output+="{"+items+"}";
			default -> "NOT_SUPPORTED_YET";
			};
		} else {
			DataType dataType = e.resolveDataType();
			output+=switch (dataType) {
			case StructuredDataType d -> output+="{"+assignedArguments+"}";
			case CollectionDataType d -> output+="{"+items+"}";
			//TODO: collections
			default -> "NOT_SUPPORTED_YET";
			};
			
		}
		output+=renderReduction(e, indent);
		return output;