Guest User

Untitled

a guest
Jan 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. public class Coda
  2. {
  3. private Comparable[] array;
  4. private int front;
  5. private int back;
  6. public Coda()
  7. {
  8. array = new Comparable[10];
  9. makeEmpty();
  10. }
  11. public void makeEmpty()
  12. {
  13. front = 0;
  14. back = 0;
  15. }
  16. public boolean isEmpty()
  17. {
  18. return (front == back);
  19. }
  20. protected static int increment (int index)
  21. {
  22. return (index+1)%array.length;
  23. }
  24. private static Comparable[] resize(Comparable[] a, int newdim)
  25. {
  26. Comparable[] n = new Comparable[newdim];
  27. System.arraycopy(a,0,n,0,a.length);
  28. return n;
  29. }
Add Comment
Please, Sign In to add comment