Search in sources :

Example 1 with Classifier

use of org.osate.aadl2.Classifier in project alisa-examples by osate.

the class ModelVerifications method sameVoltage.

public static boolean sameVoltage(ComponentInstance ci) {
    EList<FeatureInstance> inlets = new BasicEList<FeatureInstance>();
    for (FeatureInstance fi : ci.getAllFeatureInstances(FeatureCategory.ABSTRACT_FEATURE)) {
        Classifier cl = fi.getFeature().getAllClassifier();
        if (cl.getName().equalsIgnoreCase("power")) {
            inlets.add(fi);
        }
    }
    if (inlets.size() == 2) {
        double v1 = getVoltage(inlets.get(0));
        double v2 = getVoltage(inlets.get(1));
        return v1 == v2;
    }
    return false;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier)

Example 2 with Classifier

use of org.osate.aadl2.Classifier in project alisa-examples by osate.

the class ModelVerifications method samePowerBudget.

public static boolean samePowerBudget(ComponentInstance ci) {
    EList<FeatureInstance> inlets = new BasicEList<FeatureInstance>();
    for (FeatureInstance fi : ci.getAllFeatureInstances(FeatureCategory.ABSTRACT_FEATURE)) {
        Classifier cl = fi.getFeature().getAllClassifier();
        if (cl.getName().equalsIgnoreCase("power")) {
            inlets.add(fi);
        }
    }
    if (inlets.size() == 2) {
        double pb1 = GetProperties.getPowerBudget(inlets.get(0), 0.0);
        double pb2 = GetProperties.getPowerBudget(inlets.get(1), 0.0);
        return pb1 == pb2;
    }
    return false;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier)

Aggregations

BasicEList (org.eclipse.emf.common.util.BasicEList)2 Classifier (org.osate.aadl2.Classifier)2 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)2