Search in sources :

Example 1 with ListValue

use of org.osate.aadl2.ListValue in project AGREE by loonwerks.

the class MATLABFunctionHandler method setMatlabExportInfo.

private void setMatlabExportInfo(ComponentType ct, ModelInfo info) {
    ListValue lv = getOrCreateSourceText(ct);
    StringLiteral sl1 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
    sl1.setValue(savePathToAADLProperty(info.outputDirPath));
    StringLiteral sl2 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
    sl2.setValue(savePathToAADLProperty(info.implMdlPath));
    StringLiteral sl3 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
    sl3.setValue(savePathToAADLProperty(info.verifyMdlName));
    StringLiteral sl4 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
    sl4.setValue(savePathToAADLProperty(info.subsystemName));
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) ListValue(org.osate.aadl2.ListValue)

Example 2 with ListValue

use of org.osate.aadl2.ListValue in project AGREE by loonwerks.

the class AgreeAADLPropertyUtils method getPropertyList.

public static List<PropertyExpression> getPropertyList(NamedElement namedEl, String property) {
    List<PropertyExpression> els = new ArrayList<>();
    Property prop = Aadl2GlobalScopeUtil.get(namedEl, Aadl2Package.eINSTANCE.getProperty(), property);
    ListValue listExpr = (ListValue) PropertyUtils.getSimplePropertyListValue(namedEl, prop);
    for (PropertyExpression propExpr : listExpr.getOwnedListElements()) {
        els.add(propExpr);
    }
    return els;
}
Also used : ListValue(org.osate.aadl2.ListValue) ArrayList(java.util.ArrayList) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 3 with ListValue

use of org.osate.aadl2.ListValue in project cel-java by projectnessie.

the class ConformanceServiceImpl method refValueToValue.

// TODO(jimlarson): The following conversion code should be moved to
// common/types/provider.go and consolidated/refactored as appropriate.
// In particular, make judicious use of types.NativeToValue().
/**
 * RefValueToValue converts between ref.Val and Value. The ref.Val must not be error or unknown.
 */
static Value refValueToValue(Val res) {
    switch(res.type().typeEnum()) {
        case Bool:
            return Value.newBuilder().setBoolValue(res.booleanValue()).build();
        case Bytes:
            return Value.newBuilder().setBytesValue(res.convertToNative(ByteString.class)).build();
        case Double:
            return Value.newBuilder().setDoubleValue(res.convertToNative(Double.class)).build();
        case Int:
            return Value.newBuilder().setInt64Value(res.intValue()).build();
        case Null:
            return Value.newBuilder().setNullValueValue(0).build();
        case String:
            return Value.newBuilder().setStringValue(res.value().toString()).build();
        case Type:
            return Value.newBuilder().setTypeValue(((TypeT) res).typeName()).build();
        case Uint:
            return Value.newBuilder().setUint64Value(res.intValue()).build();
        case Duration:
            Duration d = res.convertToNative(Duration.class);
            return Value.newBuilder().setObjectValue(Any.pack(d)).build();
        case Timestamp:
            Timestamp t = res.convertToNative(Timestamp.class);
            return Value.newBuilder().setObjectValue(Any.pack(t)).build();
        case List:
            Lister l = (Lister) res;
            ListValue.Builder elts = ListValue.newBuilder();
            for (IteratorT i = l.iterator(); i.hasNext() == True; ) {
                Val v = i.next();
                elts.addValues(refValueToValue(v));
            }
            return Value.newBuilder().setListValue(elts).build();
        case Map:
            Mapper m = (Mapper) res;
            MapValue.Builder elems = MapValue.newBuilder();
            for (IteratorT i = m.iterator(); i.hasNext() == True; ) {
                Val k = i.next();
                Val v = m.get(k);
                Value kv = refValueToValue(k);
                Value vv = refValueToValue(v);
                elems.addEntriesBuilder().setKey(kv).setValue(vv);
            }
            return Value.newBuilder().setMapValue(elems).build();
        case Object:
            // Object type
            Message pb = (Message) res.value();
            Value.Builder v = Value.newBuilder();
            // Somehow the conformance tests
            if (pb instanceof ListValue) {
                v.setListValue((ListValue) pb);
            } else if (pb instanceof MapValue) {
                v.setMapValue((MapValue) pb);
            } else {
                v.setObjectValue(Any.pack(pb));
            }
            return v.build();
        default:
            throw new IllegalStateException(String.format("Unknown %s", res.type().typeEnum()));
    }
}
Also used : Val(org.projectnessie.cel.common.types.ref.Val) TypeT(org.projectnessie.cel.common.types.TypeT) Message(com.google.protobuf.Message) Lister(org.projectnessie.cel.common.types.traits.Lister) ListValue(com.google.api.expr.v1alpha1.ListValue) Duration(com.google.protobuf.Duration) MapValue(com.google.api.expr.v1alpha1.MapValue) Timestamp(com.google.protobuf.Timestamp) IteratorT(org.projectnessie.cel.common.types.IteratorT) Mapper(org.projectnessie.cel.common.types.traits.Mapper) MapValue(com.google.api.expr.v1alpha1.MapValue) Value(com.google.api.expr.v1alpha1.Value) ExprValue(com.google.api.expr.v1alpha1.ExprValue) ListValue(com.google.api.expr.v1alpha1.ListValue) TypeT.newObjectTypeValue(org.projectnessie.cel.common.types.TypeT.newObjectTypeValue)

