Search in sources :

Example 71 with Feature

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;
}
Also used : ComponentType(org.osate.aadl2.ComponentType) EObject(org.eclipse.emf.ecore.EObject) ComponentTypeRename(org.osate.aadl2.ComponentTypeRename) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) Feature(org.osate.aadl2.Feature) HashSet(java.util.HashSet)

Example 72 with Feature

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;
}
Also used : FeatureGroupType(org.osate.aadl2.FeatureGroupType) Feature(org.osate.aadl2.Feature)

Example 73 with Feature

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());
        }
    });
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) SubprogramProxy(org.osate.aadl2.SubprogramProxy) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) PortProxy(org.osate.aadl2.PortProxy) InternalFeature(org.osate.aadl2.InternalFeature) FeatureGroupType(org.osate.aadl2.FeatureGroupType) Label(org.eclipse.swt.widgets.Label) ProcessorFeature(org.osate.aadl2.ProcessorFeature) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) ProcessorFeature(org.osate.aadl2.ProcessorFeature) Feature(org.osate.aadl2.Feature) InternalFeature(org.osate.aadl2.InternalFeature) EventDataSource(org.osate.aadl2.EventDataSource)

Example 74 with Feature

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;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) BasicEList(org.eclipse.emf.common.util.BasicEList) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) NamedElement(org.osate.aadl2.NamedElement) Feature(org.osate.aadl2.Feature)

Example 75 with Feature

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;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) DataSubcomponent(org.osate.aadl2.DataSubcomponent) DataSubcomponent(org.osate.aadl2.DataSubcomponent) Subcomponent(org.osate.aadl2.Subcomponent) FeatureGroupType(org.osate.aadl2.FeatureGroupType) DataImplementation(org.osate.aadl2.DataImplementation) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) Feature(org.osate.aadl2.Feature)

Aggregations

Feature (org.osate.aadl2.Feature)82 ArrayList (java.util.ArrayList)78 Feature (com.google.cloud.vision.v1.Feature)72 AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)69 Image (com.google.cloud.vision.v1.Image)69 BatchAnnotateImagesResponse (com.google.cloud.vision.v1.BatchAnnotateImagesResponse)66 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)66 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)63 ByteString (com.google.protobuf.ByteString)47 ImageSource (com.google.cloud.vision.v1.ImageSource)38 FileInputStream (java.io.FileInputStream)30 Subcomponent (org.osate.aadl2.Subcomponent)29 EntityAnnotation (com.google.cloud.vision.v1.EntityAnnotation)27 Classifier (org.osate.aadl2.Classifier)27 WebImage (com.google.cloud.vision.v1.WebDetection.WebImage)26 ComponentClassifier (org.osate.aadl2.ComponentClassifier)22 NamedElement (org.osate.aadl2.NamedElement)22 FeatureGroup (org.osate.aadl2.FeatureGroup)18 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)17 FeatureGroupType (org.osate.aadl2.FeatureGroupType)16