Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Coda
- {
- private Comparable[] array;
- private int front;
- private int back;
- public Coda()
- {
- array = new Comparable[10];
- makeEmpty();
- }
- public void makeEmpty()
- {
- front = 0;
- back = 0;
- }
- public boolean isEmpty()
- {
- return (front == back);
- }
- protected static int increment (int index)
- {
- return (index+1)%array.length;
- }
- private static Comparable[] resize(Comparable[] a, int newdim)
- {
- Comparable[] n = new Comparable[newdim];
- System.arraycopy(a,0,n,0,a.length);
- return n;
- }
Add Comment
Please, Sign In to add comment