Example 4 with ListValue

use of org.osate.aadl2.ListValue in project cel-java by projectnessie.

the class ConformanceServiceImpl method valueToRefValue.

/**
 * ValueToRefValue converts between exprpb.Value and ref.Val.
 */
static Val valueToRefValue(TypeAdapter adapter, Value v) {
    switch(v.getKindCase()) {
        case NULL_VALUE:
            return NullT.NullValue;
        case BOOL_VALUE:
            return boolOf(v.getBoolValue());
        case INT64_VALUE:
            return intOf(v.getInt64Value());
        case UINT64_VALUE:
            return uintOf(v.getUint64Value());
        case DOUBLE_VALUE:
            return doubleOf(v.getDoubleValue());
        case STRING_VALUE:
            return stringOf(v.getStringValue());
        case BYTES_VALUE:
            return bytesOf(v.getBytesValue().toByteArray());
        case OBJECT_VALUE:
            Any any = v.getObjectValue();
            return adapter.nativeToValue(any);
        case MAP_VALUE:
            MapValue m = v.getMapValue();
            Map<Val, Val> entries = new HashMap<>();
            for (Entry entry : m.getEntriesList()) {
                Val key = valueToRefValue(adapter, entry.getKey());
                Val pb = valueToRefValue(adapter, entry.getValue());
                entries.put(key, pb);
            }
            return adapter.nativeToValue(entries);
        case LIST_VALUE:
            ListValue l = v.getListValue();
            List<Val> elts = l.getValuesList().stream().map(el -> valueToRefValue(adapter, el)).collect(Collectors.toList());
            return adapter.nativeToValue(elts);
        case TYPE_VALUE:
            String typeName = v.getTypeValue();
            Type tv = Types.getTypeByName(typeName);
            if (tv != null) {
                return tv;
            }
            return newObjectTypeValue(typeName);
        default:
            throw new IllegalArgumentException("unknown value " + v.getKindCase());
    }
}
Also used : Val(org.projectnessie.cel.common.types.ref.Val) MapValue(com.google.api.expr.v1alpha1.MapValue) Lister(org.projectnessie.cel.common.types.traits.Lister) EnvOption.container(org.projectnessie.cel.EnvOption.container) CheckRequest(com.google.api.expr.v1alpha1.CheckRequest) Err(org.projectnessie.cel.common.types.Err) True(org.projectnessie.cel.common.types.BoolT.True) Err.isError(org.projectnessie.cel.common.types.Err.isError) Ast(org.projectnessie.cel.Ast) CheckResponse(com.google.api.expr.v1alpha1.CheckResponse) Map(java.util.Map) Value(com.google.api.expr.v1alpha1.Value) UnknownSet(com.google.api.expr.v1alpha1.UnknownSet) Val(org.projectnessie.cel.common.types.ref.Val) PrintWriter(java.io.PrintWriter) IteratorT(org.projectnessie.cel.common.types.IteratorT) DoubleT.doubleOf(org.projectnessie.cel.common.types.DoubleT.doubleOf) Status(com.google.rpc.Status) EnvOption.clearMacros(org.projectnessie.cel.EnvOption.clearMacros) StringT.stringOf(org.projectnessie.cel.common.types.StringT.stringOf) EnvOption(org.projectnessie.cel.EnvOption) ExprValue(com.google.api.expr.v1alpha1.ExprValue) Collectors(java.util.stream.Collectors) IntT.intOf(org.projectnessie.cel.common.types.IntT.intOf) UintT.uintOf(org.projectnessie.cel.common.types.UintT.uintOf) ByteString(com.google.protobuf.ByteString) List(java.util.List) ErrorSet(com.google.api.expr.v1alpha1.ErrorSet) UnknownT.unknownOf(org.projectnessie.cel.common.types.UnknownT.unknownOf) Type(org.projectnessie.cel.common.types.ref.Type) Any(com.google.protobuf.Any) EvalResult(org.projectnessie.cel.Program.EvalResult) ParseRequest(com.google.api.expr.v1alpha1.ParseRequest) Err.newErr(org.projectnessie.cel.common.types.Err.newErr) Env.newEnv(org.projectnessie.cel.Env.newEnv) Entry(com.google.api.expr.v1alpha1.MapValue.Entry) ParseResponse(com.google.api.expr.v1alpha1.ParseResponse) StdLib(org.projectnessie.cel.Library.StdLib) EnvOption.declarations(org.projectnessie.cel.EnvOption.declarations) ConformanceServiceImplBase(com.google.api.expr.v1alpha1.ConformanceServiceGrpc.ConformanceServiceImplBase) HashMap(java.util.HashMap) Timestamp(com.google.protobuf.Timestamp) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) AstIssuesTuple(org.projectnessie.cel.Env.AstIssuesTuple) Mapper(org.projectnessie.cel.common.types.traits.Mapper) Types(org.projectnessie.cel.common.types.Types) IssueDetails(com.google.api.expr.v1alpha1.IssueDetails) CEL.astToCheckedExpr(org.projectnessie.cel.CEL.astToCheckedExpr) EvalRequest(com.google.api.expr.v1alpha1.EvalRequest) Code(com.google.rpc.Code) StringWriter(java.io.StringWriter) EnvOption.types(org.projectnessie.cel.EnvOption.types) NullT(org.projectnessie.cel.common.types.NullT) Types.boolOf(org.projectnessie.cel.common.types.Types.boolOf) TypeAdapter(org.projectnessie.cel.common.types.ref.TypeAdapter) UnknownT.isUnknown(org.projectnessie.cel.common.types.UnknownT.isUnknown) ListValue(com.google.api.expr.v1alpha1.ListValue) CEL.parsedExprToAst(org.projectnessie.cel.CEL.parsedExprToAst) BytesT.bytesOf(org.projectnessie.cel.common.types.BytesT.bytesOf) CELError(org.projectnessie.cel.common.CELError) SourcePosition(com.google.api.expr.v1alpha1.SourcePosition) TypeT(org.projectnessie.cel.common.types.TypeT) Duration(com.google.protobuf.Duration) CEL.astToParsedExpr(org.projectnessie.cel.CEL.astToParsedExpr) CEL.checkedExprToAst(org.projectnessie.cel.CEL.checkedExprToAst) Program(org.projectnessie.cel.Program) EvalResponse(com.google.api.expr.v1alpha1.EvalResponse) TypeT.newObjectTypeValue(org.projectnessie.cel.common.types.TypeT.newObjectTypeValue) Message(com.google.protobuf.Message) Env(org.projectnessie.cel.Env) Env.newCustomEnv(org.projectnessie.cel.Env.newCustomEnv) Entry(com.google.api.expr.v1alpha1.MapValue.Entry) Type(org.projectnessie.cel.common.types.ref.Type) HashMap(java.util.HashMap) ListValue(com.google.api.expr.v1alpha1.ListValue) MapValue(com.google.api.expr.v1alpha1.MapValue) ByteString(com.google.protobuf.ByteString) Any(com.google.protobuf.Any)

