use of com.google.cloud.vision.v1p4beta1.Feature 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 com.google.cloud.vision.v1p4beta1.Feature in project osate2 by osate.
the class AadlFeatureUtil method getAllFeatures.
public static EList<Feature> getAllFeatures(final FeatureGroupType fgt) {
final EList<Feature> owned = getAllOwnedFeatures(fgt);
final FeatureGroupType inverseFgt = fgt.getInverse();
if (owned.isEmpty() && !Aadl2Util.isNull(inverseFgt)) {
return getAllOwnedFeatures(inverseFgt);
}
return owned;
}
use of com.google.cloud.vision.v1p4beta1.Feature in project osate2 by osate.
the class FeatureInstanceTooltipContributor method addTooltipContents.
@Override
public void addTooltipContents(final TooltipContributorContext ctx) {
ctx.getBusinessObjectContext().getBusinessObject(FeatureInstance.class).ifPresent(featureInstance -> {
final Feature feature = featureInstance.getFeature();
if (feature instanceof Feature || feature instanceof InternalFeature || feature instanceof ProcessorFeature) {
// Determine the feature classifier
final Classifier featureClassifier;
if (feature instanceof EventDataSource) {
final EventDataSource aadlFeature = (EventDataSource) feature;
featureClassifier = aadlFeature.getDataClassifier();
} else if (feature instanceof PortProxy) {
final PortProxy aadlFeature = (PortProxy) feature;
featureClassifier = aadlFeature.getDataClassifier();
} else if (feature instanceof SubprogramProxy) {
final SubprogramProxy aadlFeature = (SubprogramProxy) feature;
featureClassifier = aadlFeature.getSubprogramClassifier();
} else if (feature instanceof Feature) {
final Feature aadlFeature = (Feature) feature;
featureClassifier = aadlFeature.getAllClassifier();
} else {
featureClassifier = null;
}
// Build the text to contribute to the tooltip
final StringBuffer tooltipContents = new StringBuffer();
if (featureClassifier instanceof ComponentClassifier) {
tooltipContents.append(((ComponentClassifier) featureClassifier).getCategory() + " " + featureClassifier.getQualifiedName());
} else if (featureClassifier instanceof FeatureGroupType) {
tooltipContents.append("feature group " + featureClassifier.getQualifiedName());
} else if (featureClassifier == null) {
tooltipContents.append("No Classifier");
} else {
tooltipContents.append(featureClassifier.getQualifiedName());
}
// Create the styled text describing the feature
final Label lbl = new Label(ctx.getTooltip(), SWT.NONE);
lbl.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
lbl.setText(tooltipContents.toString());
}
});
}
use of com.google.cloud.vision.v1p4beta1.Feature in project osate2 by osate.
the class AnalysisModel method getAllPropagationDestinationEnds.
/**
* return all feature (or for access component) instances that are the
* connection destination of the given feature instance The source and
* destinations are assumed to be components with error models
*
* @param fi
* @return list of ConnectionInstanceEnd
*/
public EList<ConnectionInstanceEnd> getAllPropagationDestinationEnds(ConnectionInstanceEnd fi) {
EList<ConnectionInstanceEnd> result = new BasicEList<ConnectionInstanceEnd>();
NamedElement f = null;
if (fi instanceof FeatureInstance) {
f = ((FeatureInstance) fi).getFeature();
} else {
f = ((ComponentInstance) fi).getSubcomponent();
}
for (PropagationPathRecord propagationPathRecord : propagationPaths) {
PropagationPathEnd src = propagationPathRecord.getPathSrc();
ErrorPropagation ep = src.getErrorPropagation();
Feature srcf = EMV2Util.getFeature(ep);
if (srcf != null && srcf == f) {
PropagationPathEnd dst = propagationPathRecord.pathDst;
ErrorPropagation dstep = dst.getErrorPropagation();
if (dstep != null) {
Feature dstf = EMV2Util.getFeature(dstep);
ComponentInstance dstCI = dst.getComponentInstance();
if (dstf != null) {
FeatureInstance dstfi = dstCI.findFeatureInstance(dstf);
result.add(dstfi);
} else if (EMV2Util.isAccess(dstep)) {
result.add(dstCI);
}
}
}
}
return result;
}
use of com.google.cloud.vision.v1p4beta1.Feature in project osate2 by osate.
the class GetProperties method sumElementsDataSize.
private static double sumElementsDataSize(final NamedElement ne, UnitLiteral unit, Property DataSize, Property SourceDataSize, int nesting) {
double res = 0.0;
Classifier cl = null;
if (ne instanceof Classifier) {
cl = (Classifier) ne;
} else if (ne instanceof FeatureInstance) {
cl = ((FeatureInstance) ne).getFeature().getAllClassifier();
} else if (ne instanceof Feature) {
cl = ((Feature) ne).getClassifier();
} else if (ne instanceof DataSubcomponent) {
cl = ((DataSubcomponent) ne).getClassifier();
}
if (cl != null) {
if (cl instanceof FeatureGroupType) {
EList<Feature> fl = ((FeatureGroupType) cl).getAllFeatures();
for (Feature f : fl) {
res = res + getDataSize(f, unit, DataSize, SourceDataSize, nesting);
}
} else if (cl instanceof DataImplementation) {
for (Subcomponent ds : ((DataImplementation) cl).getAllSubcomponents()) {
if (!AadlUtil.isSameOrExtends(cl, ds.getAllClassifier())) {
res = res + getDataSize(ds, unit, DataSize, SourceDataSize, nesting);
}
}
}
}
return res;
}
Aggregations