use of org.osate.ba.aadlba.FeaturePrototypeHolder in project osate2 by osate.
the class AadlBaUtils method getAccessRight.
/**
* If the given Target object is a DataAccessHolder object or a
* DataComponentReference object which the last element is a DataAccessHolder
* object, it returns the data access right or "unknown" if the default
* data access right is not set.
*
* @see org.osate.utils.internal.Aadl2Utils#getAccessRight
* @param tar the given Target object
* @return the data access right or "unknown"
*/
public static String getAccessRight(Target tar) {
ElementHolder el = null;
if (// The other ElementHolders.
tar instanceof ElementHolder) {
el = (ElementHolder) tar;
} else // Data component reference.
{
EList<DataHolder> dhl = ((DataComponentReference) tar).getData();
el = dhl.get(dhl.size() - 1);
}
if (el instanceof DataAccessHolder || el instanceof DataAccessPrototypeHolder || el instanceof FeaturePrototypeHolder) {
return Aadl2Utils.getAccessRight(el.getElement());
} else {
return "unknown";
}
}
use of org.osate.ba.aadlba.FeaturePrototypeHolder in project osate2 by osate.
the class AadlBaParserVisitor method cloneHolder.
private ElementHolder cloneHolder(ElementHolder sourceElementHolder) {
ElementHolder targetElementHolder = null;
if (sourceElementHolder instanceof ClassifierFeatureHolder) {
ClassifierFeatureHolder sourceCfh = (ClassifierFeatureHolder) sourceElementHolder;
if (sourceElementHolder instanceof BehaviorVariableHolder) {
// BehaviorVariableHolder
targetElementHolder = _baFact.createBehaviorVariableHolder();
} else if (sourceElementHolder instanceof FeatureHolder) {
FeatureHolder sourceFeatureHolder = (FeatureHolder) sourceElementHolder;
// FeatureHolder
if (sourceFeatureHolder instanceof DataAccessHolder) {
// DataAccessHolder
targetElementHolder = _baFact.createDataAccessHolder();
} else if (sourceFeatureHolder instanceof ParameterHolder) {
// ParameterHolder
targetElementHolder = _baFact.createParameterHolder();
} else if (sourceFeatureHolder instanceof DataPortHolder) {
targetElementHolder = _baFact.createDataPortHolder();
} else if (sourceFeatureHolder instanceof EventDataPortHolder) {
targetElementHolder = _baFact.createEventDataPortHolder();
} else if (sourceFeatureHolder instanceof EventPortHolder) {
targetElementHolder = _baFact.createEventPortHolder();
} else if (sourceFeatureHolder instanceof SubprogramAccessHolder) {
targetElementHolder = _baFact.createSubprogramAccessHolder();
}
} else // PrototypeHolder
if (sourceElementHolder instanceof PrototypeHolder) {
// DataAccessPrototypeHolder
if (sourceElementHolder instanceof DataAccessPrototypeHolder) {
targetElementHolder = _baFact.createDataAccessPrototypeHolder();
} else if (sourceElementHolder instanceof FeaturePrototypeHolder) {
targetElementHolder = _baFact.createFeaturePrototypeHolder();
} else if (sourceElementHolder instanceof PortPrototypeHolder) {
targetElementHolder = _baFact.createPortPrototypeHolder();
} else if (sourceElementHolder instanceof SubprogramPrototypeHolder) {
targetElementHolder = _baFact.createSubprogramPrototypeHolder();
}
} else // SubcomponentHolder
if (sourceElementHolder instanceof SubcomponentHolder) {
// DataSubcomponentHolder
if (sourceElementHolder instanceof DataSubcomponentHolder) {
targetElementHolder = _baFact.createDataSubcomponentHolder();
} else if (sourceElementHolder instanceof SubprogramSubcomponentHolder) {
targetElementHolder = _baFact.createSubprogramSubcomponentHolder();
}
}
ClassifierFeatureHolder targetCfh = (ClassifierFeatureHolder) targetElementHolder;
targetCfh.setClassifierFeature(sourceCfh.getClassifierFeature());
}
if (targetElementHolder != null) {
targetElementHolder.setElement(sourceElementHolder.getElement());
}
return targetElementHolder;
}
Aggregations