Project

General

Profile

Revision 9

Added by Willibald K. over 8 years ago

remove support for Qualitative Action Systems, rename UlyssesType to Type

View differences:

JavaInitVisitor.java
43 43
import org.momut.ooas.ast.types.OoActionSystemType;
44 44
import org.momut.ooas.ast.types.TupleType;
45 45
import org.momut.ooas.ast.types.TypeKind;
46
import org.momut.ooas.ast.types.UlyssesType;
46
import org.momut.ooas.ast.types.Type;
47 47
import org.momut.ooas.codegen.OoasCodeEmitter;
48 48
import org.momut.ooas.parser.ParserError;
49 49
import org.momut.ooas.parser.ParserMessage;
......
54 54
{
55 55
	private final String SimulationNameSpace = "org.momut.ooas.codegen.java.simulation";
56 56
	private final OoasCodeEmitter emitter;
57
	private final ArrayList<UlyssesType> hiddenTypesStillToEmit = new ArrayList<UlyssesType>();
57
	private final ArrayList<Type> hiddenTypesStillToEmit = new ArrayList<Type>();
58 58
	private final Scratchbook scratchbook = new Scratchbook();
59 59
	private StringBuilder helpers = new StringBuilder();
60 60

  
......
115 115
			? actionSystemClass.parent.objectInstance
116 116
			: null;
117 117

  
118
		final HashSet<UlyssesType> seenTypes = new HashSet<UlyssesType>();
118
		final HashSet<Type> seenTypes = new HashSet<Type>();
119 119
		final StringBuilder instantiationPath = new StringBuilder();
120 120
		if (aParentInstance != null)
121 121
		{
......
128 128
			}
129 129
		}
130 130

  
131
		UlyssesType tmpType = atype;
131
		Type tmpType = atype;
132 132
		while (tmpType != null)
133 133
		{
134 134
			if (seenTypes.contains(tmpType))
......
169 169
		if (ConstrNum >= 0)
170 170
			scratchbook.constructors().get(ConstrNum).AddInstance(actionSystemClass.objectInstance);
171 171
	}
172
	private String GetCSharpType(UlyssesType aType)
172
	private String GetCSharpType(Type aType)
173 173
	{
174 174
		if (aType.isAnonymousType())
175 175
			hiddenTypesStillToEmit.add(aType);
......
266 266
	{
267 267
		emitter.AppendLineIncIndent(String.format("public static class %s {", GetIdentifierString(atupleType.identifier().tokenText())));
268 268
		int i = 0;
269
		for (final UlyssesType it: atupleType.innerTypes())
269
		for (final Type it: atupleType.innerTypes())
270 270
		{
271 271
			emitter.AppendLine(String.format("public %s elem_%s;", GetCSharpType(it), Integer.toString(i)));
272 272
			i++;
......
275 275
		emitter.AppendLine(" /*constr*/ ");
276 276
		emitter.Append(String.format("public %s (", GetIdentifierString(atupleType.identifier().tokenText())));
277 277
		i = 0;
278
		for (final UlyssesType it: atupleType.innerTypes())
278
		for (final Type it: atupleType.innerTypes())
279 279
		{
280 280
			if (i != 0)
281 281
				emitter.Append(",");
......
313 313
	protected void VisitAstElement(IAst element, IAst parent)
314 314
	{
315 315
		if (element.nodeType() == AstNodeTypeEnum.type &&
316
				((UlyssesType)element).kind() == TypeKind.OoActionSystemType)
316
				((Type)element).kind() == TypeKind.OoActionSystemType)
317 317
		{
318 318
			/*OoActionSystemType asystem = (OoActionSystemType)element;
319 319
			if (asystem.autoConstruction)
......
321 321
			Emit((OoActionSystemType)element);
322 322
		}
323 323
		else if (element.nodeType() == AstNodeTypeEnum.type &&
324
				((UlyssesType)element).kind() == TypeKind.TupleType)
324
				((Type)element).kind() == TypeKind.TupleType)
325 325
		{
326 326
			Emit((TupleType)element);
327 327
		}
328 328
		else if (element.nodeType() == AstNodeTypeEnum.type &&
329
				((UlyssesType)element).kind() == TypeKind.EnumeratedType)
329
				((Type)element).kind() == TypeKind.EnumeratedType)
330 330
		{
331 331
			Emit((EnumType)element);
332 332
		}
......
348 348
		super.visit(mainModule);
349 349

  
350 350
		emitter.AppendLine(" /* == anonymous types == */ ");
351
		for (final UlyssesType x: hiddenTypesStillToEmit)
351
		for (final Type x: hiddenTypesStillToEmit)
352 352
		{
353 353
			// we only need to define tuples and enums..
354 354
			if (x.kind() == TypeKind.TupleType)

Also available in: Unified diff