TGG-3.0-Prototype/RefactoringCDGTLConstraints/src/refactoringcd/full/Constraints.gtl

55 lines
1,020 B
Plaintext

package refactoringcd.constraints
import "http://www.eclipse.org/emf/2002/Ecore"
import "platform:/resource/ClassDiagram/model/classDiagram.ecore"
// Violation
pattern externalMethodAttributeDependency {
[=] fromClazz : Clazz {
[=] -features-> method
}
[=] toClazz : Clazz {
[=] -features-> attribute
}
[=] method : Method {
[=] -dependencies->attribute
}
[=] attribute : Attribute
};
pattern atLeastOneCommonAttributeDependency {
[=] clazz : Clazz {
[=] -features-> method
[=] -features-> otherMethod
}
[=] method : Method {
}
[=] otherMethod : Method {
}
forbid(atLeastOneCommonAttributeDependencySupport)
[clazz=clazz, method=method, otherMethod=otherMethod]
};
pattern atLeastOneCommonAttributeDependencySupport {
[=] clazz : Clazz {
[=] -features-> method
[=] -features-> otherMethod
[=] -features-> attribute
}
[=] method : Method {
[=] -dependencies->attribute
}
[=] otherMethod : Method {
[=] -dependencies->attribute
}
[=] attribute : Attribute
};