// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }
// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }
// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }
// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }
// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }
// test for enqueue System.out.println("\n---test enqueue---\n"); for (inti=0; i < capacity + 1; i++) { Strings="" + i;
booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } }
// test for dequeue and enqueue System.out.println("\n---test dequeue and enqueue---\n"); for (inti=0; i < capacity + 2; i++) { Strings="" + (i + capacity);
if (i < capacity / 2) { s = queue.dequeue(); System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { booleanok= queue.enqueue(s); if (ok) { System.out.println(String.format("enqueue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is full"); break; } } }
// test for dequeue System.out.println("\n---test dequeue---\n"); while (true) { Strings= queue.dequeue(); if (s != null) { System.out.println(String.format("dequeue value %2s , queue is %s", s, queue.toString())); } else { System.out.println("queue is empty"); break; } } } }