當前位置: 首頁>>代碼示例>>Java>>正文


Java RtVilStorage類代碼示例

本文整理匯總了Java中net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage的典型用法代碼示例。如果您正苦於以下問題:Java RtVilStorage類的具體用法?Java RtVilStorage怎麽用?Java RtVilStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RtVilStorage類屬於net.ssehub.easy.instantiation.rt.core.model.rtVil包,在下文中一共展示了RtVilStorage類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
/**
 * May be an event.
 */
public static void start() {
    Logging.setBack(Log4jLoggingBack.INSTANCE);
    RtVilStorage.setInstance(new RtVILMemoryStorage()); // TODO switch to QmRtVILStorageProvider
    try {
        AdaptationDispatcher dispatcher = new AdaptationDispatcher();
        endpoint = new ServerEndpoint(dispatcher, AdaptationConfiguration.getAdaptationPort(), authProvider);
        dispatcher.setAuthenticationCallback(endpoint);
        endpoint.start();
    } catch (IOException e) {
        e.printStackTrace();
    }
    timer = new Timer();
    AdaptationEventQueue.start();
    ReflectiveAdaptationManager.start(scheduler);
}
 
開發者ID:QualiMaster,項目名稱:Infrastructure,代碼行數:19,代碼來源:AdaptationManager.java

示例2: testPersistentVar

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
/**
 * Tests the basic functions of persistent variables.
 * 
 * @throws IOException should not occur
 */
@Test
public void testPersistentVar() throws IOException {
    final String scriptName = "persistentVar";
    final String varName = "global";
    
    RtVilStorage storage = new RtVILMemoryStorage();
    RtVilStorage.setInstance(storage);
    assertStorageEqual(null, storage, scriptName, varName);
    
    final String testName = "persistentVar";
    assertEqual(testName);
    assertStorageEqual(1, storage, scriptName, varName);
    
    // do the same game with different trace result that shall lead to different variable assignment
    Map<String, Object> param = createParameterMap(null, null, null);
    EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(testName), testName, null, 
        createTraceFile(testName + ".snd"), param);
    assertEqual(setup);
    
    assertStorageEqual(2, storage, scriptName, varName);

    RtVilStorage.setInstance(null);
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:29,代碼來源:ExecutionRtTests.java

示例3: register

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
/**
 * Registers the Java artifacts, instantiators and types.
 * 
 * @param jarLocations optional (authoritative) Jar locations to search separated by pathSeparator, 
 *   use <b>null</b> to ignore
 */
public static final void register(String jarLocations) {
    if (!registered) {
        registered = true;
        RtVilStorage.setStorageHint(true); // will provide storage at runtime -> AdaptationLayer internal
        RtVilTypeRegistry.setTypeAnalyzer(ANALYZER);
        TypeRegistry regSave = ReflectionResolver.setTypeRegistry(RtVilTypeRegistry.INSTANCE);

        List<Class<?>> toImport = new LinkedList<Class<?>>();
        if (null == jarLocations) {
            readClassList(toImport, loader, "");
            if (toImport.isEmpty()) { // maven without, Eclipse with resources...
                readClassList(toImport, loader, "resources/");    
            }
        }
        if (toImport.isEmpty()) {
            scanJars(toImport, jarLocations, loader);
            writeClassList(toImport);
        }
        
        ANALYZER.setImportingTypes(toImport);
        try {
            RtVilTypeRegistry.registerRtTypes(toImport);
        } catch (VilException e) {
            LOGGING.error("While registering " + e.getMessage(), e);
        }
        List<Class<?>> toPrint = new ArrayList<Class<?>>();
        toPrint.addAll(toImport);
        registerType(AlgorithmPredictionResult.class, toPrint);
        ReflectionResolver.setTypeRegistry(regSave);
        printClasses(toPrint);
    }
}
 
開發者ID:QualiMaster,項目名稱:QM-EASyProducer,代碼行數:39,代碼來源:Registration.java

