All pastes #2067121 Raw Edit

ArrayQueue.java

public java v1 · immutable
#2067121 ·published 2011-05-22 20:24 UTC
rendered paste body
package datastructs;public class ArrayQueue {      private Object [] array;    private int start, end;    private boolean full;    public ArrayQueue(int maxSize) {        start = end = 0;        full = false;        array = new Object[maxSize];    }    public void enqueue(Object object){        if(!full){            array[start] = object;            start++;        }        if(start == end){            full = true;        }    }    public Object dequeue(){        if(full) full = false;        return array[end++];    }}