@Test public void testPull1() { QueueSource src = new QueueSource(); src.setEvents(0, 1, 2, 3, 4); Divert div = new Divert(); Connector.connect(src, div); Pullable p = div.getPullableOutput(0); Object o; o = p.pull(); assertEquals(0, o); assertTrue(p.hasNext()); o = p.pull(); assertEquals(1, o); o = p.pullSoft(); assertEquals(2, o); o = p.next(); assertEquals(3, o); assertEquals(div, p.getProcessor()); assertEquals(0, p.getPosition()); assertEquals(p, p.iterator()); p.start(); p.stop(); p.dispose(); }
@Override public Pullable getPullableOutput(int index) { if (index > 0) { throw new IndexOutOfBoundsException( "This processor does not have a pushable at index " + index); } if (m_outputPullable == null) { m_outputPullable = new DivertPullable(); } return m_outputPullable; }
Divert extends Processor { @Override public Pullable getPullableOutput(int index) { if (index > 0) { throw new IndexOutOfBoundsException( "This processor does not have a pushable at index " + index); } if (m_outputPullable == null) { m_outputPullable = new DivertPullable(); } return m_outputPullable; } }
Divert extends Processor { @Override public Pullable getPullableOutput(int index) { if (index > 0) { throw new IndexOutOfBoundsException( "This processor does not have a pushable at index " + index); } if (m_outputPullable == null) { m_outputPullable = new DivertPullable(); } return m_outputPullable; } Divert(); }
Divert extends Processor { @Override public Pullable getPullableOutput(int index) { if (index > 0) { throw new IndexOutOfBoundsException( "This processor does not have a pushable at index " + index); } if (m_outputPullable == null) { m_outputPullable = new DivertPullable(); } return m_outputPullable; } Divert(); Divert divertTo(int index); @Override Divert duplicate(boolean with_state); @Override synchronized void setPushableOutput(int i, /*@ non_null @*/ Pushable p); @Override Pushable getPushableInput(int index); @Override Pullable getPullableOutput(int index); }
Divert extends Processor { @Override public Pullable getPullableOutput(int index) { if (index > 0) { throw new IndexOutOfBoundsException( "This processor does not have a pushable at index " + index); } if (m_outputPullable == null) { m_outputPullable = new DivertPullable(); } return m_outputPullable; } Divert(); Divert divertTo(int index); @Override Divert duplicate(boolean with_state); @Override synchronized void setPushableOutput(int i, /*@ non_null @*/ Pushable p); @Override Pushable getPushableInput(int index); @Override Pullable getPullableOutput(int index);  }