/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hw6; /** * * @author kvaradar */ public class MyQueue implements Queue { E [] Q; //the array to store the elements of the queue int f,r;//roughly, the front and rear of the queue, but see 5.2.2 of text int size;//the number of elements in the queue static final int CAPACITY = 1000; //default length of Q int capacity; // actual length of Q public MyQueue() { this(CAPACITY); } public MyQueue(int cap){ capacity = cap; Q = (E []) new Object[capacity]; f = 0; r = 0; size = 0; } }