1 7 8 package java.awt.image; 9 10 17 18 public final class DataBufferDouble extends DataBuffer { 19 20 21 double bankdata[][]; 22 23 24 double data[]; 25 26 32 public DataBufferDouble(int size) { 33 super(TYPE_DOUBLE, size); 34 data = new double[size]; 35 bankdata = new double[1][]; 36 bankdata[0] = data; 37 } 38 39 48 public DataBufferDouble(int size, int numBanks) { 49 super(TYPE_DOUBLE, size, numBanks); 50 bankdata = new double[numBanks][]; 51 for (int i= 0; i < numBanks; i++) { 52 bankdata[i] = new double[size]; 53 } 54 data = bankdata[0]; 55 } 56 57 68 public DataBufferDouble(double dataArray[], int size) { 69 super(TYPE_DOUBLE, size); 70 data = dataArray; 71 bankdata = new double[1][]; 72 bankdata[0] = data; 73 } 74 75 88 public DataBufferDouble(double dataArray[], int size, int offset) { 89 super(TYPE_DOUBLE, size, 1, offset); 90 data = dataArray; 91 bankdata = new double[1][]; 92 bankdata[0] = data; 93 } 94 95 106 public DataBufferDouble(double dataArray[][], int size) { 107 super(TYPE_DOUBLE, size, dataArray.length); 108 bankdata = (double[][]) dataArray.clone(); 109 data = bankdata[0]; 110 } 111 112 125 public DataBufferDouble(double dataArray[][], int size, int offsets[]) { 126 super(TYPE_DOUBLE, size, dataArray.length, offsets); 127 bankdata = (double[][]) dataArray.clone(); 128 data = bankdata[0]; 129 } 130 131 135 public double[] getData() { 136 return data; 137 } 138 139 144 public double[] getData(int bank) { 145 return bankdata[bank]; 146 } 147 148 152 public double[][] getBankData() { 153 return (double[][]) bankdata.clone(); 154 } 155 156 165 public int getElem(int i) { 166 return (int)(data[i+offset]); 167 } 168 169 180 public int getElem(int bank, int i) { 181 return (int)(bankdata[bank][i+offsets[bank]]); 182 } 183 184 193 public void setElem(int i, int val) { 194 data[i+offset] = (double)val; 195 } 196 197 207 public void setElem(int bank, int i, int val) { 208 bankdata[bank][i+offsets[bank]] = (double)val; 209 } 210 211 221 public float getElemFloat(int i) { 222 return (float)data[i+offset]; 223 } 224 225 236 public float getElemFloat(int bank, int i) { 237 return (float)bankdata[bank][i+offsets[bank]]; 238 } 239 240 249 public void setElemFloat(int i, float val) { 250 data[i+offset] = (double)val; 251 } 252 253 263 public void setElemFloat(int bank, int i, float val) { 264 bankdata[bank][i+offsets[bank]] = (double)val; 265 } 266 267 277 public double getElemDouble(int i) { 278 return data[i+offset]; 279 } 280 281 292 public double getElemDouble(int bank, int i) { 293 return bankdata[bank][i+offsets[bank]]; 294 } 295 296 305 public void setElemDouble(int i, double val) { 306 data[i+offset] = val; 307 } 308 309 319 public void setElemDouble(int bank, int i, double val) { 320 bankdata[bank][i+offsets[bank]] = val; 321 } 322 } 323 | Popular Tags |