1 21 22 package hero.client.grapheditor; 23 24 import java.util.Vector ; 25 26 31 32 public class Queue 33 { 34 private static int size; 35 Vector array; 36 37 public Queue() 38 { 39 array = new Vector (); 40 } 41 42 public int push(int item) 43 { 44 int num; 45 array.addElement(new Integer (item)); 46 num = array.size(); 47 return num; 48 } 49 50 public int pop() 51 { 52 int item; 53 item = ((Integer )array.elementAt(0)).intValue(); 54 array.removeElementAt(0); 55 return item; 56 } 57 58 public boolean isEmpty() 59 { 60 return(array.isEmpty()); 61 } 62 } 63 | Popular Tags |