Java 类org.eclipse.xtext.nodemodel.BidiTreeIterable 实例源码

项目:xtext-extras    文件:Bug480686Test.java   
@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);
  }
}
项目:xtext-extras    文件:Bug480686Test.java   
@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);
  }
}
项目:xtext-core    文件:ReversedBidiTreeIterable.java   
public ReversedBidiTreeIterable(BidiTreeIterable<T> delegate) {
    super(delegate);
}
项目:xtext-core    文件:ReversedBidiTreeIterable.java   
@Override
public BidiTreeIterable<T> reverse() {
    return getDelegate();
}
项目:xtext-core    文件:ReversedBidiTreeIterable.java   
@Override
protected BidiTreeIterable<T> getDelegate() {
    return (BidiTreeIterable<T>) super.getDelegate();
}
项目:xtext-core    文件:AbstractNode.java   
@Override
public BidiTreeIterable<INode> getAsTreeIterable() {
    return this;
}
项目:xtext-core    文件:AbstractNode.java   
@Override
public BidiTreeIterable<INode> reverse() {
    return new ReversedBidiTreeIterable<INode>(this);
}
项目:xtext-core    文件:SyntheticCompositeNode.java   
@Override
public BidiTreeIterable<INode> getAsTreeIterable() {
    return this;
}
项目:xtext-core    文件:SyntheticCompositeNode.java   
@Override
public BidiTreeIterable<INode> reverse() {
    return new ReversedBidiTreeIterable<INode>(this);
}
项目:dsl-devkit    文件:LazyLoadingCompositeNode.java   
/** {@inheritDoc} */
@Override
public BidiTreeIterable<INode> getAsTreeIterable() {
  initializeDelegateNode();
  return this; // delegateNode.getAsTreeIterable();
}