protected static void _privk3_fire(final TransitionAspectTransitionAspectProperties _self_, final Transition _self) { String _name = _self.getName(); String _plus = ("Firing " + _name); String _plus_1 = (_plus + " and entering "); String _name_1 = _self.getTarget().getName(); String _plus_2 = (_plus_1 + _name_1); InputOutput.<String>println(_plus_2); final StateMachine fsm = _self.getSource().getOwningFSM(); StateMachineAspect.currentState(fsm, _self.getTarget()); String _producedString = StateMachineAspect.producedString(fsm); String _output = _self.getOutput(); String _plus_3 = (_producedString + _output); StateMachineAspect.producedString(fsm, _plus_3); String _consummedString = StateMachineAspect.consummedString(fsm); String _input = _self.getInput(); String _plus_4 = (_consummedString + _input); StateMachineAspect.consummedString(fsm, _plus_4); StateMachineAspect.unprocessedString(fsm, StateMachineAspect.unprocessedString(fsm).substring(_self.getInput().length())); }
protected static void _privk3_main(final StateMachineAspectStateMachineAspectProperties _self_, final StateMachine _self) { try { while ((!StateMachineAspect.unprocessedString(_self).isEmpty())) { StateAspect.step(StateMachineAspect.currentState(_self), StateMachineAspect.unprocessedString(_self)); } } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception nt = (Exception)_t; String _message = nt.getMessage(); String _plus = ("Stopped due to " + _message); InputOutput.<String>println(_plus); } else { throw Exceptions.sneakyThrow(_t); } } String _unprocessedString = StateMachineAspect.unprocessedString(_self); String _plus_1 = ("unprocessed string: " + _unprocessedString); InputOutput.<String>println(_plus_1); String _consummedString = StateMachineAspect.consummedString(_self); String _plus_2 = ("processed string: " + _consummedString); InputOutput.<String>println(_plus_2); String _producedString = StateMachineAspect.producedString(_self); String _plus_3 = ("produced string: " + _producedString); InputOutput.<String>println(_plus_3); }
private String drawSafe(final GraphvizDotBuilder builder, final Object graph) { String _xtrycatchfinallyexpression = null; try { _xtrycatchfinallyexpression = builder.draw(graph); } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; InputOutput.<String>println("Error rendering"); e.printStackTrace(); return Throwables.getStackTraceAsString(e); } else { throw Exceptions.sneakyThrow(_t); } } return _xtrycatchfinallyexpression; }
/** * Use this main method to update the expectations to whatever the wizard currently generates */ public static void main(final String[] args) { final CliProjectsCreator creator = CliWizardIntegrationTest.newProjectCreator(); final Consumer<WizardConfiguration> _function = (WizardConfiguration config) -> { try { String _baseName = config.getBaseName(); final File targetLocation = new File("testdata/wizard-expectations", _baseName); targetLocation.mkdirs(); Files.sweepFolder(targetLocation); config.setRootLocation(targetLocation.getPath()); creator.createProjects(config); String _baseName_1 = config.getBaseName(); String _plus = ("Updating expectations for " + _baseName_1); InputOutput.<String>println(_plus); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }; CliWizardIntegrationTest.projectConfigs.forEach(_function); }
public static void main(final String[] args) { try { final IKAnalyzer ikAnalyzer = new IKAnalyzer(true); final String text = "lucene分析器使用分词器和过滤器构成一个“管道”,文本在流经这个管道后成为可以进入索引的最小单位,因此,一个标准的分析器有两个部分组成,一个是分词器tokenizer,它用于将文本按照规则切分为一个个可以进入索引的最小单位。另外一个是TokenFilter,它主要作用是对切出来的词进行进一步的处理(如去掉敏感词、英文大小写转换、单复数处理)等。lucene中的Tokenstram方法首先创建一个tokenizer对象处理Reader对象中的流式文本,然后利用TokenFilter对输出流进行过滤处理"; final TokenStream ts = ikAnalyzer.tokenStream("field", text); final CharTermAttribute ch = ts.<CharTermAttribute>addAttribute(CharTermAttribute.class); ts.reset(); while (ts.incrementToken()) { String _string = ch.toString(); String _plus = (_string + " | "); InputOutput.<String>print(_plus); } ts.end(); ts.close(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
public static void build(final String projectName, final String projectType, final String moduleName) { final Project project = Projects.byName(projectName); Module _moduleByClass = Modules.moduleByClass(moduleName); List<Module> modules = CollectionLiterals.<Module>newArrayList(_moduleByClass); final Consumer<Module> _function = (Module it) -> { InputOutput.<Module>println(it); }; modules.forEach(_function); final List<ModuleGeneratedDoc> generateDocs = GeneratedDocs.byType(projectType); GenerateBoxBuilder _generateBoxBuilder = new GenerateBoxBuilder(); GenerateBoxBuilder _generateDocs = _generateBoxBuilder.generateDocs(generateDocs); GenerateBoxBuilder _modules = _generateDocs.modules(modules); GenerateBoxBuilder _project = _modules.project(project); GenerateBox _build = _project.build(); _build.doGenerate(); }
@Test public void parseSimpleAGCLLibrary() { try { InputOutput.<String>println("AGCLAnnexLibrary"); final String libText = "\n library \n viewpoint v1*;\n viewpoint v2\n "; final AGCLGrammarRoot libAST = this.parser.parse(libText); AGCLAnnexLibrary _lib = libAST.getLib(); final EList<AGCLViewpoint> viewpoints = _lib.getViewpoints(); InputOutput.<AGCLGrammarRoot>println(libAST); InputOutput.<EList<AGCLViewpoint>>println(viewpoints); AGCLViewpoint _get = viewpoints.get(0); String _name = _get.getName(); InputOutput.<String>println(_name); AGCLViewpoint _get_1 = viewpoints.get(1); String _name_1 = _get_1.getName(); InputOutput.<String>println(_name_1); AGCLViewpoint _get_2 = viewpoints.get(0); String _name_2 = _get_2.getName(); Assert.assertEquals("v1", _name_2); AGCLViewpoint _get_3 = viewpoints.get(1); String _name_3 = _get_3.getName(); Assert.assertEquals("v2", _name_3); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void transformGuarantee() { try { InputOutput.<String>println("* transformGuarantee"); final String subclauseSource = "\n\t\t\tsubclause \n\t\t\t\tcontract v\n\t\t\t\t\tassumption in a:x & out b:y;\n\t\t\t\t\tguarantee in c:u & out d:v;\n\t\t\t\tend v;\n\t\t"; final AGCLGrammarRoot subclauseAST = this.agclParser.parse(subclauseSource); final String serializedSubclauseAST = this.serializer.serialize(subclauseAST); InputOutput.<String>println(((" serialized annex AST: \"" + serializedSubclauseAST) + "\"")); AGCLAnnexSubclause _subclause = subclauseAST.getSubclause(); EList<AGCLContract> _contracts = _subclause.getContracts(); AGCLContract _get = _contracts.get(0); AGCLAssumption _assumption = _get.getAssumption(); final PSLSpec assumptionSpec = _assumption.getSpec(); AGCLAnnexSubclause _subclause_1 = subclauseAST.getSubclause(); EList<AGCLContract> _contracts_1 = _subclause_1.getContracts(); AGCLContract _get_1 = _contracts_1.get(0); AGCLGuarantee _guarantee = _get_1.getGuarantee(); final PSLSpec guaranteeSpec = _guarantee.getSpec(); final String serializedAssumption = this.serializer.serialize(assumptionSpec); final String serializedGuarantee = this.serializer.serialize(guaranteeSpec); InputOutput.<String>println(((" serialized assumption: \"" + serializedAssumption) + "\"")); InputOutput.<String>println(((" serialized guarantee: \"" + serializedGuarantee) + "\"")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
/** * generate the source code using the ant generated task * @param f : the ant file to be called */ public void generateGenModelCode(final File f, final IProgressMonitor monitor) { final AntRunner runner = new AntRunner(); runner.setBuildFileLocation(f.getAbsolutePath()); if (this.debug) { runner.addBuildLogger("org.apache.tools.ant.DefaultLogger"); runner.setArguments("-verbose -debug"); } try { if (this.debug) { String _absolutePath = f.getAbsolutePath(); String _plus = (" --> Generate the EMF Code using the ant file : " + _absolutePath); InputOutput.<String>println(_plus); } runner.run(monitor); this.refreshWorkspace(); } catch (final Throwable _t) { if (_t instanceof CoreException) { final CoreException e = (CoreException)_t; e.printStackTrace(); } else { throw Exceptions.sneakyThrow(_t); } } }
@Test public void testQuickRandomReachedVertex() { try { final Model result = this.parseHelper.parse(("\n" + "Simple.json=quick_random(reached_vertex(v_VerifyAppRunning));I;")); Assert.assertNotNull(result); InputOutput.<EList<Resource.Diagnostic>>print(result.eResource().getErrors()); Assert.assertTrue(result.eResource().getErrors().isEmpty()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Override public void completeIntegerStopCondition_Pathtype(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> completeIntegerStopCondition_Pathtype"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public void completePercentageCondition_Pathtype(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> completePercentageCondition_Pathtype"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public void completeStringCondition_Pathtype(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> completeStringCondition_Pathtype"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public void complete_Model(final EObject model, final RuleCall ruleCall, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> complete_Model"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public void complete_NEWLINE(final EObject model, final RuleCall ruleCall, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> complete_NEWLINE"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public void complete_FORMAT_COMMENT(final EObject model, final RuleCall ruleCall, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) { System.out.println("---> complete_FORMAT_COMMENT"); EList<EStructuralFeature> _eAllStructuralFeatures = model.eClass().getEAllStructuralFeatures(); _eAllStructuralFeatures.forEach(new Consumer<EStructuralFeature>() { @Override public void accept(final EStructuralFeature t) { InputOutput.<String>println(t.getName()); } }); }
@Override public boolean isTransient(final EObject owner, final EStructuralFeature feature, final int index) { boolean _equals = Objects.equal(feature, OCCIPackage.Literals.ATTRIBUTE__MUTABLE); if (_equals) { Object _eGet = owner.eGet(feature); Boolean value = ((Boolean) _eGet); boolean _equals_1 = Objects.equal(value, Boolean.FALSE); if (_equals_1) { return true; } else { return false; } } boolean _equals_2 = Objects.equal(feature, OCCIPackage.Literals.ATTRIBUTE__REQUIRED); if (_equals_2) { EObject _eContainer = owner.eContainer(); if ((_eContainer instanceof Action)) { InputOutput.<String>println(("required action " + owner)); return true; } } boolean _equals_3 = Objects.equal(feature, OCCIPackage.Literals.ATTRIBUTE__DESCRIPTION); if (_equals_3) { EObject _eContainer_1 = owner.eContainer(); if ((_eContainer_1 instanceof Action)) { return true; } } boolean _equals_4 = Objects.equal(feature, OCCIPackage.Literals.CATEGORY__SCHEME); if (_equals_4) { if (((owner instanceof Action) || (owner instanceof Kind))) { return true; } } return super.isTransient(owner, feature, index); }
protected Collection<String> computeLiteralClassNames() { return Lists.newArrayList( ArrayLiterals.class.getName(), CollectionLiterals.class.getName(), InputOutput.class.getName() ); }
public static void main(final String[] args) { try { StringConcatenation _builder = new StringConcatenation(); _builder.append("D:\\test\\2.txt"); File _file = new File(_builder.toString()); String txt = Files.toString(_file, Charsets.UTF_8); ArrayList<String> _analyze = My.analyze(txt); final Consumer<String> _function = (String it) -> { InputOutput.<String>println(it); }; _analyze.forEach(_function); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
public static void main(final String[] args) { final String url = "http://www.xbiquge.com/3_3713/737.html"; final String titleSelector = ".bookname h1"; final String bodySelector = "#content"; System.setProperty("webdriver.firefox.bin", "D:\\Program Files\\Mozilla Firefox\\firefox.exe"); final FirefoxDriver webDriver = new FirefoxDriver(); webDriver.get(url); final WebElement titleElement = webDriver.findElementByCssSelector(titleSelector); final WebElement bodyElement = webDriver.findElementByCssSelector(bodySelector); String _text = titleElement.getText(); String _text_1 = bodyElement.getText(); final Pair<String, String> pair = Pair.<String, String>of(_text, _text_1); InputOutput.<Pair<String, String>>println(pair); webDriver.close(); }
@Deprecated public static void firefoxClicks(final String baseUrl, final String cssSelector) { StringConcatenation _builder = new StringConcatenation(); _builder.append("D:\\Program Files\\Mozilla Firefox\\firefox.exe"); System.setProperty("webdriver.firefox.bin", _builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("C:\\Users\\Administrator\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\f5gpdod4.selenium"); final String dir = _builder_1.toString(); File _file = new File(dir); final FirefoxProfile profile = new FirefoxProfile(_file); final FirefoxDriver webDriver = new FirefoxDriver(profile); webDriver.get(baseUrl); final List<WebElement> webElements = webDriver.findElementsByCssSelector(cssSelector); final Consumer<WebElement> _function = (WebElement element) -> { try { element.click(); WebDriver.Navigation _navigate = webDriver.navigate(); _navigate.back(); final long random = RandomUtils.nextLong(5, 20); StringConcatenation _builder_2 = new StringConcatenation(); _builder_2.append("等待"); _builder_2.append(random, ""); _builder_2.append("S"); InputOutput.<String>println(_builder_2.toString()); TimeUnit.SECONDS.sleep(random); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }; webElements.forEach(_function); webDriver.close(); }
@Scheduled(fixedRate = 100000) public void house6() { DateTime _dateTime = new DateTime(); final Page page = new Page("http://www.6.cn/", "div#iBody .col1 .viewCount p em", _dateTime); String _url = page.getUrl(); String _expression = page.getExpression(); final String num = TungParser.partAjaxHtml(_url, _expression); String _plus = (page + " -> "); String _plus_1 = (_plus + num); InputOutput.<String>println(_plus_1); }
@Scheduled(fixedRate = 100000, initialDelay = 50000) public void sina9158() { DateTime _dateTime = new DateTime(); final Page page = new Page("http://www.9158.com/", "span#onlinenum", _dateTime); String _url = page.getUrl(); String _expression = page.getExpression(); final String num = TungParser.partAjaxHtml(_url, _expression); String _plus = (page + " -> "); String _plus_1 = (_plus + num); InputOutput.<String>println(_plus_1); }
public Pair<String, String> house6() { Pair<String, String> _xblockexpression = null; { final String url = "http://www.6.cn/"; final String expression = "#iBody .col1 .viewCount p em"; final Pair<String, String> pair = this.pair(url, expression); _xblockexpression = InputOutput.<Pair<String, String>>println(pair); } return _xblockexpression; }
public Pair<String, String> sina9158() { Pair<String, String> _xblockexpression = null; { final String url = "http://www.9158.com/"; final String expression = "span#onlinenum"; final Pair<String, String> pair = this.pair(url, expression); _xblockexpression = InputOutput.<Pair<String, String>>println(pair); } return _xblockexpression; }
public static void main(final String[] args) { try { final String text = "lucene分析器使用分词器和过滤器构成一个“管道”,文本在流经这个管道后成为可以进入索引的最小单位,因此,一个标准的分析器有两个部分组成,一个是分词器tokenizer,它用于将文本按照规则切分为一个个可以进入索引的最小单位。另外一个是TokenFilter,它主要作用是对切出来的词进行进一步的处理(如去掉敏感词、英文大小写转换、单复数处理)等。lucene中的Tokenstram方法首先创建一个tokenizer对象处理Reader对象中的流式文本,然后利用TokenFilter对输出流进行过滤处理"; final ArrayList<String> myStopWords = CollectionLiterals.<String>newArrayList("的", "在", "了", "呢", ",", "0", ":", ",", "是", "流"); final CharArraySet stopWords = new CharArraySet(0, true); for (final String word : myStopWords) { stopWords.add(word); } CharArraySet _defaultStopSet = SmartChineseAnalyzer.getDefaultStopSet(); final Iterator<Object> itor = _defaultStopSet.iterator(); while (itor.hasNext()) { Object _next = itor.next(); stopWords.add(_next); } final SmartChineseAnalyzer sca = new SmartChineseAnalyzer(stopWords); final TokenStream ts = sca.tokenStream("field", text); CharTermAttribute ch = ts.<CharTermAttribute>addAttribute(CharTermAttribute.class); TypeAttribute type = ts.<TypeAttribute>addAttribute(TypeAttribute.class); ts.reset(); while (ts.incrementToken()) { String _string = ch.toString(); String _plus = (_string + " | "); String _type = type.type(); String _plus_1 = (_plus + _type); InputOutput.<String>println(_plus_1); } ts.end(); ts.close(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
public static void main(final String[] args) { final Runnable _function = () -> { InputOutput.<String>println("Hello I’m executed!"); }; final Runnable runnable = _function; final Callable<String> _function_1 = () -> { return InputOutput.<String>println("Hello I’m executed!"); }; final Callable<String> callable = _function_1; final FutureTask<String> task = new FutureTask<String>(callable); final Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); Thread _thread = new Thread(runnable); _thread.start(); IntegerRange _upTo = new IntegerRange(1, 1000000); final Consumer<Integer> _function_2 = (Integer index) -> { Thread _thread_1 = new Thread(task); _thread_1.start(); }; _upTo.forEach(_function_2); stopwatch.stop(); StringConcatenation _builder = new StringConcatenation(); _builder.append("ThreadSystem Hello-Tung Cost "); long _elapsed = stopwatch.elapsed(TimeUnit.MILLISECONDS); _builder.append(_elapsed, ""); _builder.append(" ms ( is "); long _elapsed_1 = stopwatch.elapsed(TimeUnit.NANOSECONDS); _builder.append(_elapsed_1, ""); _builder.append(" ns )"); InputOutput.<String>println(_builder.toString()); }
public static void main(final String[] args) { final Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); final ActorSystem system = ActorSystem.create("Hello-Tung"); Props _create = Props.create(GreetingActor.class); final ActorRef greeter = system.actorOf(_create, "greeter"); Greeting _greeting = new Greeting("Tung Out Room"); ActorRef _noSender = ActorRef.noSender(); greeter.tell(_greeting, _noSender); IntegerRange _upTo = new IntegerRange(1, 10); final Consumer<Integer> _function = (Integer index) -> { Props _create_1 = Props.create(GreetingActor.class); final ActorRef in = system.actorOf(_create_1, ("greeter" + index)); Greeting _greeting_1 = new Greeting(("Tung In Room" + index)); ActorRef _noSender_1 = ActorRef.noSender(); in.tell(_greeting_1, _noSender_1); }; _upTo.forEach(_function); stopwatch.stop(); StringConcatenation _builder = new StringConcatenation(); _builder.append("ActorSystem Hello-Tung Cost "); long _elapsed = stopwatch.elapsed(TimeUnit.MILLISECONDS); _builder.append(_elapsed, ""); _builder.append(" ms ( is "); long _elapsed_1 = stopwatch.elapsed(TimeUnit.NANOSECONDS); _builder.append(_elapsed_1, ""); _builder.append(" ns )"); InputOutput.<String>println(_builder.toString()); }
public static void main(final String[] args) { File path = new File("."); String[] list = path.list(); for (final String dirItem : list) { InputOutput.<String>println(dirItem); } File _file = new File("."); File[] _listFiles = _file.listFiles(); List<File> _list = IterableExtensions.<File>toList(((Iterable<File>)Conversions.doWrapArray(_listFiles))); InputOutput.<List<File>>println(_list); }
public static void main(final String[] args) { String getJson = HTTP.get("http://localhost:12306/modules"); List<Module> _fromJsonArray = Boon.<Module>fromJsonArray(getJson, Module.class); InputOutput.<List<Module>>println(_fromJsonArray); String _get = HTTP.get("http://localhost:12306/json"); getJson = _get; List<Module> _fromJsonArray_1 = Boon.<Module>fromJsonArray(getJson, Module.class); final Function1<Module, Boolean> _function = (Module it) -> { int _index = it.getIndex(); return Boolean.valueOf((_index == 1)); }; Module _findFirst = IterableExtensions.<Module>findFirst(_fromJsonArray_1, _function); String _comment = _findFirst.getComment(); InputOutput.<String>println(_comment); }
public static void main(final String[] args) { Object _byType = Randoms.getByType("Integer"); InputOutput.<Object>println(_byType); Object _byType_1 = Randoms.getByType("Long"); InputOutput.<Object>println(_byType_1); Object _byType_2 = Randoms.getByType("String"); InputOutput.<Object>println(_byType_2); Object _byType_3 = Randoms.getByType("Boolean"); InputOutput.<Object>println(_byType_3); Object _byType_4 = Randoms.getByType("DateTime"); InputOutput.<Object>println(_byType_4); }
public static void show(final Table table) { for (int i = 0; (i < table.numRows()); i++) { { final TableRow row = table.getRow(i); for (int j = 0; (j < row.numCells()); j++) { String _rowCellText = PoiUtils.rowCellText(row, j); String _plus = (_rowCellText + "\t"); InputOutput.<String>print(_plus); } InputOutput.println(); } } }
public static void main(final String[] args) { ImmutableTriple<String, String, String> _immutableTriple = new ImmutableTriple<String, String, String>("NOT_CHECK", "0", "未审核"); ImmutableTriple<String, String, String> _immutableTriple_1 = new ImmutableTriple<String, String, String>("OK", "1", "通过"); ImmutableTriple<String, String, String> _immutableTriple_2 = new ImmutableTriple<String, String, String>("NO", "2", "不通过"); ArrayList<Triple<String, String, String>> _newArrayList = CollectionLiterals.<Triple<String, String, String>>newArrayList(_immutableTriple, _immutableTriple_1, _immutableTriple_2); String _enumKlass = Enums.enumKlass("BgStatus", _newArrayList); InputOutput.<String>println(_enumKlass); }
QualifiedName qualifiedName(MachineDecl machine){ Model rootContainer = (Model) EcoreUtil2.getRootContainer(machine); String machineQN = rootContainer.getNamespace().getName() + "."+ machine.getName(); InputOutput.println("machine qn: " + machineQN); return QualifiedName.create(machineQN.split("\\.")); }
@Override protected Collection<String> computeLiteralClassNames() { // we completely define the content ourselves, but need the collection // instance from the super class as it is a private field Collection<String> literalClassNames = super.getLiteralClassNames(); if(literalClassNames==null) { literalClassNames = super.computeLiteralClassNames(); } literalClassNames.clear(); // add all actions that are contributed as OSGi services Object[] services = ScriptActivator.actionServiceTracker.getServices(); if(services!=null) { for(Object service : services) { ActionService actionService = (ActionService) service; literalClassNames.add(actionService.getActionClassName()); } } literalClassNames.add(CollectionLiterals.class.getName()); literalClassNames.add(InputOutput.class.getName()); literalClassNames.add(BusEvent.class.getCanonicalName()); literalClassNames.add(ScriptExecution.class.getCanonicalName()); literalClassNames.add(LogAction.class.getCanonicalName()); // jodatime static functions literalClassNames.add(DateTime.class.getCanonicalName()); literalClassNames.add(DateMidnight.class.getCanonicalName()); return literalClassNames; }
@Before public void setUp() { InputOutput.<String>println("* AGCLSerializationTests.setUp"); AGCLStandaloneSetup _aGCLStandaloneSetup = new AGCLStandaloneSetup(); final Injector injector = _aGCLStandaloneSetup.createInjectorAndDoEMFRegistration(); Serializer _instance = injector.<Serializer>getInstance(Serializer.class); this.serializer = _instance; }
@Test public void serializeAnnexLibrary() { try { InputOutput.<String>println("* AGCLAnnexLibrary"); final String libSrc = "\n library \n viewpoint v1 ;\n viewpoint v2 ; \n "; InputOutput.<String>println((("lib src: \"" + libSrc) + "\"")); String _trim = libSrc.trim(); String _replaceAll = _trim.replaceAll("\\s+", " "); final String libSrcNormalized = _replaceAll.trim(); InputOutput.<String>println((("lib src normalized: \"" + libSrcNormalized) + "\"")); final AGCLGrammarRoot libAST = this.parser.parse(libSrc); InputOutput.<String>println((("lib AST: \"" + libAST) + "\"")); final AGCLGrammarRoot libNormalizedAST = this.parser.parse(libSrcNormalized); InputOutput.<String>println((("lib normalized AST: \"" + libNormalizedAST) + "\"")); final String serializedLibAST = this.serializer.serialize(libAST); InputOutput.<String>println((("serialized lib AST: \"" + serializedLibAST) + "\"")); final String serializedLibNormalizedAST = this.serializer.serialize(libNormalizedAST); InputOutput.<String>println((("serialized lib normalized AST: \"" + serializedLibNormalizedAST) + "\"")); Assert.assertNotEquals(libAST, libNormalizedAST); Matcher<EObject> _structuralEqualTo = EcoreStructuralEqualityMatcher.structuralEqualTo(libNormalizedAST); Assert.<AGCLGrammarRoot>assertThat(libAST, _structuralEqualTo); Assert.assertEquals(libSrcNormalized, serializedLibAST); Assert.assertNotEquals(libSrc, serializedLibAST); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void serializeAnnexSubclause() { try { InputOutput.<String>println("* AGCLAnnexSubclause"); final String annexSrc = "\n subclause\n property A1 = true ;\n property A2 = false ;\n property G1 = true ;\n behaviour in p1 : e1 -> out p2 : e2 ;\n contract c1\n assumption A1 && A2 ;\n guarantee G1 ;\n end c1 ;\n "; InputOutput.<String>println((("annex: \"" + annexSrc) + "\"")); String _trim = annexSrc.trim(); String _replaceAll = _trim.replaceAll("\\s+", " "); final String annexSrcNormalized = _replaceAll.trim(); InputOutput.<String>println((("annex src normalized: \"" + annexSrcNormalized) + "\"")); final AGCLGrammarRoot annexAST = this.parser.parse(annexSrc); InputOutput.<String>println((("annex AST: \"" + annexAST) + "\"")); final AGCLGrammarRoot annexNormalizedAST = this.parser.parse(annexSrcNormalized); InputOutput.<String>println((("annex normalized AST: \"" + annexNormalizedAST) + "\"")); final String serializedAnnexAST = this.serializer.serialize(annexAST); InputOutput.<String>println((("serialized annex AST: \"" + serializedAnnexAST) + "\"")); final String serializedannexNormalizedAST = this.serializer.serialize(annexNormalizedAST); InputOutput.<String>println((("serialized annex normalized AST: \"" + serializedannexNormalizedAST) + "\"")); Assert.assertNotEquals(annexAST, annexNormalizedAST); Matcher<EObject> _structuralEqualTo = EcoreStructuralEqualityMatcher.structuralEqualTo(annexNormalizedAST); Assert.<AGCLGrammarRoot>assertThat(annexAST, _structuralEqualTo); Assert.assertEquals(annexSrcNormalized, serializedAnnexAST); Assert.assertNotEquals(annexSrc, serializedAnnexAST); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void serializeAnnexSubclauseItem() { try { InputOutput.<String>println("* AGCLAnnexSubclauseItem"); final String annexSrc = "\n subclause\n property A1 = true ;\n property A2 = false ;\n property G1 = true ;\n behaviour in p1 : e1 -> out p2 : e2 ;\n contract c1\n assumption A1 && A2 ;\n guarantee G1 ;\n end c1 ;\n "; final String contractSrc = "\n contract c1\n assumption A1 && A2 ;\n guarantee G1 ;\n end c1 ;\n "; InputOutput.<String>println((("annex: \"" + annexSrc) + "\"")); final AGCLGrammarRoot annexAST = this.parser.parse(annexSrc); InputOutput.<String>println((("annex AST: \"" + annexAST) + "\"")); final String serializedAnnexAST = this.serializer.serialize(annexAST); InputOutput.<String>println((("serialized annex AST: \"" + serializedAnnexAST) + "\"")); InputOutput.<String>println((("contract: \"" + contractSrc) + "\"")); String _trim = contractSrc.trim(); String _replaceAll = _trim.replaceAll("\\s+", " "); final String contractSrcNormalized = _replaceAll.trim(); InputOutput.<String>println((("contract src normalized: \"" + contractSrcNormalized) + "\"")); AGCLAnnexSubclause _subclause = annexAST.getSubclause(); EList<AGCLContract> _contracts = _subclause.getContracts(); final AGCLContract contractAST = _contracts.get(0); InputOutput.<String>println((("contract AST: \"" + contractAST) + "\"")); final String serializedContract = this.serializer.serialize(contractAST); InputOutput.<String>println((("contract AST serialized: \"" + serializedContract) + "\"")); Assert.assertEquals(contractSrcNormalized, serializedContract); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Before public void setUp() { InputOutput.<String>println("* AGCLPSLTransformTests.setUp"); AGCLStandaloneSetup _aGCLStandaloneSetup = new AGCLStandaloneSetup(); final Injector injector = _aGCLStandaloneSetup.createInjectorAndDoEMFRegistration(); Serializer _instance = injector.<Serializer>getInstance(Serializer.class); this.serializer = _instance; }