use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class TypeExtensionImpl method setExtended.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExtended(ComponentType newExtended) {
ComponentType oldExtended = extended;
extended = newExtended;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.TYPE_EXTENSION__EXTENDED, oldExtended, extended));
}
}
use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class ModeImpl method getPropertyValueInternal.
// Cannot make this final because I need to override in SystemOperationMode
public void getPropertyValueInternal(final Property prop, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
final Classifier owner = getContainingClassifier();
final boolean inType = (owner instanceof ComponentType);
// local contained value
if (!inType && !fromInstanceSlaveCall) {
// owner could be null if we are looking up a property on a SystemOperationMode, which does not have a containing classifier.
if (owner != null && pas.addLocalContained(this, owner)) {
if (!all) {
return;
}
}
}
// local value
if (pas.addLocal(this)) {
if (!all) {
return;
}
}
// not an implementation
if ((inType || !inType && !fromInstanceSlaveCall) && prop.isInherit()) {
if (owner != null) {
owner.getPropertyValueInternal(prop, pas, fromInstanceSlaveCall, all);
} else {
throw new InvalidModelException(this, "Mode is not contained in a component type or implementation");
}
}
}
use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class AnnexHandler method getAnnexSubclauseIndex.
/**
* Returns a 0 based index for referencing an annex subclause in a list that contains only annex subclauses with the same type and owner
* @return
*/
public static int getAnnexSubclauseIndex(AnnexSubclause annexSubclause, final boolean useExtended) {
// Get the default annex library if a parsed annex subclause was specified. This is needed for the comparison later in the function.
if (!(annexSubclause instanceof DefaultAnnexSubclause)) {
if (annexSubclause.eContainer() instanceof DefaultAnnexSubclause) {
annexSubclause = (AnnexSubclause) annexSubclause.eContainer();
} else {
return -1;
}
}
final String annexName = annexSubclause.getName();
if (annexName == null) {
return -1;
}
final Classifier cl = annexSubclause.getContainingClassifier();
final List<Classifier> classifiers;
if (useExtended) {
classifiers = cl.getSelfPlusAllExtended();
// Get all related classifiers
if (cl instanceof ComponentImplementation) {
final ComponentType ct = ((ComponentImplementation) cl).getType();
if (ct != null) {
classifiers.addAll(ct.getSelfPlusAllExtended());
}
}
} else {
classifiers = Arrays.asList(cl);
}
int index = 0;
// Use reversed view of list so that base classifiers will be first. This is needed to ensure subclauses have unique indices
for (final Classifier tmpClassifier : Lists.reverse(classifiers)) {
for (final AnnexSubclause tmpSubclause : tmpClassifier.getOwnedAnnexSubclauses()) {
if (tmpSubclause == annexSubclause) {
return index;
} else if (annexName.equalsIgnoreCase(tmpSubclause.getName())) {
index++;
}
}
}
return -1;
}
use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class AgeRenameParticipant method getDependentObjects.
private static Set<EObject> getDependentObjects(final EObject obj, final ResourceSet rs, final Map<URI, Set<URI>> externalReferencesMap) {
final Set<EObject> results = new HashSet<>();
final EObject objectOfInterest;
// is the only known way of getting types related to the renames.
if (obj instanceof ComponentTypeRename) {
final ComponentType renamedComponentType = ((ComponentTypeRename) obj).getRenamedComponentType();
objectOfInterest = renamedComponentType == null ? null : renamedComponentType;
} else {
objectOfInterest = obj;
}
if (objectOfInterest != null) {
getRelatedObjects(Collections.singleton(objectOfInterest), rs, results, externalReferencesMap, obj instanceof Feature);
}
return results;
}
use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class ClassifierCreationHelper method buildName.
public String buildName(final ClassifierOperationPartType primaryType, final Supplier<AadlPackage> primaryPkgSupplier, final String identifier, final ClassifierOperationPart basePart) {
final String newName;
if (primaryType == ClassifierOperationPartType.NEW_COMPONENT_IMPLEMENTATION) {
if (basePart == null) {
throw new RuntimeException("Base operation in invalid");
}
final AadlPackage primaryPkg = primaryPkgSupplier.get();
final PackageSection section = primaryPkg.getPublicSection();
// Determine details about the type specified by the base operation part.
final String baseTypeName;
final AadlPackage typePackage;
// Get the name of the type and the package in which it is contained.
if (ClassifierOperationPartType.isCreate(basePart.getType())) {
typePackage = getResolvedPackage(basePart.getSelectedPackage());
baseTypeName = basePart.getIdentifier();
} else if (basePart.getType() == ClassifierOperationPartType.EXISTING) {
final Classifier classifier = getResolvedClassifier(basePart.getSelectedClassifier());
final ComponentType ct = getResolvedComponentType(classifier);
if (ct == null) {
return null;
}
typePackage = getPackage(ct);
baseTypeName = ct.getName();
} else {
throw new RuntimeException("Invalid base operation part: " + basePart.getType());
}
// Handle type not being in same package as implementation
final boolean samePackage = AadlNameUtil.namesAreEqual(primaryPkg, typePackage);
final String localBaseTypeName = samePackage ? baseTypeName : getRenamedType(section, typePackage, baseTypeName).aliasName;
newName = localBaseTypeName + "." + identifier;
} else {
newName = identifier;
}
return newName;
}
Aggregations