001 /*
002 * This file is part of McIDAS-V
003 *
004 * Copyright 2007-2013
005 * Space Science and Engineering Center (SSEC)
006 * University of Wisconsin - Madison
007 * 1225 W. Dayton Street, Madison, WI 53706, USA
008 * https://www.ssec.wisc.edu/mcidas
009 *
010 * All Rights Reserved
011 *
012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
013 * some McIDAS-V source code is based on IDV and VisAD source code.
014 *
015 * McIDAS-V is free software; you can redistribute it and/or modify
016 * it under the terms of the GNU Lesser Public License as published by
017 * the Free Software Foundation; either version 3 of the License, or
018 * (at your option) any later version.
019 *
020 * McIDAS-V is distributed in the hope that it will be useful,
021 * but WITHOUT ANY WARRANTY; without even the implied warranty of
022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023 * GNU Lesser Public License for more details.
024 *
025 * You should have received a copy of the GNU Lesser Public License
026 * along with this program. If not, see http://www.gnu.org/licenses.
027 */
028
029 package edu.wisc.ssec.mcidasv.data.hydra;
030
031 public class HDFArray {
032
033 Class type;
034 int length;
035
036 public HDFArray(Class type) {
037 this.type = type;
038 }
039
040 public Object getArray() {
041 return null;
042 }
043
044 public Class getType() {
045 return type;
046 }
047
048 public static HDFArray make(float[] array) {
049 return new HDFFloatArray(array);
050 }
051
052 public static HDFArray make(double[] array) {
053 return new HDFDoubleArray(array);
054 }
055
056 public static HDFArray make(int[] array) {
057 return new HDFIntArray(array);
058 }
059
060 public static HDFArray make(short[] array) {
061 return new HDFShortArray(array);
062 }
063
064 public static HDFArray make(String[] array) {
065 return new HDFStringArray(array);
066 }
067 }
068
069 class HDFFloatArray extends HDFArray {
070 float[] float_array;
071 public HDFFloatArray(float[] fa) {
072 super(Float.TYPE);
073 float_array = fa;
074 length = fa.length;
075 }
076 public float[] getArray() {
077 return float_array;
078 }
079 }
080
081 class HDFDoubleArray extends HDFArray {
082 double[] double_array;
083 public HDFDoubleArray(double[] da) {
084 super(Double.TYPE);
085 double_array = da;
086 length = da.length;
087 }
088 public double[] getArray() {
089 return double_array;
090 }
091 }
092
093 class HDFShortArray extends HDFArray {
094 short[] short_array;
095 public HDFShortArray(short[] sa) {
096 super(Short.TYPE);
097 short_array = sa;
098 length = sa.length;
099 }
100 public short[] getArray() {
101 return short_array;
102 }
103 }
104
105 class HDFIntArray extends HDFArray {
106 int[] int_array;
107 public HDFIntArray(int[] ia) {
108 super(Integer.TYPE);
109 int_array = ia;
110 length = ia.length;
111 }
112 public int[] getArray() {
113 return int_array;
114 }
115 }
116
117 class HDFByteArray extends HDFArray {
118 byte[] byte_array;
119 public HDFByteArray(byte[] ba) {
120 super(Byte.TYPE);
121 byte_array = ba;
122 length = ba.length;
123 }
124 public byte[] getArray() {
125 return byte_array;
126 }
127 }
128
129
130 class HDFStringArray extends HDFArray {
131 String[] string_array;
132 public HDFStringArray(String[] sa) {
133 super(String.class);
134 string_array = sa;
135 length = sa.length;
136 }
137 public String[] getArray() {
138 return string_array;
139 }
140 }