@SuppressWarnings("unchecked") @Test public void testExtendArityFork() { Passthrough p1 = new Passthrough(1); Fork fork = new Fork(2); Connector.connect(p1, fork); Pushable push = p1.getPushableInput(0); QueueSink[] sinks = new QueueSink[3]; Queue<Object>[] queues = new Queue[3]; for (int i = 0; i < 2; i++) { sinks[i] = new QueueSink(1); Connector.connect(fork, i, sinks[i], 0); queues[i] = sinks[i].getQueue(0); } fork.extendOutputArity(3); sinks[2] = new QueueSink(1); Connector.connect(fork, 2, sinks[2], 0); queues[2] = sinks[2].getQueue(0); for (int k = 0; k < 2; k++) { for (int i = 0; i < 5; i++) { push.push(i); for (int j = 0; j < 3; j++) { Utilities.queueContains(i, queues[j]); } } } }
@SuppressWarnings("unchecked") public void extendOutputArity(int out_arity) { m_outputArray = new Object[out_arity]; m_outputQueues = new Queue[out_arity]; Pullable[] new_out_pullables = new Pullable[out_arity]; for (int i = 0; i < m_outputArity; i++) { new_out_pullables[i] = m_outputPullables[i]; } m_outputPullables = new_out_pullables; m_outputArity = out_arity; for (int i = 0; i < m_outputArity; i++) { m_outputQueues[i] = new ArrayDeque<Object>(); } Pushable[] out_pushables = new Pushable[out_arity]; for (int i = 0; i < m_outputPushables.length; i++) { out_pushables[i] = m_outputPushables[i]; } m_outputPushables = out_pushables; }
Fork extends UniformProcessor { @SuppressWarnings("unchecked") public void extendOutputArity(int out_arity) { m_outputArray = new Object[out_arity]; m_outputQueues = new Queue[out_arity]; Pullable[] new_out_pullables = new Pullable[out_arity]; for (int i = 0; i < m_outputArity; i++) { new_out_pullables[i] = m_outputPullables[i]; } m_outputPullables = new_out_pullables; m_outputArity = out_arity; for (int i = 0; i < m_outputArity; i++) { m_outputQueues[i] = new ArrayDeque<Object>(); } Pushable[] out_pushables = new Pushable[out_arity]; for (int i = 0; i < m_outputPushables.length; i++) { out_pushables[i] = m_outputPushables[i]; } m_outputPushables = out_pushables; } }
Fork extends UniformProcessor { @SuppressWarnings("unchecked") public void extendOutputArity(int out_arity) { m_outputArray = new Object[out_arity]; m_outputQueues = new Queue[out_arity]; Pullable[] new_out_pullables = new Pullable[out_arity]; for (int i = 0; i < m_outputArity; i++) { new_out_pullables[i] = m_outputPullables[i]; } m_outputPullables = new_out_pullables; m_outputArity = out_arity; for (int i = 0; i < m_outputArity; i++) { m_outputQueues[i] = new ArrayDeque<Object>(); } Pushable[] out_pushables = new Pushable[out_arity]; for (int i = 0; i < m_outputPushables.length; i++) { out_pushables[i] = m_outputPushables[i]; } m_outputPushables = out_pushables; } Fork(int out_arity);  Fork(); }
Fork extends UniformProcessor { @SuppressWarnings("unchecked") public void extendOutputArity(int out_arity) { m_outputArray = new Object[out_arity]; m_outputQueues = new Queue[out_arity]; Pullable[] new_out_pullables = new Pullable[out_arity]; for (int i = 0; i < m_outputArity; i++) { new_out_pullables[i] = m_outputPullables[i]; } m_outputPullables = new_out_pullables; m_outputArity = out_arity; for (int i = 0; i < m_outputArity; i++) { m_outputQueues[i] = new ArrayDeque<Object>(); } Pushable[] out_pushables = new Pushable[out_arity]; for (int i = 0; i < m_outputPushables.length; i++) { out_pushables[i] = m_outputPushables[i]; } m_outputPushables = out_pushables; } Fork(int out_arity);  Fork(); @Override Fork duplicate(boolean with_state); @SuppressWarnings("unchecked") void extendOutputArity(int out_arity); Object printState(); @Override Fork readState(Object o); }
Fork extends UniformProcessor { @SuppressWarnings("unchecked") public void extendOutputArity(int out_arity) { m_outputArray = new Object[out_arity]; m_outputQueues = new Queue[out_arity]; Pullable[] new_out_pullables = new Pullable[out_arity]; for (int i = 0; i < m_outputArity; i++) { new_out_pullables[i] = m_outputPullables[i]; } m_outputPullables = new_out_pullables; m_outputArity = out_arity; for (int i = 0; i < m_outputArity; i++) { m_outputQueues[i] = new ArrayDeque<Object>(); } Pushable[] out_pushables = new Pushable[out_arity]; for (int i = 0; i < m_outputPushables.length; i++) { out_pushables[i] = m_outputPushables[i]; } m_outputPushables = out_pushables; } Fork(int out_arity);  Fork(); @Override Fork duplicate(boolean with_state); @SuppressWarnings("unchecked") void extendOutputArity(int out_arity); Object printState(); @Override Fork readState(Object o);  }