瀏覽代碼

renamed DefaultTypeSystem to GenericTypeSystem

Andreas Mülder 10 年之前
父節點
當前提交
cdd71962df

+ 2 - 3
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.xtend

@@ -16,7 +16,6 @@ import org.eclipse.xtext.EcoreUtil2
 import org.eclipse.xtext.naming.IQualifiedNameProvider
 import org.yakindu.base.types.Package
 import org.yakindu.base.types.inferrer.ITypeSystemInferrer
-import org.yakindu.base.types.typesystem.DefaultTypeSystem
 import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.base.types.typesystem.ITypeValueProvider
 import org.yakindu.sct.model.sexec.ExecutionFlow
@@ -130,14 +129,14 @@ class DefaultExecutionContextInitializer implements IExecutionContextInitializer
 	def dispatch ExecutionSlot create new ExecutionVariableImpl() transform(OperationDefinition op) {
 		it.name = op.fullyQualifiedName.lastSegment
 		it.fqName = op.fullyQualifiedName.toString
-		it.type = if(op.type != null) op.type else getType(DefaultTypeSystem.VOID)
+		it.type = if(op.type != null) op.type else getType(ITypeSystem.VOID)
 		it.value = it.type.defaultValue
 	}
 
 	def dispatch ExecutionSlot create new ExecutionEventImpl() transform(TimeEvent event) {
 		it.name = event.fullyQualifiedName.lastSegment
 		it.fqName = event.fullyQualifiedName.toString
-		it.type = getType(DefaultTypeSystem.INTEGER)
+		it.type = getType(ITypeSystem.INTEGER)
 		it.value = it.type.defaultValue
 	}
 

+ 9 - 9
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -43,7 +43,6 @@ import org.yakindu.base.expressions.expressions.TypeCastExpression
 import org.yakindu.base.types.Enumerator
 import org.yakindu.base.types.Operation
 import org.yakindu.base.types.Type
-import org.yakindu.base.types.typesystem.DefaultTypeSystem
 import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression
@@ -53,6 +52,7 @@ import org.yakindu.sct.simulation.core.sruntime.CompositeSlot
 import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable
+import org.yakindu.base.types.typesystem.GenericTypeSystem
 
 /**
  * 
@@ -92,30 +92,30 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	}
 
 	def dispatch Object typeCast(Long value, Type type) {
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.INTEGER))) return value
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Float value, Type type) {
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value.longValue
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.INTEGER))) return value.longValue
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Double value, Type type) {
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.INTEGER))) return value.longValue
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.REAL))) return Double.valueOf(value)
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.INTEGER))) return value.longValue
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.REAL))) return Double.valueOf(value)
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(Boolean value, Type type) {
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.BOOLEAN))) return value
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.BOOLEAN))) return value
 		throw new IllegalArgumentException
 	}
 
 	def dispatch Object typeCast(String value, Type type) {
-		if(ts.isSame(type, ts.getType(DefaultTypeSystem.STRING))) return value
+		if(ts.isSame(type, ts.getType(GenericTypeSystem.STRING))) return value
 		throw new IllegalArgumentException
 	}
 

+ 6 - 6
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/STextInterpreterTest.java

@@ -19,7 +19,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.base.types.typesystem.DefaultTypeSystem;
+import org.yakindu.base.types.typesystem.GenericTypeSystem;
 import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
@@ -473,35 +473,35 @@ public class STextInterpreterTest extends AbstractSTextTest {
 		ExecutionVariable intVar = new ExecutionVariableImpl();
 		intVar.setName("intVar");
 		intVar.setFqName("intVar");
-		intVar.setType(typeSystem.getType(DefaultTypeSystem.INTEGER));
+		intVar.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
 		intVar.setValue(0);
 		context.getSlots().add(intVar);
 
 		ExecutionVariable boolVar = new ExecutionVariableImpl();
 		boolVar.setName("boolVar");
 		boolVar.setFqName("boolVar");
-		boolVar.setType(typeSystem.getType(DefaultTypeSystem.BOOLEAN));
+		boolVar.setType(typeSystem.getType(GenericTypeSystem.BOOLEAN));
 		boolVar.setValue(false);
 		context.getSlots().add(boolVar);
 
 		ExecutionVariable realVar = new ExecutionVariableImpl();
 		realVar.setName("realVar");
 		realVar.setFqName("realVar");
-		realVar.setType(typeSystem.getType(DefaultTypeSystem.REAL));
+		realVar.setType(typeSystem.getType(GenericTypeSystem.REAL));
 		realVar.setValue(0.0f);
 		context.getSlots().add(realVar);
 
 		ExecutionVariable stringVar = new ExecutionVariableImpl();
 		stringVar.setName("stringVar");
 		stringVar.setFqName("stringVar");
-		stringVar.setType(typeSystem.getType(DefaultTypeSystem.STRING));
+		stringVar.setType(typeSystem.getType(GenericTypeSystem.STRING));
 		stringVar.setValue("");
 		context.getSlots().add(stringVar);
 
 		ExecutionEvent event = new ExecutionEventImpl();
 		event.setName("abc");
 		event.setFqName("abc");
-		event.setType(typeSystem.getType(DefaultTypeSystem.INTEGER));
+		event.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
 		context.getSlots().add(event);
 	}