use of org.osate.aadl2.ComponentClassifier in project AGREE by loonwerks.
the class AgreePatternTranslator method translatePattern.
private Expr translatePattern(AgreeCauseEffectPattern pattern, AgreeNodeBuilder builder, boolean isProperty) {
if (pattern instanceof AgreeTimesPattern) {
return translatePattern((AgreeTimesPattern) pattern, builder);
}
EObject varReference = pattern.reference;
while (!(varReference instanceof ComponentClassifier)) {
varReference = varReference.eContainer();
}
IdExpr causeId = pattern.cause;
IdExpr effectId = pattern.effect;
if (pattern.causeType == TriggerType.CONDITION) {
causeId = translateCauseCondtionPattern(pattern, causeId, builder);
}
if (isProperty) {
return translatePatternProperty(pattern, builder, causeId, effectId);
} else {
return translatePatternConstraint(pattern, builder, causeId, effectId);
}
}
use of org.osate.aadl2.ComponentClassifier in project AGREE by loonwerks.
the class AgreeValidator method getEnumValueDefLocation.
private String getEnumValueDefLocation(NamedID id) {
EObject container = id.eContainer();
EnumStatement enumStatement = (EnumStatement) container;
String enumName = enumStatement.getName();
while (!(container instanceof AadlPackage) && !(container instanceof ComponentClassifier)) {
container = container.eContainer();
}
return ((NamedElement) container).getQualifiedName() + "::" + enumName;
}
use of org.osate.aadl2.ComponentClassifier in project AGREE by loonwerks.
the class AgreeValidator method checkLatchedExpr.
@Check(CheckType.FAST)
public void checkLatchedExpr(LatchedExpr latched) {
// get container
EObject container = latched.eContainer();
AgreeContract contract = null;
while (!(container instanceof ComponentClassifier)) {
if (container instanceof AgreeContract) {
contract = (AgreeContract) container;
}
container = container.eContainer();
}
if (container instanceof ComponentImplementation) {
boolean foundLatchedStatement = false;
for (SpecStatement spec : contract.getSpecs()) {
if (spec instanceof LatchedStatement) {
foundLatchedStatement = true;
break;
}
}
if (!foundLatchedStatement) {
error(latched, "Latched expressions can appear only in component implementations " + "that contain a latched synchrony statement");
}
} else {
error(latched, "Latched expressions can appear only in component implementations");
}
Expr expr = latched.getExpr();
Expr nestId = null;
if (expr instanceof NamedElmExpr) {
nestId = expr;
} else if (expr instanceof EventExpr) {
EventExpr eventExpr = (EventExpr) expr;
nestId = eventExpr.getPort();
}
if (nestId != null) {
NamedElement namedEl = null;
if (nestId instanceof NamedElmExpr) {
namedEl = ((NamedElmExpr) nestId).getElm();
} else if (nestId instanceof SelectionExpr) {
namedEl = ((SelectionExpr) nestId).getField();
}
if ((namedEl instanceof DataPort) && ((DataPort) namedEl).isIn()) {
return;
} else if ((namedEl instanceof EventDataPort) && ((EventDataPort) namedEl).isIn()) {
return;
} else {
// check to see if it is an "agree_input"
EObject namedElContainer = namedEl.eContainer();
if (namedElContainer instanceof InputStatement) {
return;
}
}
}
error(latched, "Latched expressions are valid only for input data ports or event expressions over input event data ports");
}
use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.
the class StakeholderGoalsImpl method setTarget.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTarget(ComponentClassifier newTarget) {
ComponentClassifier oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.STAKEHOLDER_GOALS__TARGET, oldTarget, target));
}
use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.
the class SystemRequirementSetImpl method setTarget.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTarget(ComponentClassifier newTarget) {
ComponentClassifier oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.SYSTEM_REQUIREMENT_SET__TARGET, oldTarget, target));
}
Aggregations