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:

CadpExpression.java
61 61
import org.momut.ooas.ast.types.MapType;
62 62
import org.momut.ooas.ast.types.OoActionSystemInstance;
63 63
import org.momut.ooas.ast.types.OoActionSystemType;
64
import org.momut.ooas.ast.types.QrType;
65 64
import org.momut.ooas.ast.types.TupleType;
66 65
import org.momut.ooas.ast.types.TypeKind;
67
import org.momut.ooas.ast.types.UlyssesType;
66
import org.momut.ooas.ast.types.Type;
68 67
import org.momut.ooas.codegen.OoasCodeEmitter;
69 68
import org.momut.ooas.parser.SymbolTable;
70 69
import org.momut.ooas.visitors.OoaExpressionVisitor;
......
486 485
		m_emitter = tmp;
487 486

  
488 487
		// treat cases of MyTuple(a,b..) = <expr>
489
		final Iterator<UlyssesType> elem = ((TupleType)tupleConstructor.type()).innerTypes().iterator();
488
		final Iterator<Type> elem = ((TupleType)tupleConstructor.type()).innerTypes().iterator();
490 489
		int i = 0;
491 490
		m_emitter.Append("(");
492 491
		while (elem.hasNext())
......
594 593

  
595 594
		CadpType.EmitType(binaryOperator.type());
596 595
		final ListType alist = (ListType)binaryOperator.type();
597
		final UlyssesType innerType = alist.innerType();
596
		final Type innerType = alist.innerType();
598 597
		final String resultTypeName = CadpIdentifier.GetIdentifierString(binaryOperator.type().identifier());
599 598

  
600 599
		m_helperCode.AppendLine(String.format("%4$s %3$s(%1$s listA, %2$s listB){", childATypeName, childBTypeName, result, resultTypeName));
......
695 694

  
696 695
		CadpType.EmitType(binaryOperator.type());
697 696
		final ListType alist = (ListType)binaryOperator.type();
698
		final UlyssesType innerType = alist.innerType();
697
		final Type innerType = alist.innerType();
699 698
		final String resultTypeName = CadpIdentifier.GetIdentifierString(binaryOperator.type().identifier());
700 699

  
701 700
		m_helperCode.AppendLine(String.format("%4$s %3$s(%1$s listA, %2$s listB){", childATypeName, childBTypeName, result, resultTypeName));
......
755 754

  
756 755
			final FunctionType fun = (FunctionType)leftcall.child().type();
757 756
			final FunctionIdentifier funid = (FunctionIdentifier) fun.identifier();
758
			final Iterator<UlyssesType> node = fun.parameter().iterator();
757
			final Iterator<Type> node = fun.parameter().iterator();
759 758
			for (int i = 0; i < fun.parameter().size() - 2; i++)
760 759
			{
761
				final UlyssesType nodeValue = node.next();
760
				final Type nodeValue = node.next();
762 761
				paramtypes.add(CadpType.DumpType(nodeValue));
763 762
				final CadpIdentifier paramid = new CadpIdentifier(m_procInfo.stateVariableString);
764 763
				funid.parameter().get(i).Accept(paramid);
......
1107 1106
	/* The cast support in this target instanceof limited: We can not cast differently sized types!
1108 1107
	 * Hence list and map lengths must be equal.
1109 1108
	 * */
1110
	private boolean CADPCastEquivalent(UlyssesType type1, UlyssesType type2)
1109
	private boolean CADPCastEquivalent(Type type1, Type type2)
1111 1110
	{
1112 1111
		if ((type1 == null) || (type2 == null))
1113 1112
			return false;
......
1141 1140
			return CADPCastEquivalent(mapt1.fromType(), mapt2.fromType()) &&
1142 1141
					CADPCastEquivalent(mapt1.toType(), mapt2.toType()) &&
1143 1142
					mapt1.maxNumberOfElements() == mapt2.maxNumberOfElements();
1144
		case QrType:
1145
			final QrType qr1 = (QrType)type1;
1146
			final QrType qr2 = (QrType)type2;
1147
			return qr1 == qr2; // ref eq.
1148 1143
		case TupleType:
1149 1144
			final TupleType tuplet1 = (TupleType)type1;
1150 1145
			final TupleType tuplet2 = (TupleType)type2;
1151 1146
			if (tuplet1.innerTypes().size() != tuplet2.innerTypes().size())
1152 1147
				return false;
1153
			final Iterator<UlyssesType> innert1 = tuplet1.innerTypes().iterator();
1154
			final Iterator<UlyssesType> innert2 = tuplet2.innerTypes().iterator();
1148
			final Iterator<Type> innert1 = tuplet1.innerTypes().iterator();
1149
			final Iterator<Type> innert2 = tuplet2.innerTypes().iterator();
1155 1150
			while (innert1.hasNext())
1156 1151
			{
1157
				final UlyssesType innert1Value = innert1.next();
1158
				final UlyssesType innert2Value = innert2.next();
1152
				final Type innert1Value = innert1.next();
1153
				final Type innert2Value = innert2.next();
1159 1154

  
1160 1155
				if (!CADPCastEquivalent(innert1Value, innert2Value))
1161 1156
					return false;
......
1163 1158
			return true;
1164 1159
		case OoActionSystemType:
1165 1160
			return type1 == type2 /*ref. eq.*/ ||
1166
					UlyssesType.Covariance((OoActionSystemType)type2, (OoActionSystemType)type1);
1161
					Type.Covariance((OoActionSystemType)type2, (OoActionSystemType)type1);
1167 1162
		case OpaqueType:
1168 1163
			throw new IllegalArgumentException();
1169 1164
		case Null:
......
1291 1286
					unaryOperator.type().Accept(targetType);
1292 1287
					final CadpType sourceType = new CadpType();
1293 1288
					unaryOperator.child().type().Accept(sourceType);
1294
					if (!(UlyssesType.Covariance((OoActionSystemType)unaryOperator.child().type(), (OoActionSystemType)unaryOperator.type())))
1289
					if (!(Type.Covariance((OoActionSystemType)unaryOperator.child().type(), (OoActionSystemType)unaryOperator.type())))
1295 1290
					{
1296 1291
						// cast result type (unaryOperator.type) not a sub-type of unaryOperator.child.type
1297 1292
						return String.format("/* up-cast: %1$s as %2$s */ *(%2$s*)&", sourceType.ToString(), targetType.ToString());

Also available in: Unified diff