本文整理汇总了Java中net.ssehub.easy.instantiation.rt.core.model.rtVil.Script类的典型用法代码示例。如果您正苦于以下问题:Java Script类的具体用法?Java Script怎么用?Java Script使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Script类属于net.ssehub.easy.instantiation.rt.core.model.rtVil包,在下文中一共展示了Script类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelInfo
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
public ModelInfo<Script> getModelInfo(String projectName, Object project) {
// currently, there is no full EASy integration / convention, search for the rt-VIL model with project name
// and largest version number (if given)
List<ModelInfo<Script>> infos = RtVilModel.INSTANCE.availableModels().getModelInfo(projectName);
ModelInfo<Script> result = null;
Version maxVer = null;
if (null != infos && !infos.isEmpty()) {
for (int i = 0; i < infos.size(); i++) {
ModelInfo<Script> tmp = infos.get(i);
if (null == maxVer || Version.compare(maxVer, tmp.getVersion()) < 0) {
result = tmp;
}
}
}
if (null != result && !result.isResolved()) {
try {
getModelManagement().load(result);
} catch (ModelManagementException e) {
EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).exception(e);
}
}
return result;
}
示例2: getUnderlyingModel
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
protected IModel getUnderlyingModel(URI modelFileUri, boolean forceBuild) {
IModel vilScript = null;
ModelInfo<Script> scriptModelInfo = RtVilModel.INSTANCE.availableModels().getInfo(modelFileUri);
if (scriptModelInfo != null && scriptModelInfo.getResolved() != null) {
vilScript = scriptModelInfo.getResolved();
//System.out.println("[BuildModelListener] BuildModel found: " + vilScript);
} else {
//System.out.println("[BuildModelListener] Script not resolved!");
if (xtextDocument != null && forceBuild) {
//System.out.println("[BuildModelListener] Build script model!");
buildModel(xtextDocument);
// Do not force the build a second time!
vilScript = getUnderlyingModel(modelFileUri, false);
} /*else {
System.out.println("[BuildModelListener] VIL document is null or no build forced!");
}*/
}
return vilScript;
}
示例3: findElement
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
public IBuildlangElement findElement(Script model, String name) {
IBuildlangElement result = null;
for (int s = 0; null == result && s < model.getStrategiesCount(); s++) {
Strategy strategy = model.getStrategy(s);
if (strategy.getName().equals(name)) {
result = strategy;
}
}
for (int t = 0; null == result && t < model.getTacticsCount(); t++) {
Tactic tactic = model.getTactic(t);
if (tactic.getName().equals(name)) {
result = tactic;
}
}
if (null == result) {
result = VilModelQuery.findScriptElement(model, name);
}
return result;
}
示例4: obtainInfo
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Obtains model information.
*
* @param uri
* the URI to read the info from
* @return the project info instances related to <code>uri</code>
* @throws IOException
* in case that an I/O error happens during parsing
*/
public List<ModelInfo<Script>> obtainInfo(URI uri) throws IOException {
ImplementationUnit root = parse(uri, true, null, ImplementationUnit.class);
List<ModelInfo<Script>> result = new ArrayList<ModelInfo<Script>>();
if (null != root) {
for (de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit script : root.getScripts()) {
Version version = ModelTranslator.convert(script.getVersion());
ArrayList<ModelImport<Script>> imports = new ArrayList<ModelImport<Script>>();
for (Import imp : script.getImports()) {
String name = imp.getName();
imports.add(new ModelImport<Script>(name, false, null));
}
try {
result.add(new ModelInfo<Script>(script.getName(), version, this, toNetUri(uri), imports));
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
}
return result;
}
示例5: processRules
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
public void processRules(LanguageUnit unit, List<EObject> elements, Script script) throws TranslatorException {
super.processRules(unit, elements, script);
List<Strategy> topLevel = script.getTopLevelStrategies(false, true);
if (script.getStrategiesCount() > 0 && topLevel.isEmpty()) {
error("Script declares strategies but does not provide top-level strategies (cyclic breakdown)", unit,
RtVilPackage.Literals.LANGUAGE_UNIT__RT_CONTENTS, RtErrorCodes.CYCLIC_BREAKDOWN);
} else {
Set<Strategy> done = new HashSet<Strategy>();
for (int s = 0; s < topLevel.size(); s++) {
Strategy strategy = topLevel.get(s);
done.add(strategy);
checkBreakdown(strategy, done);
done.clear();
}
}
}
示例6: createAndCheckCall
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
public AbstractBreakdownCall createAndCheckCall(
net.ssehub.easy.instantiation.core.model.buildlangModel.Script model, boolean isSuper,
net.ssehub.easy.instantiation.core.model.buildlangModel.Script fromModel) {
AbstractBreakdownCall result = null;
try {
if (strategy) {
result = new StrategyCall((Script) model, name, arguments);
} else {
result = new TacticCall((Script) model, name, arguments);
}
result.inferType();
} catch (VilException e) {
lastException = e;
result = null;
}
return result;
}
示例7: testPersistentVar
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的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);
}
示例8: testSubstrategy
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests the re-use of strategies.
*
* @throws IOException should not occur
*/
@Test
public void testSubstrategy() throws IOException {
final String name = "substrategy";
Configuration cfg = getIvmlConfiguration("Add", NoVariableFilter.INSTANCE);
// if referenced strategies are not top-level (reusable) strategies, the trace is empty
Map<String, Object> param = createParameterMap(null, null, cfg);
param.put("event", new RegularAdaptationEvent());
EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name), param);
assertEqual(setup);
// "normal" execution with specific event
param.put("event", new LifecycleEvent("pip", LifecycleEvent.Status.START));
setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name + ".snd"), param);
assertEqual(setup);
}
示例9: testStartup2
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests the basic functions of startup, shutdown and default strategy.
*
* @throws IOException should not occur
*/
@Test
public void testStartup2() throws IOException {
final String name = "startup2";
Map<String, Object> param = createParameterMap(null, null, null);
// test startup
param.put("event", new LifecycleEvent("pipeline", LifecycleEvent.Status.START));
EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name + ".start"), param);
assertEqual(setup);
param.put("event", new LifecycleEvent("pipeline", LifecycleEvent.Status.END));
setup = new EqualitySetup<Script>(createFile(name), name, null, createTraceFile(name + ".end"), param);
assertEqual(setup);
param.put("event", new RegularAdaptationEvent());
setup = new EqualitySetup<Script>(createFile(name), name, null, createTraceFile(name + ".regular"), param);
assertEqual(setup);
}
示例10: testStartup3
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests a QM-like pipeline startup.
*
* @throws IOException should not occur
*/
@Test
public void testStartup3() throws IOException {
final String name = "startup3";
CommandCollector.clear();
Configuration cfg = getIvmlConfiguration("QM1", NoVariableFilter.INSTANCE);
Map<String, Object> param = createParameterMap(null, null, cfg);
param.put("event", new LifecycleEvent("pip", LifecycleEvent.Status.START));
EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name), param);
assertEqual(setup);
Assert.assertEquals(2, CommandCollector.getExecutedCount());
Assert.assertTrue(CommandCollector.getExecuted(0) instanceof CommandSequence);
Assert.assertTrue(CommandCollector.getExecuted(1) instanceof AlgorithmChangeCommand);
AlgorithmChangeCommand algC = (AlgorithmChangeCommand) CommandCollector.getExecuted(1);
Assert.assertEquals("pip", algC.getPipeline());
Assert.assertEquals("famelt1", algC.getElement());
Assert.assertEquals("alg1", algC.getAlgorithm()); // see rtvil + ivml
}
示例11: testReferences3
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests a single reference assignment (contributed by QualiMaster).
*
* @throws IOException should not occur
* @throws ModelQueryException should not occur
*/
@Test
public void testReferences3() throws IOException, ModelQueryException {
final String name = "references3";
File modelFile = createFile(name);
Configuration cfg = getIvmlConfiguration("QM8", NoVariableFilter.INSTANCE);
Map<String, Object> param = createParameterMap(null, null, cfg);
EqualitySetup<Script> setup = new EqualitySetup<Script>(modelFile, name, null, createTraceFile(name), param);
setup.setEnableEquals(false);
assertEqual(setup);
net.ssehub.easy.varModel.confModel.Configuration c = cfg.getConfiguration();
AbstractVariable var = ModelQuery.findVariable(c.getProject(), "hAlg", null);
Assert.assertNotNull(var);
IDecisionVariable d = c.getDecision(var);
IDecisionVariable a = d.getNestedElement("actualHwNode");
Assert.assertNotEquals(NullValue.INSTANCE, a.getValue());
}
示例12: testALTest
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests the QM AdaptationLayer test model.
*
* @throws IOException should not occur
*/
@Test
public void testALTest() throws IOException {
final String name = "ALtest";
CommandCollector.clear();
Configuration cfg = getIvmlConfiguration("ALtest", NoVariableFilter.INSTANCE);
Map<String, Object> param = createParameterMap(null, null, cfg);
param.put("event", new StartupAdaptationEvent("pipeline"));
param.put("bindings", null);
EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name), param);
assertEqual(setup);
Assert.assertEquals(2, CommandCollector.getExecutedCount());
Assert.assertTrue(CommandCollector.getExecuted(0) instanceof CommandSequence);
Assert.assertTrue(CommandCollector.getExecuted(1) instanceof AlgorithmChangeCommand);
CommandCollector.clear();
setup = new EqualitySetup<Script>(createFile(name), name, null, createTraceFile(name + ".snd"), param);
assertEqual(setup);
Assert.assertEquals(0, CommandCollector.getExecutedCount());
}
示例13: testDispatch2
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
/**
* Tests dynamic dispatch over references. Testing also {@link VariableValueCopier}.
*
* @throws IOException should not occur
* @throws ModelQueryException should not occur
* @throws CSTSemanticException should not occur
* @throws ValueDoesNotMatchTypeException should not occur
* @throws ConfigurationException should not occur
*/
@Test
public void testDispatch2() throws IOException, ModelQueryException, CSTSemanticException,
ValueDoesNotMatchTypeException, ConfigurationException {
final String name = "dispatch2";
net.ssehub.easy.varModel.confModel.Configuration cfg
= getIvmlConfiguration("dispatch2", NoVariableFilter.INSTANCE).getConfiguration();
Compound algType = (Compound) ModelQuery.findType(cfg.getProject(), "Algorithm", null);
CopySpec spec = new CopySpec(algType, "ref", "avail");
VariableValueCopier copier = new VariableValueCopier("TEST", spec);
copier.process(cfg);
Map<String, Object> param = createParameterMap(null, null, new Configuration(cfg, NoVariableFilter.INSTANCE));
EqualitySetup<Script> setup = new EqualitySetup<Script>(createFile(name), name, null,
createTraceFile(name), param);
assertEqual(setup);
}
示例14: assertFailure
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
protected void assertFailure(EqualitySetup<Script> data, String actualFailReason, Integer actualFailCode,
net.ssehub.easy.instantiation.core.model.buildlangModel.RuleExecutionResult.Status status) {
if (null != data.getExpectedFailCode() || null != data.getExpectedFailReason()) {
if (null != data.getExpectedFailCode()) {
Assert.assertEquals(data.getExpectedFailCode(), actualFailCode);
}
if (null != data.getExpectedFailReason()) {
Assert.assertEquals(data.getExpectedFailReason(), actualFailReason);
}
if (null != status) {
Assert.assertEquals(net.ssehub.easy.instantiation.core.model.buildlangModel.
RuleExecutionResult.Status.FAIL, status);
}
} else {
Assert.assertNull(actualFailCode);
Assert.assertNull(actualFailReason);
if (null != status) {
Assert.assertEquals(net.ssehub.easy.instantiation.core.model.buildlangModel.
RuleExecutionResult.Status.SUCCESS, status);
}
}
}
示例15: serialize
import net.ssehub.easy.instantiation.rt.core.model.rtVil.Script; //导入依赖的package包/类
@Override
public void serialize(File source, List<IModel> modelList) {
Collection<File> rtvilFiles = FileUtils.listFiles(source, RTVIL_FILTER, true);
// Load all RTVIL files
for (File file : rtvilFiles) {
ModelInfo<Script> foundScript = RtVilModel.INSTANCE.availableModels().getInfo(file.toURI());
try {
if (null != foundScript) {
RtVilModel.INSTANCE.load(foundScript);
Script script = foundScript.getResolved();
registries.add(script.getTypeRegistry());
modelList.add(script);
}
} catch (ModelManagementException e) {
logger.exception(e);
}
}
}