use of com.google.cloud.vision.v1p3beta1.Feature in project osate2 by osate.
the class ResolvePrototypeUtil method resolvePrototypeInContainmentPath.
public static PrototypeBinding resolvePrototypeInContainmentPath(Prototype proto, ContainmentPathElement cpe) {
if (cpe.getNamedElement() instanceof Subcomponent) {
PrototypeBinding res = resolvePrototype(proto, AadlUtil.getContainingClassifier(cpe.getNamedElement()));
if (res != null) {
return res;
}
}
ContainmentPathElement previous = getPrevious(cpe);
if (previous != null) {
// find prototype binding in namespace of previous element
NamedElement ne = previous.getNamedElement();
if (ne instanceof Subcomponent) {
// look for prototype in prototype binding of subcomponent declaration
PrototypeBinding res = resolvePrototype(proto, ne);
if (res != null) {
return res;
} else {
Subcomponent subcomponent = (Subcomponent) ne;
while (subcomponent.getSubcomponentType() == null && subcomponent.getRefined() != null) {
subcomponent = subcomponent.getRefined();
}
ComponentClassifier subcomponentClassifier = null;
if (subcomponent.getSubcomponentType() instanceof ComponentClassifier) {
subcomponentClassifier = (ComponentClassifier) subcomponent.getSubcomponentType();
} else if (subcomponent.getSubcomponentType() instanceof ComponentPrototype) {
subcomponentClassifier = resolveComponentPrototype((ComponentPrototype) subcomponent.getSubcomponentType(), previous);
}
if (subcomponentClassifier != null) {
return resolvePrototype(proto, subcomponentClassifier);
}
}
} else if (ne instanceof FeatureGroup) {
FeatureGroup fg = (FeatureGroup) ne;
while (fg.getFeatureType() == null && fg.getRefined() instanceof FeatureGroup) {
fg = (FeatureGroup) fg.getRefined();
}
FeatureGroupType fgt = null;
if (fg.getFeatureType() instanceof FeatureGroupType) {
fgt = (FeatureGroupType) fg.getFeatureType();
} else if (fg.getFeatureType() instanceof FeatureGroupPrototype) {
fgt = resolveFeatureGroupPrototype((FeatureGroupPrototype) fg.getFeatureType(), previous);
}
if (fgt != null) {
return resolvePrototype(proto, fgt);
}
} else if (ne instanceof Feature) {
}
} else {
// the context is the entity with the property association
// need to make sure we look in the correct name space
Classifier cl = null;
if (AadlUtil.getContainingSubcomponent(cpe) != null) {
Subcomponent containingSubcomponent = AadlUtil.getContainingSubcomponent(cpe);
PrototypeBinding res = resolvePrototype(proto, containingSubcomponent);
if (res != null) {
return res;
}
while (containingSubcomponent.getSubcomponentType() == null && containingSubcomponent.getRefined() != null) {
containingSubcomponent = containingSubcomponent.getRefined();
}
if (containingSubcomponent.getSubcomponentType() instanceof ComponentClassifier) {
cl = (ComponentClassifier) containingSubcomponent.getSubcomponentType();
} else if (containingSubcomponent.getSubcomponentType() instanceof ComponentPrototype) {
cl = resolveComponentPrototype((ComponentPrototype) containingSubcomponent.getSubcomponentType(), AadlUtil.getContainingClassifier(cpe));
}
} else if (AadlUtil.getContainingFeatureGroup(cpe) != null) {
FeatureGroup containingFeatureGroup = AadlUtil.getContainingFeatureGroup(cpe);
FeatureGroupType typeForContainingFeatureGroup = null;
while (containingFeatureGroup.getFeatureType() == null && containingFeatureGroup.getRefined() instanceof FeatureGroup) {
containingFeatureGroup = (FeatureGroup) containingFeatureGroup.getRefined();
}
if (containingFeatureGroup.getFeatureType() instanceof FeatureGroupType) {
typeForContainingFeatureGroup = (FeatureGroupType) containingFeatureGroup.getFeatureType();
} else if (containingFeatureGroup.getFeatureType() instanceof FeatureGroupPrototype) {
typeForContainingFeatureGroup = resolveFeatureGroupPrototype((FeatureGroupPrototype) containingFeatureGroup.getFeatureType(), AadlUtil.getContainingClassifier(cpe));
}
if (typeForContainingFeatureGroup != null) {
PrototypeBinding res = resolvePrototype(proto, typeForContainingFeatureGroup);
if (res != null) {
return res;
}
}
} else {
cl = AadlUtil.getContainingClassifier(cpe);
}
PrototypeBinding res = resolvePrototype(proto, cl);
return res;
}
return null;
}
use of com.google.cloud.vision.v1p3beta1.Feature in project osate2 by osate.
the class AadlUtil method getMultiplicity.
/*
* return the size of an arrayed named element.
* Find the array dimensions in the element or the element it refines.
*/
public static long getMultiplicity(NamedElement el) {
if (!(el instanceof ArrayableElement)) {
return 1;
}
ArrayableElement ae = (ArrayableElement) el;
EList<ArrayDimension> dims = ae.getArrayDimensions();
if (!dims.isEmpty()) {
return calcSize(dims);
} else {
if (el instanceof Subcomponent) {
Subcomponent sub = (Subcomponent) el;
EList<Subcomponent> subs = sub.getAllSubcomponentRefinements();
for (Subcomponent subcomponent : subs) {
dims = subcomponent.getArrayDimensions();
if (!dims.isEmpty()) {
return calcSize(dims);
}
}
} else if (el instanceof Feature) {
Feature fe = (Feature) el;
EList<Feature> feas = fe.getAllFeatureRefinements();
for (Feature feature : feas) {
dims = feature.getArrayDimensions();
if (!dims.isEmpty()) {
return calcSize(dims);
}
}
}
}
return 1;
}
use of com.google.cloud.vision.v1p3beta1.Feature in project osate2 by osate.
the class AadlUtil method hasOutgoingFeatureSubcomponents.
/**
* determine whether a component instance has subcomponents that can have
* outgoing connections
*
* @param subcompinstances list of sub component instances
*/
public static boolean hasOutgoingFeatureSubcomponents(EList<? extends ComponentInstance> subcompinstances) {
for (ComponentInstance o : subcompinstances) {
EList<FeatureInstance> filist = o.getFeatureInstances();
for (FeatureInstance fi : filist) {
Feature f = fi.getFeature();
if (isOutgoingFeature(f)) {
return true;
}
}
// subcomponent can be access source
ComponentCategory cat = o.getCategory();
if (cat == DATA || cat == BUS || cat == VIRTUAL_BUS || cat == SUBPROGRAM || cat == SUBPROGRAM_GROUP) {
return true;
}
}
return false;
}
use of com.google.cloud.vision.v1p3beta1.Feature in project osate2 by osate.
the class ComponentTypeImpl method getAllFeatures.
/**
* get list of all features of a component type, including ancestor features
* In case of refined features the refined feature is returned.
*
* @return List of feature objects
*/
// XXX: [AADL 1 -> AADL 2] Added to make instantiation work.
public EList<Feature> getAllFeatures() {
final EList<Classifier> ancestors = getSelfPlusAllExtended();
final BasicEList<Feature> returnlist = new BasicEList<Feature>();
// Process from farthest ancestor to self
for (ListIterator<Classifier> li = ancestors.listIterator(ancestors.size()); li.hasPrevious(); ) {
final ComponentType current = (ComponentType) li.previous();
final EList<Feature> currentFeatures = current.getOwnedFeatures();
if (currentFeatures != null) {
for (Iterator<Feature> i = currentFeatures.iterator(); i.hasNext(); ) {
final Feature fe = i.next();
final Feature rfe = fe.getRefined();
if (rfe != null) {
returnlist.remove(rfe);
}
returnlist.add(fe);
}
}
}
return returnlist;
}
use of com.google.cloud.vision.v1p3beta1.Feature in project osate2 by osate.
the class FeatureImpl method setRefined.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRefined(Feature newRefined) {
Feature oldRefined = refined;
refined = newRefined;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.FEATURE__REFINED, oldRefined, refined));
}
}
Aggregations