Java Code Examples for org.eclipse.xtext.nodemodel.impl.AbstractNode#iterator()
The following examples show how to use
org.eclipse.xtext.nodemodel.impl.AbstractNode#iterator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testIterator_Next() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasNext()); assertSame(node, iterator.next()); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 2
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testIterator_Previous() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertFalse(iterator.hasPrevious()); try { iterator.previous(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 3
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testIterator_Bidi() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertSame(node, iterator.next()); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertTrue(iterator.hasNext()); }
Example 4
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Next() { ICompositeNode rootNode = builder.newRootNode("input"); AbstractNode node = createNode(); builder.addChild(rootNode, node); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasNext()); assertSame(node, iterator.next()); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 5
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Next_NoParent() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasNext()); assertSame(node, iterator.next()); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 6
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Previous() { ICompositeNode rootNode = builder.newRootNode("input"); AbstractNode node = createNode(); builder.addChild(rootNode, node); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertFalse(iterator.hasPrevious()); try { iterator.previous(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 7
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Previous_NoParent() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertFalse(iterator.hasPrevious()); try { iterator.previous(); fail("Expected NoSuchElementException"); } catch(NoSuchElementException e) { // ok } }
Example 8
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Bidi() { ICompositeNode rootNode = builder.newRootNode("input"); AbstractNode node = createNode(); builder.addChild(rootNode, node); BidiIterator<INode> iterator = node.iterator(); assertSame(node, iterator.next()); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertTrue(iterator.hasNext()); }
Example 9
Source File: AbstractNodeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTreeIterator_Bidi_NoParent() { AbstractNode node = createNode(); BidiIterator<INode> iterator = node.iterator(); assertSame(node, iterator.next()); assertTrue(iterator.hasPrevious()); assertSame(node, iterator.previous()); assertTrue(iterator.hasNext()); }