Pārlūkot izejas kodu

Added XTend extensions for execution model.

markus.muehlbrandt@itemis.de 13 gadi atpakaļ
vecāks
revīzija
1822dab499

+ 48 - 0
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/ExecutionModelCoreExtensions.ext

@@ -0,0 +1,48 @@
+/*
+  Copyright (c) 2011 committers of YAKINDU and others.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Eclipse Public License v1.0
+  which accompanies this distribution, and is available at
+  http://www.eclipse.org/legal/epl-v10.html
+  Contributors:
+  	Markus Muehlbrandt - Initial contribution and API
+ */
+import stext;
+import sexec;
+import sgraph;
+
+List getDeclaredVariables(ExecutionFlow flow) : flow.scopes.declarations.typeSelect(VariableDefinition);
+
+getInterfaceScope(ExecutionFlow this) : scopes.typeSelect(InterfaceScope);
+getInterfaceScopeDeclarations(ExecutionFlow this) : getInterfaceScope().declarations;
+getInterfaceScopeVariables(ExecutionFlow this) : getInterfaceScopeDeclarations().typeSelect(VariableDefinition);
+getInterfaceScopeEvents(ExecutionFlow this) : getInterfaceScopeDeclarations().typeSelect(EventDefinition);
+getInterfaceScopeVoidEvents(ExecutionFlow this) : getInterfaceScopeEvents().select(e|e.type==Type::void);
+getInterfaceScopeValuedEvents(ExecutionFlow this) : getInterfaceScopeEvents().select(e|e.type!=Type::void);
+
+getInternalScope(ExecutionFlow this) : scopes.typeSelect(InternalScope);
+getInternalScopeDeclarations(ExecutionFlow this) : getInternalScope().declarations;
+getInternalScopeVariables(ExecutionFlow this) :	getInternalScopeDeclarations().typeSelect(VariableDefinition);
+getInternalScopeEvents(ExecutionFlow this) : getInternalScopeDeclarations().typeSelect(EventDefinition);
+getInternalScopeVoidEvents(ExecutionFlow this) :getInternalScopeEvents().select(e|e.type==Type::void);
+getInternalScopeValuedEvents(ExecutionFlow this) : getInternalScopeEvents().select(e|e.type!=Type::void);
+
+getTimeEvents(ExecutionFlow this) : scopes.typeSelect(Scope).declarations.typeSelect(TimeEvent);
+
+boolean isTimedStatemachine(ExecutionFlow this) :
+	getTimeEvents().size > 0;
+	
+boolean hasOutgoingEvents(Scope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).isEmpty;
+
+boolean hasOutgoingVoidEvents(Scope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).select(event|event.type == Type::void).isEmpty;
+	
+boolean hasOutgoingValuedEvents(Scope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).select(event|event.type != Type::void).isEmpty;
+
+boolean hasEvents(Scope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.type == Type::void).isEmpty;
+	
+boolean hasValuedEvents(Scope this) :
+	!declarations.typeSelect(EventDefinition).select(event|event.type != Type::void).isEmpty;