use of org.yakindu.sct.model.sgraph.CompositeElement in project statecharts by Yakindu.
the class RefactoringHelper method getParentStates.
/**
* Returns all parent states of the specified child state.
*
* @param state
* child state
* @return all parent states of the specified child state
*/
// TODO are hierarchies of regions possible?
private Set<State> getParentStates(Vertex state) {
Set<State> parentStates = new HashSet<State>();
CompositeElement composite = state.getParentRegion().getComposite();
if (composite instanceof State) {
State parentState = (State) composite;
parentStates.add(parentState);
parentStates.addAll(getParentStates(parentState));
}
return parentStates;
}
use of org.yakindu.sct.model.sgraph.CompositeElement in project statecharts by Yakindu.
the class SGraphJavaValidator method orthogonalTransition.
@Check
public void orthogonalTransition(Transition transition) {
Vertex source = transition.getSource();
Vertex target = transition.getTarget();
if ((source instanceof Synchronization) || (target instanceof Synchronization))
// ... the check does not apply.
return;
EObject commonAncestor = commonAncestor(source, target);
if (commonAncestor instanceof CompositeElement) {
error(ISSUE_TRANSITION_ORTHOGONAL, transition, null, -1);
}
}
use of org.yakindu.sct.model.sgraph.CompositeElement in project statecharts by Yakindu.
the class SGraphNameProvider method qualifiedName.
public QualifiedName qualifiedName(Region ele) {
QualifiedName qualifiedNameFromConverter = null;
if (ele.getName() == null || ele.getName().isEmpty()) {
if (ele.eContainer() instanceof CompositeElement) {
CompositeElement parent = (CompositeElement) ele.eContainer();
int index = parent.getRegions().indexOf(ele);
if (index != -1) {
qualifiedNameFromConverter = QualifiedName.create("_region" + index);
}
}
if (qualifiedNameFromConverter == null) {
return null;
}
} else {
qualifiedNameFromConverter = QualifiedName.create(identifierConverter.toIdentifier(ele.getName()));
}
return getParentQualifiedName(ele, qualifiedNameFromConverter);
}
Aggregations