01: package it.geosolutions.imageio.plugins.jhdf;
02:
03: public abstract class HDFProducts {
04: private HDFProduct[] productList;
05: private int nProducts;
06:
07: public HDFProducts(final int nProducts) {
08: productList = new HDFProduct[nProducts];
09: this .nProducts = nProducts;
10: }
11:
12: public void setHDFProduct(final int productIndex, HDFProduct product) {
13: if (productIndex > nProducts)
14: throw new ArrayIndexOutOfBoundsException(
15: "Specified product index is out of range");
16: else
17: productList[productIndex] = product;
18: }
19:
20: public HDFProduct getHDFProduct(final int productIndex) {
21: if (productIndex > nProducts)
22: throw new ArrayIndexOutOfBoundsException(
23: "Specified product index is out of range");
24: else
25: return productList[productIndex];
26: }
27:
28: public HDFProduct getHDFProduct(final String productName) {
29: final int prodNum = nProducts;
30: for (int i = 0; i < prodNum; i++) {
31: final HDFProduct product = productList[i];
32: if (product.getProductName().equals(productName))
33: return product;
34: }
35: return null;
36: }
37:
38: public class HDFProduct {
39: private String productName;
40: private int nBands;
41:
42: public HDFProduct(final String productName, final int nBands) {
43: this .productName = productName;
44: this .nBands = nBands;
45: }
46:
47: public int getNBands() {
48: return nBands;
49: }
50:
51: public String getProductName() {
52: return productName;
53: }
54: }
55:
56: }
|