use of org.osate.aadl2.DirectionType in project osate2 by osate.
the class ErrorModelValidator method checkFlowDirection.
private void checkFlowDirection(ErrorSource errorSource) {
NamedElement ne = errorSource.getSourceModelElement();
if (ne instanceof ErrorPropagation) {
if (!Aadl2Util.isNull(ne) && ne instanceof ErrorPropagation) {
ErrorPropagation ep = (ErrorPropagation) ne;
DirectionType epd = ep.getDirection();
if (!(epd.equals(DirectionType.OUT))) {
error(errorSource, EMV2Util.getPrintName(ep) + " of error source is not an outgoing propagation point.");
}
}
}
}
use of org.osate.aadl2.DirectionType in project osate2 by osate.
the class ErrorModelValidator method checkFlowDirection.
private void checkFlowDirection(ErrorPath errorPath) {
ErrorPropagation ep = errorPath.getIncoming();
if (!Aadl2Util.isNull(ep)) {
DirectionType epd = ep.getDirection();
if (!(epd.equals(DirectionType.IN))) {
error(errorPath, "Source " + EMV2Util.getPrintName(ep) + " of error path is not an incoming propagation point.");
}
}
ep = errorPath.getOutgoing();
if (!Aadl2Util.isNull(ep)) {
DirectionType epd = ep.getDirection();
if (!(epd.equals(DirectionType.OUT))) {
error(errorPath, "Target " + EMV2Util.getPrintName(ep) + " of error path is not an outgoing propagation point.");
}
}
}
use of org.osate.aadl2.DirectionType in project osate2 by osate.
the class ErrorModelValidator method checkDirectionType.
private void checkDirectionType(ErrorPropagation errorPropagation) {
DirectionType pd = errorPropagation.getDirection();
DirectionType portd = EMV2Util.getErrorPropagationFeatureDirection(errorPropagation);
if (!(pd.getName().equalsIgnoreCase(portd.getName()) || portd == DirectionType.IN_OUT)) {
error(errorPropagation, "Propagation '" + EMV2Util.getPropagationName(errorPropagation) + "' direction does not match feature direction.");
}
}
use of org.osate.aadl2.DirectionType in project osate2 by osate.
the class FlowSpecificationCreationUtil method isValidFlowEnd.
/**
* Returns whether a specified feature diagram element may be used as a flow end for a flow specification.
* feature, its direction must be IN OUT or match the specified direction
*/
public static boolean isValidFlowEnd(final Feature feature, final BusinessObjectContext featureBoc, final DirectionType requiredDirection, final QueryService queryService) {
// Ensure that the feature is contained in a component type
if (getPotentialOwnersByFeature(featureBoc, queryService).size() == 0) {
return false;
}
// Check that the feature is of the appropriate type
if (!(feature instanceof Port || feature instanceof Parameter || feature instanceof DataAccess || feature instanceof FeatureGroup || feature instanceof AbstractFeature)) {
return false;
}
// If it is a direct feature, it must have the specified direction or be an in out feature. Take into account feature group, inverse, etc..
if (feature instanceof DirectedFeature) {
// Determine the actual direction of the feature. Since it could effected by things like inverse feature groups, etc
final DirectedFeature df = (DirectedFeature) feature;
DirectionType direction = df.getDirection();
if (direction == DirectionType.IN || direction == DirectionType.OUT) {
if (AadlFeatureUtil.isFeatureInverted(featureBoc)) {
direction = (direction == DirectionType.IN) ? DirectionType.OUT : DirectionType.IN;
}
}
if (direction != requiredDirection && direction != DirectionType.IN_OUT) {
return false;
}
}
return true;
}
Aggregations