1 33 package smallsql.database; 34 35 39 final class DataSources { 40 41 private int size; 42 private DataSource[] data = new DataSource[4]; 43 44 final int size(){ 45 return size; 46 } 47 48 final DataSource get(int idx){ 49 if (idx >= size) 50 throw new IndexOutOfBoundsException ("Index: "+idx+", Size: "+size); 51 return data[idx]; 52 } 53 54 final void add(DataSource table){ 55 if(size >= data.length ){ 56 DataSource[] dataNew = new DataSource[size << 1]; 57 System.arraycopy(data, 0, dataNew, 0, size); 58 data = dataNew; 59 } 60 data[size++] = table; 61 } 62 } 63 | Popular Tags |