@Test public void testAllGrammarElementsUnique() { try { final ContentAssistFragmentTestLanguageRoot result = this.parseHelper.parse("newArrayList()"); Resource _eResource = result.eResource(); final XtextResource res = ((XtextResource) _eResource); final ICompositeNode root = res.getParseResult().getRootNode(); new InvariantChecker().checkInvariant(root); final HashSet<EObject> set = CollectionLiterals.<EObject>newHashSet(); BidiTreeIterable<INode> _asTreeIterable = root.getAsTreeIterable(); for (final INode node : _asTreeIterable) { if ((node instanceof ICompositeNode)) { EObject _grammarElement = ((ICompositeNode)node).getGrammarElement(); boolean _tripleNotEquals = (_grammarElement != null); if (_tripleNotEquals) { Assert.assertTrue(((ICompositeNode)node).getGrammarElement().toString(), set.add(((ICompositeNode)node).getGrammarElement())); } else { Assert.fail("node without grammar element"); } } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void testAllGrammarElementsUniqueAfterReparse() { try { final ContentAssistFragmentTestLanguageRoot result = this.parseHelper.parse(""); Resource _eResource = result.eResource(); final XtextResource res = ((XtextResource) _eResource); res.update(0, 0, "newArrayList()"); final ICompositeNode root = res.getParseResult().getRootNode(); final HashSet<EObject> set = CollectionLiterals.<EObject>newHashSet(); BidiTreeIterable<INode> _asTreeIterable = root.getAsTreeIterable(); for (final INode node : _asTreeIterable) { if ((node instanceof ICompositeNode)) { EObject _grammarElement = ((ICompositeNode)node).getGrammarElement(); boolean _tripleNotEquals = (_grammarElement != null); if (_tripleNotEquals) { Assert.assertTrue(((ICompositeNode)node).getGrammarElement().toString(), set.add(((ICompositeNode)node).getGrammarElement())); } else { Assert.fail("node without grammar element"); } } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
public ReversedBidiTreeIterable(BidiTreeIterable<T> delegate) { super(delegate); }
@Override public BidiTreeIterable<T> reverse() { return getDelegate(); }
@Override protected BidiTreeIterable<T> getDelegate() { return (BidiTreeIterable<T>) super.getDelegate(); }
@Override public BidiTreeIterable<INode> getAsTreeIterable() { return this; }
@Override public BidiTreeIterable<INode> reverse() { return new ReversedBidiTreeIterable<INode>(this); }
/** {@inheritDoc} */ @Override public BidiTreeIterable<INode> getAsTreeIterable() { initializeDelegateNode(); return this; // delegateNode.getAsTreeIterable(); }