Преглед на файлове

Added index calculation for sgraph region element.

markus.muehlbrandt@gmail.com преди 11 години
родител
ревизия
7ecd69b183
променени са 1 файла, в които са добавени 23 реда и са изтрити 10 реда
  1. 23 10
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/naming/DefaultNamingService.xtend

+ 23 - 10
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/naming/DefaultNamingService.xtend

@@ -21,6 +21,7 @@ import org.yakindu.sct.model.sexec.transformation.SgraphExtensions
 import org.yakindu.sct.model.sexec.ExecutionNode
 import org.eclipse.emf.ecore.EObject
 import java.util.List
+import org.yakindu.sct.model.sgraph.Region
 
 class StepDepthComparator implements Comparator<Step> {
 	@Inject
@@ -330,6 +331,14 @@ class DefaultNamingService implements INamingService {
 		return shortName;
 	}
 	
+	def protected dispatch String elementName(NamedElement it, NameShorteningStrategy nameShorteningType) {
+		switch nameShorteningType {
+			case NameShorteningStrategy::STANDARD: return name
+			case NameShorteningStrategy::REMOVE_VOWELS: return name?.removeVowels
+			case NameShorteningStrategy::INDEX_POSITION: return name?.removeVowels
+		}
+	}
+	
 	def protected dispatch String elementName(ExecutionScope it, NameShorteningStrategy nameShorteningType) {
 		switch nameShorteningType {
 			case NameShorteningStrategy::STANDARD: return name
@@ -345,6 +354,14 @@ class DefaultNamingService implements INamingService {
 			case NameShorteningStrategy::INDEX_POSITION: return asIndexPosition
 		}
 	}
+	
+	def protected dispatch String elementName(Region it, NameShorteningStrategy nameShorteningType) {
+		switch nameShorteningType {
+			case NameShorteningStrategy::STANDARD: return name
+			case NameShorteningStrategy::REMOVE_VOWELS: return name?.removeVowels
+			case NameShorteningStrategy::INDEX_POSITION: return asSGraphIndexPosition
+		}
+	}
 
 	def protected dispatch String elementName(Vertex it, NameShorteningStrategy nameShorteningType) {
 		switch nameShorteningType {
@@ -366,14 +383,6 @@ class DefaultNamingService implements INamingService {
 		eContainer.elementName(nameShorteningType)
 	}
 
-	def protected dispatch String elementName(NamedElement it, NameShorteningStrategy nameShorteningType) {
-		switch nameShorteningType {
-			case NameShorteningStrategy::STANDARD: return name
-			case NameShorteningStrategy::REMOVE_VOWELS: return name?.removeVowels
-			case NameShorteningStrategy::INDEX_POSITION: return name?.removeVowels
-		}
-	}
-
 	def protected dispatch String elementName(EObject it, NameShorteningStrategy nameShorteningType) {
 		eContainer?.elementName(nameShorteningType)
 	}
@@ -382,13 +391,17 @@ class DefaultNamingService implements INamingService {
 		superScope.subScopes.indexOf(it).toString;
 	}
 	
-	def protected dispatch asSGraphIndexPosition(Vertex it) {
-		parentRegion.vertices.toList.indexOf(it).toString
+	def protected dispatch asSGraphIndexPosition(Region it) {
+		composite.regions.toList.indexOf(it).toString
 	}
 	
 	def protected dispatch asSGraphIndexPosition(State it) {
 		parentRegion.vertices.filter(typeof(State)).toList.indexOf(it).toString
 	}
+	
+	def protected dispatch asSGraphIndexPosition(Vertex it) {
+		parentRegion.vertices.toList.indexOf(it).toString
+	}
 
 	def protected removeVowels(String it) {
 		replaceAll('[aeiou]', '')