Example 5 with ListValue

use of org.osate.aadl2.ListValue in project osate2 by osate.

the class Binpack method binPackSystem.

protected AssignmentResult binPackSystem(final SystemInstance root, Expansor expansor, LowLevelBinPacker packer, final AnalysisErrorReporterManager errManager, final SystemOperationMode som) {
    existsProcessorWithMIPS = false;
    existsProcessorWithoutMIPS = false;
    existsThreadWithReferenceProcessor = false;
    existsThreadWithoutReferenceProcessor = false;
    /*
		 * Map from AADL ComponentInstances representing threads to
		 * the bin packing SoftwareNode that models the thread.
		 */
    final Map<ComponentInstance, AADLThread> threadToSoftwareNode = new HashMap<>();
    /*
		 * Set of thread components. This is is the keySet of
		 * threadToSoftwareNode.
		 */
    final Set<ComponentInstance> threads = threadToSoftwareNode.keySet();
    /*
		 * Map from AADL ComponentInstances representing threads to
		 * the set of AADL ComponentInstances that cannot be collocated
		 * with it.
		 */
    final Map<ComponentInstance, Set<ComponentInstance>> notCollocated = new HashMap<>();
    /*
		 * Map from AADL ComponentInstance representing processors to
		 * the bin packing Processor that models them.
		 */
    final Map<ComponentInstance, AADLProcessor> procToHardware = new HashMap<>();
    /*
		 * Map from AADL BusInstance representing Buses to
		 * The bin packing Link that models them.
		 */
    final Map<ComponentInstance, AADLBus> busToHardware = new HashMap<>();
    /*
		 * One site to rule them all! We don't care about the site
		 * architecture, so just create one site to hold everything.
		 * We aren't worried about power or space issues either, so
		 * we just set them to 100.0 because those are nice values.
		 * The site accepts AADL processors.
		 */
    final SiteArchitecture siteArchitecture = new SiteArchitecture();
    AADLProcessor ap = AADLProcessor.PROTOTYPE;
    final Site theSite = new Site(100.0, 100.0, new SiteGuest[] { ap });
    siteArchitecture.addSite(theSite);
    /*
		 * The hardware is fixed based on the AADL specification, so we
		 * use the NoExpansionExpansor to keep the hardware from being
		 * generated for us.
		 */
    expansor.setSiteArchitecture(siteArchitecture);
    /*
		 * Populate the problem space based on the AADL specification. First
		 * we walk the instance model and add all the processors. Then we
		 * walk the instance model again to add all the threads.
		 */
    OutDegreeAssignmentProblem problem1 = new OutDegreeAssignmentProblem(new OutDegreeComparator(), new BandwidthComparator(), new CapacityComparator());
    problem1.setErrorReporter(new BinPackErrorReporter());
    final OutDegreeAssignmentProblem problem = problem1;
    // Add procs
    final ForAllElement addProcessors = new ForAllElement(errManager) {

        @Override
        public void process(Element obj) {
            ComponentInstance ci = (ComponentInstance) obj;
            // the createInstance method already assigns a default MIPS if none exists
            double mips = GetProperties.getProcessorMIPS(ci);
            // checking consistency;
            existsProcessorWithMIPS |= (mips != 0);
            existsProcessorWithoutMIPS |= (mips == 0);
            final AADLProcessor proc = AADLProcessor.createInstance(ci);
            if (proc != null) {
                System.out.println("Processor cycles Per sec:" + proc.getCyclesPerSecond());
                siteArchitecture.addSiteGuest(proc, theSite);
                problem.getHardwareGraph().add(proc);
                // add reverse mapping
                procToHardware.put(ci, proc);
            }
        }
    };
    addProcessors.processPreOrderComponentInstance(root, ComponentCategory.PROCESSOR);
    /*
		 * Get all the links
		 */
    final ForAllElement addBuses = new ForAllElement(errManager) {

        @Override
        public void process(Element obj) {
            ComponentInstance bi = (ComponentInstance) obj;
            final AADLBus bus = AADLBus.createInstance(bi);
            busToHardware.put(bi, bus);
        }
    };
    addBuses.processPreOrderComponentInstance(root, ComponentCategory.BUS);
    /*
		 * create the links between processors and busses
		 * (i.e., process connections)
		 */
    for (final Iterator<ConnectionInstance> i = root.getAllConnectionInstances().iterator(); i.hasNext(); ) {
        final ConnectionInstance connInst = i.next();
        if (connInst.getKind() == ConnectionKind.ACCESS_CONNECTION) {
            InstanceObject src = connInst.getSource();
            InstanceObject dst = connInst.getDestination();
            AADLBus bus = null;
            AADLProcessor processor = null;
            // swap if i got them in the opposite order
            if (src instanceof FeatureInstance) {
                InstanceObject tmp = dst;
                dst = src;
                src = tmp;
            }
            bus = busToHardware.get(src);
            FeatureInstance fi = (FeatureInstance) dst;
            processor = procToHardware.get(fi.getContainingComponentInstance());
            if (bus != null && processor != null) {
                bus.add(processor);
                processor.attachToLink(bus);
            }
        }
    }
    for (Iterator<AADLBus> iBus = busToHardware.values().iterator(); iBus.hasNext(); ) {
        AADLBus bus = iBus.next();
        problem.addLink(bus);
        siteArchitecture.addSiteGuest(bus, theSite);
    }
    // Add threads
    final ForAllElement addThreads = new ForAllElement(errManager) {

        @Override
        public void process(Element obj) {
            final ComponentInstance ci = (ComponentInstance) obj;
            /**
             * JD - check the modes according to what was
             * suggested by Dave.
             */
            boolean selected = true;
            if (som.getCurrentModes().size() > 0) {
                selected = false;
                for (ModeInstance mi : ci.getInModes()) {
                    if (mi == som.getCurrentModes().get(0)) {
                        selected = true;
                    }
                }
            }
            if (!selected) {
                return;
            }
            final AADLThread thread = AADLThread.createInstance(ci);
            double refmips = GetProperties.getReferenceMIPS(ci);
            // validate consistency
            existsThreadWithReferenceProcessor |= (refmips != 0);
            existsThreadWithoutReferenceProcessor |= (refmips == 0);
            problem.getSoftwareGraph().add(thread);
            // logInfo(thread.getReport());
            // add reverse mapping
            threadToSoftwareNode.put(ci, thread);
            // Process NOT_COLLOCATED property.
            RecordValue disjunctFrom = GetProperties.getNotCollocated(ci);
            if (disjunctFrom == null) {
                return;
            }
            final Set<ComponentInstance> disjunctSet = new HashSet<>();
            ListValue tvl = (ListValue) PropertyUtils.getRecordFieldValue(disjunctFrom, "Targets");
            for (PropertyExpression ref : tvl.getOwnedListElements()) {
                /*
					 * Add all the instances rooted at the named instance.
					 * For example, the thread may be declared to be disjunct
					 * from another process, so we really want to be disjunct
					 * from the other threads contained in that process.
					 */
                final InstanceReferenceValue rv = (InstanceReferenceValue) ref;
                final ComponentInstance refCI = (ComponentInstance) rv.getReferencedInstanceObject();
                disjunctSet.addAll(refCI.getAllComponentInstances());
            }
            if (!disjunctSet.isEmpty()) {
                notCollocated.put(ci, disjunctSet);
            }
        }
    };
    addThreads.processPreOrderComponentInstance(root, ComponentCategory.THREAD);
    // only some processors have mips
    if (existsProcessorWithMIPS && existsProcessorWithoutMIPS) {
        errManager.error(root, "Not all processors have MIPSCapacity");
        return null;
    }
    // only some threads with reference processor
    if (existsThreadWithReferenceProcessor && existsThreadWithoutReferenceProcessor) {
        errManager.error(root, "Not all threads have execution time reference processor");
        return null;
    }
    // threads and processors mips spec not consistent
    if (existsProcessorWithMIPS && existsThreadWithoutReferenceProcessor) {
        errManager.error(root, "There are some processors with MIPSCapacity but some threads without execution time reference processors");
        return null;
    }
    if (existsProcessorWithoutMIPS && existsThreadWithReferenceProcessor) {
        errManager.error(root, "There are some threads with execution time reference processors but not all processors have MIPSCapacity");
        return null;
    }
    // Add thread connections (Messages)
    for (final Iterator<ConnectionInstance> i = root.getAllConnectionInstances().iterator(); i.hasNext(); ) {
        final ConnectionInstance connInst = i.next();
        if (connInst.getKind() == ConnectionKind.PORT_CONNECTION) {
            if (!(connInst.getSource() instanceof FeatureInstance && connInst.getDestination() instanceof FeatureInstance)) {
                continue;
            }
            final FeatureInstance src = (FeatureInstance) connInst.getSource();
            final FeatureInstance dst = (FeatureInstance) connInst.getDestination();
            final ComponentInstance ci = src.getContainingComponentInstance();
            AADLThread t1 = threadToSoftwareNode.get(ci);
            AADLThread t2 = threadToSoftwareNode.get(dst.getContainingComponentInstance());
            if (t1 != null && t2 != null) {
                Feature srcAP = src.getFeature();
                // TODO: get the property directly
                Classifier cl = srcAP.getClassifier();
                if (cl instanceof DataClassifier) {
                    DataClassifier srcDC = (DataClassifier) cl;
                    double dataSize = 0.0;
                    double threadPeriod = 0.0;
                    try {
                        dataSize = AadlContribUtils.getDataSize(srcDC, SizeUnits.BYTES);
                    } catch (Exception e) {
                        errManager.warning(connInst, "No Data Size for connection");
                    }
                    try {
                        threadPeriod = GetProperties.getPeriodinNS(ci);
                    } catch (Exception e) {
                        errManager.warning(connInst, "No Period for connection");
                    }
                    // Now I can create the Message
                    Message msg = new Message((long) dataSize, (long) threadPeriod, (long) threadPeriod, t1, t2);
                    System.out.println(">>>>>>>>>> Adding message (" + Long.toString((long) dataSize) + "/" + Long.toString((long) threadPeriod) + ") between " + t1.getName() + " and " + t2.getName() + " based on connection " + connInst.getName());
                    problem.addMessage(msg);
                } else {
                    errManager.warning(connInst, "No Data Classifier for connection");
                }
            }
        }
    }
    // Add collocation constraints
    for (final Iterator<ComponentInstance> constrained = notCollocated.keySet().iterator(); constrained.hasNext(); ) {
        final ComponentInstance ci = constrained.next();
        final SoftwareNode sn = threadToSoftwareNode.get(ci);
        final Set<ComponentInstance> disjunctFrom = notCollocated.get(ci);
        for (final Iterator<ComponentInstance> dfIter = disjunctFrom.iterator(); dfIter.hasNext(); ) {
            /*
				 * Items in the disjunctFrom set do not have to be thread
				 * instances because of the way we add items to it (see above).
				 * We are only interested in the thread instances here, in
				 * particular because we only create SoftwareNodes for the
				 * thread instances, and we don't want to get null return
				 * values from the threadToSoftwareNode map.
				 */
            final ComponentInstance ci2 = dfIter.next();
            if (ci2.getCategory() == ComponentCategory.THREAD) {
                final SoftwareNode sn2 = threadToSoftwareNode.get(ci2);
                final SoftwareNode[] disjunction = new SoftwareNode[] { sn, sn2 };
                problem.addConstraint(new Disjoint(disjunction));
            }
        }
    }
    /*
		 * Add Allowed_Processor_Binding and
		 * Allowed_Processor_Binding_Class constraints
		 */
    for (final Iterator<ComponentInstance> i = threads.iterator(); i.hasNext(); ) {
        final ComponentInstance thr = i.next();
        final SoftwareNode thrSN = threadToSoftwareNode.get(thr);
        Collection<ComponentInstance> allowed = getActualProcessorBindings(thr);
        if (allowed.size() == 0) {
            allowed = getAllowedProcessorBindings(thr);
        }
        if (allowed.size() > 0) {
            final Object[] allowedProcs = new Object[allowed.size()];
            int idx = 0;
            for (Iterator<ComponentInstance> j = allowed.iterator(); j.hasNext(); idx++) {
                final ComponentInstance proc = j.next();
                allowedProcs[idx] = procToHardware.get(proc);
            }
            problem.addConstraint(new SetConstraint(new SoftwareNode[] { thrSN }, allowedProcs));
        }
    }
    // Try to bin pack
    final NFCHoBinPacker highPacker = new NFCHoBinPacker(packer);
    final boolean res = highPacker.solve(problem);
    return new AssignmentResult(problem, res);
}
Also used : HashMap(java.util.HashMap) SiteArchitecture(EAnalysis.BinPacking.SiteArchitecture) Feature(org.osate.aadl2.Feature) SetConstraint(EAnalysis.BinPacking.SetConstraint) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) NFCHoBinPacker(EAnalysis.BinPacking.NFCHoBinPacker) HashSet(java.util.HashSet) ListValue(org.osate.aadl2.ListValue) AssignmentResult(EAnalysis.BinPacking.AssignmentResult) InstanceObject(org.osate.aadl2.instance.InstanceObject) Site(EAnalysis.BinPacking.Site) ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ModeInstance(org.osate.aadl2.instance.ModeInstance) CapacityComparator(EAnalysis.BinPacking.CapacityComparator) Set(java.util.Set) HashSet(java.util.HashSet) Message(EAnalysis.BinPacking.Message) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) SoftwareNode(EAnalysis.BinPacking.SoftwareNode) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) NamedElement(org.osate.aadl2.NamedElement) Classifier(org.osate.aadl2.Classifier) SystemClassifier(org.osate.aadl2.SystemClassifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) DataClassifier(org.osate.aadl2.DataClassifier) ProcessorClassifier(org.osate.aadl2.ProcessorClassifier) DataClassifier(org.osate.aadl2.DataClassifier) InstanceObject(org.osate.aadl2.instance.InstanceObject) Disjoint(EAnalysis.BinPacking.Disjoint) PropertyExpression(org.osate.aadl2.PropertyExpression) RecordValue(org.osate.aadl2.RecordValue) InvalidModelException(org.osate.aadl2.properties.InvalidModelException) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) Disjoint(EAnalysis.BinPacking.Disjoint) SetConstraint(EAnalysis.BinPacking.SetConstraint) OutDegreeAssignmentProblem(EAnalysis.BinPacking.OutDegreeAssignmentProblem) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) BandwidthComparator(EAnalysis.BinPacking.BandwidthComparator) OutDegreeComparator(EAnalysis.BinPacking.OutDegreeComparator) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue)

Aggregations

ListValue (org.osate.aadl2.ListValue)100 PropertyExpression (org.osate.aadl2.PropertyExpression)85 Property (org.osate.aadl2.Property)63 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)51 ClassifierValue (org.osate.aadl2.ClassifierValue)28 StringLiteral (org.osate.aadl2.StringLiteral)23 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)22 PropertyAssociation (org.osate.aadl2.PropertyAssociation)21 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)20 InstanceReferenceValue (org.osate.aadl2.instance.InstanceReferenceValue)20 IntegerLiteral (org.osate.aadl2.IntegerLiteral)19 RecordValue (org.osate.aadl2.RecordValue)18 ReferenceValue (org.osate.aadl2.ReferenceValue)16 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)14 NamedValue (org.osate.aadl2.NamedValue)14 RangeValue (org.osate.aadl2.RangeValue)12 ArrayList (java.util.ArrayList)11 Classifier (org.osate.aadl2.Classifier)11 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)11 BasicProperty (org.osate.aadl2.BasicProperty)10