public static void main(String[] args) { Queue q = new Queue(); for (int i = 0; i < 10; ++i) q.offer(i); q.toString(); for (int i = 0; i < 10; ++i) { System.out.println(q.peek()); q.poll(); } q.toString(); }
void checkIterationSanity(Queue q) { if (rnd.nextBoolean()) return; int size = q.size(); Object[] a = q.toArray(); Object[] b = new Object[size + 2]; Arrays.fill(b, Boolean.TRUE); Object[] c = q.toArray(b); equal(a.length, size); check(b == c); check(b[size] == null); check(b[size + 1] == Boolean.TRUE); equal(q.toString(), Arrays.toString(a)); Integer[] xx = null, yy = null; if (size > 0) { xx = new Integer[size - 1]; Arrays.fill(xx, 42); yy = ((Queue<Integer>) q).toArray(xx); for (Integer zz : xx) equal(42, zz); } Iterator it = q.iterator(); for (int i = 0; i < size; i++) { check(it.hasNext()); Object x = it.next(); check(x == a[i]); check(x == b[i]); if (xx != null) check(x == yy[i]); } check(!it.hasNext()); }
public String toString() { String manager = null; Queue<MessageBean> queue = QUEUE_LOCAL.get(); if (queue != null) { manager = queue.toString(); } return manager; }
private void handleSecondTX(SinkData channel, Time currentTime) throws IllegalActionException { IntToken token = new IntToken(currentChannel); output.send(0, token); channel.state = states.FINISHED; System.out.println( "SECONDTX on channel " + currentChannel + ". t is " + channel.t + " currentTime is " + currentTime); System.out.println(channelQueue.toString()); }
public void enqueue(Segment segment, long clock) { // retrieving the MSS of the segment in bytes long segmentMss = segment.getMss(); // checking for freeSpace in router and if there is no free space // then we remove the segment from the List otherwise we // decrement the free space if (freeSpace >= segmentMss) { freeSpace = freeSpace - segmentMss; routerQueue.add(segment); // for calculating the queuing delay segment.setBufferStartTime(clock); if (printOut) System.out.println("Segment enqueued onto the Router:" + segment); } else { if (printOut) System.out.println("Segment dropped b/c Router Buffer Overflow:" + segment); } if (printOut) System.out.println("Router Queue: " + routerQueue.toString()); }
@Override public String toString() { return pq.toString(); }
public String toString() { return "Many: " + vals.toString(); }
@GET @Produces(MediaType.TEXT_PLAIN) public String listItems() { return ITEMS.toString(); }
public void testToString() { forward.toString(); assertEquals("[toString]", getCalls()); }
@Override public String toString() { return queue.toString(); }