public final E pop() { if (index >= size) { extendStack(size * 2); } return stack[index++]; }
private void extendStack(int argSize) { E[] newStack = newArray(argSize); if (stack != null) { System.arraycopy(stack, 0, newStack, 0, size); } for (int i = 0; i < newStack.length; i++) { newStack[i] = newInstance(); } stack = newStack; size = newStack.length; }
int x = JBoxUtils.max(0, JBoxUtils.min((int) g.center.x, m_countX - 1)); int y = JBoxUtils.max(0, JBoxUtils.min((int) g.center.y, m_countY - 1)); queue.push(taskPool.pop().set(x, y, x + y * m_countX, g)); m_diagram[i] = g; if (x > 0) { queue.push(taskPool.pop().set(x - 1, y, i - 1, g)); queue.push(taskPool.pop().set(x, y - 1, i - m_countX, g)); queue.push(taskPool.pop().set(x + 1, y, i + 1, g)); queue.push(taskPool.pop().set(x, y + 1, i + m_countX, g)); taskPool.push(front); Generator b = m_diagram[i + 1]; if (a != b) { queue.push(taskPool.pop().set(x, y, i, b)); queue.push(taskPool.pop().set(x + 1, y, i + 1, a)); Generator b = m_diagram[i + m_countX]; if (a != b) { queue.push(taskPool.pop().set(x, y, i, b)); queue.push(taskPool.pop().set(x, y + 1, i + m_countX, a)); m_diagram[i] = b; if (x > 0) { queue.push(taskPool.pop().set(x - 1, y, i - 1, b));
int x = JBoxUtils.max(0, JBoxUtils.min((int) g.center.x, m_countX - 1)); int y = JBoxUtils.max(0, JBoxUtils.min((int) g.center.y, m_countY - 1)); queue.push(taskPool.pop().set(x, y, x + y * m_countX, g)); m_diagram[i] = g; if (x > 0) { queue.push(taskPool.pop().set(x - 1, y, i - 1, g)); queue.push(taskPool.pop().set(x, y - 1, i - m_countX, g)); queue.push(taskPool.pop().set(x + 1, y, i + 1, g)); queue.push(taskPool.pop().set(x, y + 1, i + m_countX, g)); taskPool.push(front); Generator b = m_diagram[i + 1]; if (a != b) { queue.push(taskPool.pop().set(x, y, i, b)); queue.push(taskPool.pop().set(x + 1, y, i + 1, a)); Generator b = m_diagram[i + m_countX]; if (a != b) { queue.push(taskPool.pop().set(x, y, i, b)); queue.push(taskPool.pop().set(x, y + 1, i + m_countX, a)); m_diagram[i] = b; if (x > 0) { queue.push(taskPool.pop().set(x - 1, y, i - 1, b));
private void extendStack(int argSize) { E[] newStack = newArray(argSize); if (stack != null) { System.arraycopy(stack, 0, newStack, 0, size); } for (int i = 0; i < newStack.length; i++) { newStack[i] = newInstance(); } stack = newStack; size = newStack.length; }
public MutableStack(int argInitSize) { index = 0; stack = null; index = 0; extendStack(argInitSize); }
public final E pop() { if (index >= size) { extendStack(size * 2); } return stack[index++]; }
public MutableStack(int argInitSize) { index = 0; stack = null; index = 0; extendStack(argInitSize); }