1 22 23 package com.sosnoski.util.queue; 24 25 36 37 public class IntQueue extends QueueBase 38 { 39 40 protected int[] m_baseArray; 41 42 48 49 public IntQueue(int size, int growth) { 50 super(size, growth, int.class); 51 } 52 53 58 59 public IntQueue(int size) { 60 super(size, int.class); 61 } 62 63 66 67 public IntQueue() { 68 this(DEFAULT_SIZE); 69 } 70 71 76 77 public IntQueue(IntQueue base) { 78 super(base); 79 } 80 81 87 88 protected Object getArray() { 89 return m_baseArray; 90 } 91 92 98 99 protected void setArray(Object array) { 100 m_baseArray = (int[]) array; 101 } 102 103 109 110 public void add(int item) { 111 int index = getAddIndex(); 112 m_baseArray[index] = item; 113 } 114 115 122 123 public int remove() { 124 return m_baseArray[getRemoveIndex()]; 125 } 126 127 133 134 public int[] toArray() { 135 return (int[]) buildArray(int.class); 136 } 137 138 143 144 public Object clone() { 145 return new IntQueue(this); 146 } 147 } 148 | Popular Tags |