示例4: processGlobalVariableDeclarations

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
@Override
protected void processGlobalVariableDeclarations(List<EObject> elts, Script result) {
    List<GlobalVariableDeclaration> decls = select(elts, GlobalVariableDeclaration.class);
    if (!decls.isEmpty()) {
        List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> tmp 
            = new ArrayList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration>();
        Set<String> persistent = new HashSet<String>();
        for (GlobalVariableDeclaration d : decls) {
            de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration vDecl = d.getVarDecl();
            if (null != vDecl) { // incremental xtext processing
                tmp.add(vDecl);
                if (null != vDecl.getName() && null != d.getPersistent()) {
                    persistent.add(vDecl.getName());
                    if (!RtVilStorage.hasStorage()) {
                        warning("the system to be adapted probably does not provide a storage for persistent "
                            + "variables, i.e., values may not be stored across different script runs (use of "
                            + "modifier is discouraged)", d, 
                            RtVilPackage.Literals.GLOBAL_VARIABLE_DECLARATION__PERSISTENT, ErrorCodes.DISCOURAGED);
                    }
                }
            }
        }
        processVariableDeclarations(tmp, result);
        for (int v = 0; v < result.getVariableDeclarationCount(); v++) {
            VariableDeclaration varDecl = result.getVariableDeclaration(v);
            if (persistent.contains(varDecl.getName())) {
                varDecl.addModifier(VariableDeclarationModifier.PERSISTENT);
            }
        }
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:32,代碼來源:ModelTranslator.java

示例5: assertStorageEqual

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
/**
 * Asserts the equality of a value in a rt-VIL storage.
 * 
 * @param expected the expected value
 * @param storage the storage to check for
 * @param script the script to take the value from
 * @param variable the variable to take the value from
 */
private static void assertStorageEqual(Object expected, RtVilStorage storage, String script, String variable) {
    Object value = storage.getValue(script, variable);
    if (null == expected) {
        Assert.assertNull(value);
    } else {
        Assert.assertEquals(expected, value);
    }
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:17,代碼來源:ExecutionRtTests.java

示例6: invoke

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
@Override
public Object invoke(Object... args) throws VilException {
    mapArgumentsToJava(args);
    Object result;
    ISimulationNotifier notifier = RtVilStorage.getSimulationNotifier();
    if (null != notifier && disableExecution) {
        notifier.notifyOperationCall(this, args);
        result = null;
    } else {
        result = super.invoke(args);
    }
    return mapValueToVil(result, getReturnType());
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:14,代碼來源:RtVilTypeRegistry.java

示例7: performAdaptation

import net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage; //導入依賴的package包/類
/**
 * Performs a single adaptation cycle in simulation mode.
 * 
 * @param testSpec the test specification for initializing / asserting
 * @throws IOException shall not occur
 * @see #beforeTestSpec(TestSpec)
 * @see #afterTestSpec(TestSpec)
 */
protected void performAdaptation(TestSpec testSpec) throws IOException {
    String ignoreMessage = null;
    try {
        beforeTestSpec(testSpec);
        if (!testSpec.isEnabled(adaptConfig)) {
            ignoreMessage = "not enabled by testSpec";
        }
    } catch (IOException e) {
        ignoreMessage = e.getMessage();
    }
    if (null == ignoreMessage) {
        IReasoningModelProvider provider = new SimpleReasoningModelProvider(
            monConfig, monRtVilModel, monCopyMapping);
        ReasoningTask rTask = new ReasoningTask(provider);
        rTask.setReasoningListener(testSpec);
        testSpec.initialize(adaptConfig);
        for (int step = 1; step <= testSpec.getStepCount(); step++) {
            if (testSpec.start(step, monConfig)) {
                String id = testSpec.getTimeIdentifier();
                if (testSpec.getStepCount() > 1) {
                    id = testSpec.getTimeIdentifier() + " step " + step;
                }
                TimeMeasurementTracerFactory.setCurrentIdentifier(id);
                // monitoring
                AdaptationEvent event = testSpec.monitor(step, MonitoringManager.getSystemState());
                // analysis
                if (null == event) {
                    TimeMeasurementTracerFactory.measure(true, Measure.ANALYSIS);
                    event = rTask.reason(false);
                    System.out.println("Analysis result: " + event);                        
                    TimeMeasurementTracerFactory.measure(false, Measure.ANALYSIS);
                    if (!testSpec.assertAnalysis(step, event, monConfig)) {
                        event = null; // consume silently
                    }
                }
                
                ISimulationNotifier notifier = RtVilStorage.setSimulationNotifier(testSpec);
                // run adaptation
                if (null != event) {
                    if (debug) {
                        System.out.println("Adaptation event " + event);
                    }
                    TimeMeasurementTracerFactory.measure(true, Measure.ADAPT);
                    AdaptationEventQueue.adapt(event, adaptConfig, adaptRtVilModel, tmp);
                    TimeMeasurementTracerFactory.measure(false, Measure.ADAPT);
                }
                RtVilStorage.setSimulationNotifier(notifier);
                
                testSpec.assertAdaptation(step, adaptConfig);
                if (testSpec.stop(step, adaptConfig)) {
                    break;
                }
                testSpec.commands.clear();
            }
        }
        rTask.dispose();

        testSpec.end();
        afterTestSpec(testSpec);
    } else {
        System.out.println("WARNING (Test ignored): " + ignoreMessage);
    }
}
 
開發者ID:QualiMaster,項目名稱:Infrastructure,代碼行數:72,代碼來源:AbstractDirectAdaptationTests.java


注:本文中的net.ssehub.easy.instantiation.rt.core.model.rtVil.RtVilStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。