diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index f76545c2ea..6ab86ef8b8 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -1,4 +1,4 @@ -on: [pull_request] +on: [push,pull_request] jobs: check-dependency-availability: diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 44309a647f..5cc5e71c0b 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,4 +1,4 @@ -on: [pull_request] +on: [push,pull_request] jobs: check-style: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 465ebc5ad4..214d68e14e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -on: [pull_request] +on: [push,pull_request] jobs: netcdf-java-tests: diff --git a/README.md b/README.md index 61d0e90907..eb6b70ada1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@

+ # netCDF-Java/CDM The netCDF Java library provides an interface for scientific data access. diff --git a/cdm-test-utils/src/main/java/ucar/unidata/util/test/UnitTestCommon.java b/cdm-test-utils/src/main/java/ucar/unidata/util/test/UnitTestCommon.java index 8809a4a0b7..04607014ac 100644 --- a/cdm-test-utils/src/main/java/ucar/unidata/util/test/UnitTestCommon.java +++ b/cdm-test-utils/src/main/java/ucar/unidata/util/test/UnitTestCommon.java @@ -209,16 +209,6 @@ public String modify(String text) { ////////////////////////////////////////////////// // Instance variables - // System properties - protected boolean prop_ascii = true; - protected boolean prop_diff = true; - protected boolean prop_baseline = false; - protected boolean prop_visual = false; - protected boolean prop_debug = DEBUG; - protected boolean prop_generate = true; - protected String prop_controls = null; - protected boolean prop_display = false; - protected String title = "Testing"; protected String name = "testcommon"; @@ -231,32 +221,6 @@ public UnitTestCommon() { public UnitTestCommon(String name) { this.title = name; - setSystemProperties(); - } - - /** - * Try to get the system properties - */ - protected void setSystemProperties() { - if (System.getProperty("nodiff") != null) - prop_diff = false; - if (System.getProperty("baseline") != null) - prop_baseline = true; - if (System.getProperty("nogenerate") != null) - prop_generate = false; - if (System.getProperty("debug") != null) - prop_debug = true; - if (System.getProperty("visual") != null) - prop_visual = true; - if (System.getProperty("ascii") != null) - prop_ascii = true; - if (System.getProperty("utf8") != null) - prop_ascii = false; - if (System.getProperty("hasdisplay") != null) - prop_display = true; - if (prop_baseline && prop_diff) - prop_diff = false; - prop_controls = System.getProperty("controls", ""); } ////////////////////////////////////////////////// @@ -379,12 +343,10 @@ protected void unbindstd() { // Copy result into the a specified dir public static void writefile(String path, String content) throws IOException { - File f = new File(path); - if (f.exists()) - f.delete(); - FileWriter out = new FileWriter(f); - out.write(content); - out.close(); + // We need to set the Charset to UTF-8, but that is not possible + // until JDK level 11, so fake it. + byte utf8[] = content.getBytes("UTF-8"); + writefile(path, utf8); } // Copy result into the a specified dir @@ -616,75 +578,4 @@ protected static boolean check(int code, int[] ok) { return false; } - /* - * // Replacement for stderr & stdout - * static public class STDIO - * { - * public STDIO(String name) - * { - * } - * - * public void - * printf(String format, Object... args) - * { - * System.err.println(String.format(format, args)); - * } - * - * public void - * println(String msg) - * { - * printf("%s%n", msg); - * } - * - * public void - * print(String msg) - * { - * printf("%s", msg); - * } - * - * public void - * flush() - * { - * } - * } - * - * static public STDIO stderr = new STDIO("test"); - * static public STDIO stdout = new STDIO("test"); - * - * static TemporaryFolder temporaryfolder = null; - * - * static public File - * makeTemporaryDir(String name) - * throws IOException - * { - * if(temporaryfolder == null) - * temporaryfolder = new TemporaryFolder(); - * return temporaryfolder.newFolder(name); - * } - * - * static public File - * makeTemporaryFile(String name) - * throws IOException - * { - * if(temporaryfolder == null) - * temporaryfolder = new TemporaryFolder(); - * return temporaryfolder.newFile(name); - * } - * static public void - * logify(String s) - * { - * StringReader rs = new StringReader(s); - * BufferedReader r = new BufferedReader(rs); - * String line = null; - * for(; ; ) { - * try { - * line = r.readLine(); - * } catch (IOException ioe) { - * break; - * } - * if(line == null) break; - * System.err.println(line); - * } - * } - */ } diff --git a/cdm/core/src/main/java/ucar/ma2/Index.java b/cdm/core/src/main/java/ucar/ma2/Index.java index 11f6ebb0a6..7d3fea3420 100644 --- a/cdm/core/src/main/java/ucar/ma2/Index.java +++ b/cdm/core/src/main/java/ucar/ma2/Index.java @@ -570,7 +570,7 @@ public Index set(int[] index) { throw new ArrayIndexOutOfBoundsException(); if (rank == 0) return this; - int prefixrank = (hasvlen ? rank : rank - 1); + int prefixrank = (!hasvlen ? rank : rank - 1); System.arraycopy(index, 0, current, 0, prefixrank); if (hasvlen) current[prefixrank] = -1; diff --git a/cdm/core/src/main/java/ucar/nc2/Attribute.java b/cdm/core/src/main/java/ucar/nc2/Attribute.java index b8ab59955d..fc20509233 100644 --- a/cdm/core/src/main/java/ucar/nc2/Attribute.java +++ b/cdm/core/src/main/java/ucar/nc2/Attribute.java @@ -32,15 +32,6 @@ * @author caron */ public class Attribute extends CDMNode { - /** @deprecated move to jni.Nc4Iosp */ - @Deprecated - private static final String SPECIALPREFIX = "_"; - - /** @deprecated move to jni.Nc4Iosp */ - @Deprecated - static public final String[] SPECIALS = - {CDM.NCPROPERTIES, CDM.ISNETCDF4, CDM.SUPERBLOCKVERSION, CDM.DAP4_LITTLE_ENDIAN, CDM.EDU_UCAR_PREFIX}; - /** * Turn a list into a map * @@ -59,20 +50,6 @@ public static Map makeMap(List atts) { return result; } - /** @deprecated move to jni.Nc4Iosp */ - @Deprecated - public static boolean isspecial(Attribute a) { - String nm = a.getShortName(); - if (nm.startsWith(SPECIALPREFIX)) { - /* Check for selected special attributes */ - for (String s : SPECIALS) { - if (nm.startsWith(s)) - return true; /* is special */ - } - } - return false; /* is not special */ - } - /////////////////////////////////////////////////////////////////////////////////// /** diff --git a/cdm/core/src/main/java/ucar/nc2/Dimension.java b/cdm/core/src/main/java/ucar/nc2/Dimension.java index a5bfc510b1..051c237ee6 100644 --- a/cdm/core/src/main/java/ucar/nc2/Dimension.java +++ b/cdm/core/src/main/java/ucar/nc2/Dimension.java @@ -457,9 +457,6 @@ public void setLength(int n) { } else if (isUnlimited) { if (n < 0) throw new IllegalArgumentException("Unlimited Dimension length =" + n + " must >= 0"); - } else { - if (n < 1) - throw new IllegalArgumentException("Dimension length =" + n + " must be > 0"); } this.length = n; } diff --git a/cdm/core/src/main/java/ucar/nc2/Group.java b/cdm/core/src/main/java/ucar/nc2/Group.java index 8ebb113285..4399c2c9bd 100755 --- a/cdm/core/src/main/java/ucar/nc2/Group.java +++ b/cdm/core/src/main/java/ucar/nc2/Group.java @@ -20,6 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ucar.ma2.DataType; +import ucar.nc2.constants.CDM; import ucar.nc2.util.EscapeStrings; import ucar.nc2.util.Indent; import java.util.ArrayList; @@ -297,7 +298,7 @@ public Dimension findDimensionLocal(String shortName) { /** The attributes contained by this Group. */ public AttributeContainer attributes() { - return AttributeContainer.filter(attributes, Attribute.SPECIALS); + return AttributeContainer.filter(attributes, CDM.SPECIALS); } /** Find the attribute by name, return null if not exist */ @@ -318,7 +319,7 @@ public String findAttributeString(String attName, String defaultValue) { /** @deprecated Use attributes() */ @Deprecated public java.util.List getAttributes() { - return AttributeContainer.filter(attributes, Attribute.SPECIALS).getAttributes(); + return attributes().getAttributes(); } /** @deprecated Use attributes() */ @@ -526,7 +527,7 @@ void writeCDL(Formatter out, Indent indent, boolean strict) { for (Attribute att : attributes) { // String name = strict ? NetcdfFile.escapeNameCDL(getShortName()) : getShortName(); - if (!Attribute.isspecial(att)) { + if (!CDM.isspecial(att)) { out.format("%s", indent); att.writeCDL(out, strict, null); out.format(";"); diff --git a/cdm/core/src/main/java/ucar/nc2/NetcdfFiles.java b/cdm/core/src/main/java/ucar/nc2/NetcdfFiles.java index 9aa9c3dba2..3806ee7b02 100644 --- a/cdm/core/src/main/java/ucar/nc2/NetcdfFiles.java +++ b/cdm/core/src/main/java/ucar/nc2/NetcdfFiles.java @@ -70,7 +70,7 @@ public class NetcdfFiles { registerIOProvider("ucar.nc2.internal.iosp.hdf5.H5iospNew"); } catch (Throwable e) { if (loadWarnings) - log.info("Cant load class H5iosp", e); + log.info("Cant load class H5iospNew", e); } try { registerIOProvider("ucar.nc2.stream.NcStreamIosp"); diff --git a/cdm/core/src/main/java/ucar/nc2/Structure.java b/cdm/core/src/main/java/ucar/nc2/Structure.java index 65ab45900b..cc9d4872e6 100644 --- a/cdm/core/src/main/java/ucar/nc2/Structure.java +++ b/cdm/core/src/main/java/ucar/nc2/Structure.java @@ -23,6 +23,7 @@ import ucar.ma2.StructureData; import ucar.ma2.StructureDataIterator; import ucar.ma2.StructureMembers; +import ucar.nc2.constants.CDM; import ucar.nc2.util.Indent; /** @@ -635,7 +636,7 @@ protected void writeCDL(Formatter buf, Indent indent, boolean useFullName, boole buf.format(";%s%n", extraInfo()); for (Attribute att : attributes()) { - if (Attribute.isspecial(att)) + if (CDM.isspecial(att)) continue; buf.format("%s", indent); att.writeCDL(buf, strict, getShortName()); diff --git a/cdm/core/src/main/java/ucar/nc2/Variable.java b/cdm/core/src/main/java/ucar/nc2/Variable.java index a94219af21..8410a46274 100644 --- a/cdm/core/src/main/java/ucar/nc2/Variable.java +++ b/cdm/core/src/main/java/ucar/nc2/Variable.java @@ -1025,7 +1025,7 @@ else if (dataType.isEnum()) { indent.incr(); for (Attribute att : attributes()) { - if (Attribute.isspecial(att)) + if (CDM.isspecial(att)) continue; buf.format("%s", indent); att.writeCDL(buf, strict, getShortName()); diff --git a/cdm/core/src/main/java/ucar/nc2/constants/CDM.java b/cdm/core/src/main/java/ucar/nc2/constants/CDM.java index 21f06b01c9..c6eeb46725 100644 --- a/cdm/core/src/main/java/ucar/nc2/constants/CDM.java +++ b/cdm/core/src/main/java/ucar/nc2/constants/CDM.java @@ -5,6 +5,8 @@ package ucar.nc2.constants; +import ucar.nc2.Attribute; + /** * CDM constants. * @@ -55,12 +57,31 @@ public class CDM { public static final String TIME_OFFSET_HOUR = "hoursFrom0z"; public static final String RUNTIME_COORDINATE = "runtimeCoordinate"; - // Special Attribute Names used in jni.Nc4Iosp + // Special attributes + + private static final String SPECIALPREFIX = "_"; + + // Define Special attributes that should be suppressed public static final String NCPROPERTIES = "_NCProperties"; public static final String ISNETCDF4 = "_IsNetcdf4"; public static final String SUPERBLOCKVERSION = "_SuperblockVersion"; - public static final String DAP4_LITTLE_ENDIAN = "_DAP4_Little_Endian"; - public static final String EDU_UCAR_PREFIX = "_edu.ucar"; + + static public final String[] SPECIALS = {NCPROPERTIES, ISNETCDF4, SUPERBLOCKVERSION}; + + // public static final String DAP4_LITTLE_ENDIAN = "_DAP4_Little_Endian"; + // public static final String EDU_UCAR_PREFIX = "_edu.ucar"; + + public static boolean isspecial(Attribute a) { + String nm = a.getShortName(); + if (nm.startsWith(SPECIALPREFIX)) { + /* Check for selected special attributes */ + for (String s : SPECIALS) { + if (nm.startsWith(s)) + return true; /* is special */ + } + } + return false; /* is not special */ + } // class not interface, per Bloch edition 2 item 19 private CDM() {} // disable instantiation diff --git a/cdm/core/src/main/java/ucar/nc2/dataset/DatasetUrl.java b/cdm/core/src/main/java/ucar/nc2/dataset/DatasetUrl.java index a333a49a74..2bdab61062 100644 --- a/cdm/core/src/main/java/ucar/nc2/dataset/DatasetUrl.java +++ b/cdm/core/src/main/java/ucar/nc2/dataset/DatasetUrl.java @@ -287,7 +287,7 @@ private static ServiceType decodePathExtension(String path) { if (path.endsWith(".dds") || path.endsWith(".das") || path.endsWith(".dods")) return ServiceType.OPENDAP; - if (path.endsWith(".dmr") || path.endsWith(".dap") || path.endsWith(".dsr")) + if (path.matches("^.*[.](dmr|dap|dsr)([.](xml|html))?$")) return ServiceType.DAP4; if (path.endsWith(".xml") || path.endsWith(".ncml")) @@ -365,7 +365,7 @@ private static ServiceType disambiguateHttp(String location) throws IOException checkDap2 = true; } - if (location.contains("dap4")) { + if (location.contains("dap4") || location.contains("d4ts")) { ServiceType result = checkIfDap4(location); if (result != null) return result; @@ -445,27 +445,27 @@ private static ServiceType checkIfDods(String location) throws IOException { // check for dmr private static ServiceType checkIfDap4(String location) throws IOException { - // Strip off any trailing DAP4 prefix - if (location.endsWith(".dap")) - location = location.substring(0, location.length() - ".dap".length()); - else if (location.endsWith(".dmr")) - location = location.substring(0, location.length() - ".dmr".length()); - else if (location.endsWith(".dmr.xml")) - location = location.substring(0, location.length() - ".dmr.xml".length()); - else if (location.endsWith(".dsr")) - location = location.substring(0, location.length() - ".dsr".length()); - try (HTTPMethod method = HTTPFactory.Get(location + ".dmr.xml")) { + if (!location.matches("^.*[.](dmr|dap|dsr)([.](xml|html))?$")) + return null; + // Strip off any trailing DAP4 suffix + if (location.endsWith(".xml")) + location = location.substring(0, location.length() - ".xml".length()); + else if (location.endsWith(".html")) + location = location.substring(0, location.length() - ".html".length()); + // location must end with dap, dmr, or dsr + location = location.substring(0, location.length() - ".dxx".length()); + + try (HTTPMethod method = HTTPFactory.Get(location + ".dsr.xml")) { int status = method.execute(); if (status == HTTP_OK) { Optional value = method.getResponseHeaderValue("Content-Type"); if (value.isPresent()) { - if (value.get().startsWith("application/vnd.opendap.org")) + if (value.get().contains("application/vnd.opendap.dap4")) return ServiceType.DAP4; } } if (status == HTTP_UNAUTHORIZED || status == HTTP_FORBIDDEN) throw new IOException("Unauthorized to open dataset " + location); - // not dods return null; } diff --git a/cdm/core/src/main/java/ucar/nc2/internal/iosp/netcdf3/N3headerWriter.java b/cdm/core/src/main/java/ucar/nc2/internal/iosp/netcdf3/N3headerWriter.java index 2cb14b793e..74d60d5f9b 100644 --- a/cdm/core/src/main/java/ucar/nc2/internal/iosp/netcdf3/N3headerWriter.java +++ b/cdm/core/src/main/java/ucar/nc2/internal/iosp/netcdf3/N3headerWriter.java @@ -19,6 +19,7 @@ import ucar.nc2.Dimension; import ucar.nc2.NetcdfFile; import ucar.nc2.Variable; +import ucar.nc2.constants.CDM; import ucar.unidata.io.RandomAccessFile; /** Class to write a netcdf3 header. */ @@ -217,8 +218,8 @@ int sizeHeader(boolean largeFile) { private void writeAtts(Iterable atts, Formatter fout) throws IOException { - final List attributesToWrite = StreamSupport.stream(atts.spliterator(), false) - .filter(att -> !Attribute.isspecial(att)).collect(Collectors.toList()); + final List attributesToWrite = + StreamSupport.stream(atts.spliterator(), false).filter(att -> !CDM.isspecial(att)).collect(Collectors.toList()); int n = Iterables.size(attributesToWrite); if (n == 0) { diff --git a/cdm/core/src/main/java/ucar/nc2/iosp/hdf5/H5header.java b/cdm/core/src/main/java/ucar/nc2/iosp/hdf5/H5header.java index 429b9d1b41..5d6f73d268 100644 --- a/cdm/core/src/main/java/ucar/nc2/iosp/hdf5/H5header.java +++ b/cdm/core/src/main/java/ucar/nc2/iosp/hdf5/H5header.java @@ -1745,7 +1745,7 @@ private boolean makeVariableShapeAndType(Variable v, MessageDatatype mdt, Messag ncGroup.getEnumTypedefs().stream().filter((e) -> e.equalsMapOnly(local)).findFirst().orElse(local); if (enumTypedef != null) { // if found, make sure it is added to the group - ncGroup.addEnumeration(enumTypedef); + assert (ncGroup.getEnumTypedefs().contains(enumTypedef)); } else { // if shared object, wont have a name, shared version gets added later enumTypedef = new EnumTypedef(mdt.enumTypeName, mdt.map); ncGroup.addEnumeration(enumTypedef); diff --git a/cdm/core/src/main/java/ucar/nc2/write/CDLWriter.java b/cdm/core/src/main/java/ucar/nc2/write/CDLWriter.java index 7eaaa2800c..96db9dfc23 100644 --- a/cdm/core/src/main/java/ucar/nc2/write/CDLWriter.java +++ b/cdm/core/src/main/java/ucar/nc2/write/CDLWriter.java @@ -24,6 +24,8 @@ import ucar.nc2.NetcdfFiles; import ucar.nc2.Structure; import ucar.nc2.Variable; +import ucar.nc2.constants.CDM; +import ucar.nc2.iosp.netcdf4.Nc4; import ucar.nc2.util.Indent; import ucar.unidata.util.StringUtil2; @@ -157,7 +159,7 @@ private void writeCDL(Group group, Indent indent) { for (Attribute att : group.attributes()) { // String name = strict ? NetcdfFile.escapeNameCDL(getShortName()) : getShortName(); - if (!Attribute.isspecial(att)) { + if (!CDM.isspecial(att)) { out.format("%s", indent); writeCDL(att, null); out.format(";"); @@ -292,8 +294,12 @@ else if (dataType.isEnum()) { out.format("enum UNKNOWN"); else out.format("enum %s", NetcdfFile.makeValidCDLName(v.getEnumTypedef().getShortName())); - } else - out.format("%s", dataType.toString()); + } else { + String printname = dataType.toString(); + if (strict) + printname = printname.toLowerCase(); + out.format("%s", printname); + } // if (isVariableLength) out.append("(*)"); // LOOK out.format(" "); @@ -303,7 +309,7 @@ else if (dataType.isEnum()) { indent.incr(); for (Attribute att : v.attributes()) { - if (Attribute.isspecial(att)) + if (CDM.isspecial(att)) continue; out.format("%s", indent); writeCDL(att, v.getShortName()); @@ -347,7 +353,7 @@ private void writeCDL(Structure s, Indent indent, boolean useFullName) { out.format(";%n"); for (Attribute att : s.attributes()) { - if (Attribute.isspecial(att)) + if (CDM.isspecial(att)) continue; out.format("%s", indent); writeCDL(att, s.getShortName()); diff --git a/cdm/core/src/main/java/ucar/nc2/write/Ncdump.java b/cdm/core/src/main/java/ucar/nc2/write/Ncdump.java index 0e8b32ad06..e8268b4ed3 100644 --- a/cdm/core/src/main/java/ucar/nc2/write/Ncdump.java +++ b/cdm/core/src/main/java/ucar/nc2/write/Ncdump.java @@ -562,7 +562,8 @@ private static void printStringArray(Formatter out, Array ma, Indent indent, Can out.format("%n%s{", indent); indent.incr(); for (int ii = 0; ii < last; ii++) { - ArrayObject slice = (ArrayObject) ma.slice(0, ii); + Array slice = (Array) ma.slice(0, ii); // replaces ArrayObject slice = (ArrayObject)o; because ArrayObject is + // over-casting since printStringArray takes Array if (ii > 0) out.format(","); printStringArray(out, slice, indent, ct); diff --git a/cdm/core/src/test/java/ucar/nc2/TestSpecialAttributes.java b/cdm/core/src/test/java/ucar/nc2/TestSpecialAttributes.java index bc94e28e8f..c54effe7fb 100644 --- a/cdm/core/src/test/java/ucar/nc2/TestSpecialAttributes.java +++ b/cdm/core/src/test/java/ucar/nc2/TestSpecialAttributes.java @@ -10,6 +10,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ucar.nc2.constants.CDM; +import ucar.nc2.iosp.netcdf4.Nc4; import ucar.unidata.util.test.TestDir; import java.io.IOException; import java.lang.invoke.MethodHandles; @@ -23,7 +24,7 @@ public void testReadAll() throws IOException { NetcdfFile ncfile = TestDir.openFileLocal("testSpecialAttributes.nc4"); // Iterate over all top-level visible attributes and see if it is special for (Attribute a : ncfile.getRootGroup().getAttributes()) { - Assert.assertFalse("Attribute iteration found special attribute: " + a.getShortName(), Attribute.isspecial(a)); + Assert.assertFalse("Attribute iteration found special attribute: " + a.getShortName(), CDM.isspecial(a)); } ncfile.close(); } @@ -34,7 +35,7 @@ public void testReadByName() throws IOException { // Attempt to read special attributes by name for (String name : new String[] {CDM.NCPROPERTIES}) { Attribute special = ncfile.getRootGroup().findAttribute(name); - Assert.assertTrue("Could not access special attribute: " + name, special != null && Attribute.isspecial(special)); + Assert.assertTrue("Could not access special attribute: " + name, special != null && CDM.isspecial(special)); } ncfile.close(); } diff --git a/dap4/build.gradle b/dap4/build.gradle index dbdef58cfb..7df0a6635b 100644 --- a/dap4/build.gradle +++ b/dap4/build.gradle @@ -1,22 +1,40 @@ ext.title = 'Data Access Protocol (DAP) version 4.0' // Will be inherited by subprojects. -// dap4 has no source code nor any artifacts to publish - -// NON-TRANSITIVE Dependency graph: -// module depends on -// ---------------------------------------- -// common: -// d4core nothing -// d4lib d4core httpservices -// d4cdm d4lib cdm -// server: -// d4servletshared d4cdmshared netcdf4 -// d4ts d4servletshared -// d4tswar d4ts -// tests: -// d4tests d4servletshared d4ts - -subprojects { - // TODO: Give the subprojects real titles. - ext.title = "DAP4: $name" +apply from: "$rootDir/gradle/any/dependencies.gradle" +apply from: "$rootDir/gradle/any/java-library.gradle" +apply from: "$rootDir/gradle/any/gretty.gradle" + +dependencies { + api enforcedPlatform(project(':netcdf-java-platform')) + + implementation project(':httpservices') + implementation project(':cdm:cdm-core') + implementation project(':netcdf4') + testImplementation project(':cdm-test-utils') + + implementation 'org.apache.httpcomponents:httpclient' + compileOnly 'org.apache.httpcomponents:httpcore' + compileOnly 'net.java.dev.jna:jna' + compileOnly 'com.beust:jcommander' + compileOnly 'org.slf4j:slf4j-api' + + compileOnly enforcedPlatform(project(':netcdf-java-platform')) + testImplementation enforcedPlatform(project(':netcdf-java-testing-platform')) + testImplementation 'junit:junit' + testImplementation 'org.slf4j:slf4j-api' + testRuntimeOnly 'ch.qos.logback:logback-classic' +} + +test { + systemProperties['testargs'] = System.getProperty('testargs', '') + + include 'dap4/test/TestParserDMR.class' + include 'dap4/test/TestParserCE.class' + include 'dap4/test/TestRaw.class' + include 'dap4/test/TestRemote.class' + include 'dap4/test/TestConstraints.class' + include 'dap4/test/TestHyrax.class' + + dependsOn('farmBeforeIntegrationTest') + finalizedBy('farmAfterIntegrationTest') } diff --git a/dap4/d4cdm/build.gradle b/dap4/d4cdm/build.gradle deleted file mode 100644 index 1337719928..0000000000 --- a/dap4/d4cdm/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply from: "$rootDir/gradle/any/dependencies.gradle" -apply from: "$rootDir/gradle/any/java-library.gradle" - -dependencies { - api enforcedPlatform(project(':netcdf-java-platform')) - - compile project(':dap4:d4core') - compile project(':dap4:d4lib') - compile project(':cdm:cdm-core') - compile project(':netcdf4') -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/arch.txt b/dap4/d4cdm/src/main/java/dap4/cdm/arch.txt deleted file mode 100644 index 9b05ad15a3..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/arch.txt +++ /dev/null @@ -1,36 +0,0 @@ -CDM :: Dap4 Interactions occur in two ways. - -1. Server side. -The goal is to wrap a NetcdfDataset object as a DSP -so it can be written using the DAP4 protocol. -The relevant classes are: - thredds.server.dap4.ThreddsDSP.java (in /tds/src/main/java/thredds/server/dap4 for access reasons) - dap4.cdm.dsp.CDMDSP.java - dap4.cdm.dsp.CDMDataCompoundArray.java - dap4.cdm.dsp.CDMDataDataset.java - dap4.cdm.dsp.CDMDataRecord.java - dap4.cdm.dsp.CDMDataset.java - dap4.cdm.dsp.CDMDataStructure.java - dap4.cdm.dsp.CDMDataVariable.java - dap4.cdm.dsp.CDMDataAtomic.java - -2. Client Side -The goal is to wrap a D4DSP to make it look like a CDM NetcdfDataset. -The D4DSP itself wraps the serialized data of the DAP4 protocol. -The relevant classes are as follows: - dap4.cdm.nc2.DapNetcdfDataset.java - dap4.cdm.nc2.DMRToCDM.java - dap4.cdm.nc2.DataToCDM.java - dap4.cdm.nc2.CDMCompiler.java - dap4.cdm.nc2.CDMArray.java - dap4.cdm.nc2.CDMArrayAtomic.java - dap4.cdm.nc2.CDMArrayDelegate.java - dap4.cdm.nc2.CDMArraySequence.java - dap4.cdm.nc2.CDMArrayStructure.java - -The following are shared Utilities: - CDMUtil.java - NodeMap.java - -What about? - CDMDataFactory.java diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMCursor.java b/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMCursor.java deleted file mode 100644 index 16afc87c86..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMCursor.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.dsp; - -import dap4.cdm.CDMTypeFcns; -import dap4.cdm.CDMUtil; -import dap4.core.dmr.*; -import dap4.core.util.*; -import dap4.core.util.Index; -import dap4.dap4lib.AbstractCursor; -import ucar.ma2.*; -import java.util.List; - -public class CDMCursor extends AbstractCursor { - ////////////////////////////////////////////////// - // Instance variables - - protected ucar.ma2.Array array = null; - protected ucar.ma2.StructureData structdata = null; // scheme == STRUCTURE - ucar.ma2.StructureMembers.Member member = null; // for field cursors - - ////////////////////////////////////////////////// - // Constructor(s) - - public CDMCursor(Scheme scheme, CDMDSP dsp, DapNode template, CDMCursor container) throws DapException { - super(scheme, dsp, template, container); - } - - public CDMCursor(CDMCursor c) { - super(c); - assert false; - this.array = c.array; - this.structdata = c.structdata; - this.member = c.member; - - } - - ////////////////////////////////////////////////// - // AbstractCursor Abstract Methods - - @Override - public Object read(List slices) throws DapException { - switch (this.scheme) { - case ATOMIC: - return readAtomic(slices); - case STRUCTURE: - if (((DapVariable) this.getTemplate()).getRank() > 0 || DapUtil.isScalarSlices(slices)) - throw new DapException("Cannot slice a scalar variable"); - CDMCursor[] instances = new CDMCursor[1]; - instances[0] = this; - return instances; - case SEQUENCE: - if (((DapVariable) this.getTemplate()).getRank() > 0 || DapUtil.isScalarSlices(slices)) - throw new DapException("Cannot slice a scalar variable"); - instances = new CDMCursor[1]; - instances[0] = this; - return instances; - case STRUCTARRAY: - Odometer odom = Odometer.factory(slices); - instances = new CDMCursor[(int) odom.totalSize()]; - for (int i = 0; odom.hasNext(); i++) { - instances[i] = readStructure(odom.next()); - } - return instances; - case SEQARRAY: - instances = readSequence(slices); - return instances; - default: - throw new DapException("Attempt to slice a scalar object"); - } - } - - @Override - public Object read(Index index) throws DapException { - return read(DapUtil.indexToSlices(index)); - } - - @Override - public CDMCursor readField(int findex) throws DapException { - if (this.scheme != scheme.RECORD && this.scheme != scheme.STRUCTURE) - throw new DapException("Illegal cursor scheme for readfield()"); - DapVariable var = (DapVariable) getTemplate(); - DapStructure basetype = (DapStructure) var.getBaseType(); - if (findex < 0 || findex >= basetype.getFields().size()) - throw new DapException("Field index out of range: " + findex); - CDMCursor fieldcursor = null; - if (this.scheme == Scheme.RECORD) { - DapSequence seq = (DapSequence) basetype; - DapVariable field = seq.getField(0); - DapType fieldtype = field.getBaseType(); - switch (fieldtype.getTypeSort()) { - default: // atomic - DataType cdmfieldtype = CDMTypeFcns.daptype2cdmtype(fieldtype); - if (cdmfieldtype == null) - throw new dap4.core.util.DapException("Unknown field type: " + fieldtype); - int ri = (int) this.recordindex; - Object o = array.getObject(ri); - Array fielddata = CDMTypeFcns.arrayify(cdmfieldtype, o); // not very efficient; should do conversion - fieldcursor = new CDMCursor(Scheme.ATOMIC, (CDMDSP) this.dsp, field, this); - fieldcursor.setArray(fielddata); - break; - case Sequence: - case Structure: - break; - } - } else { // scheme == STRUCTURE - assert this.structdata != null; - fieldcursor = getFieldCursor(this, findex); - } - return fieldcursor; - } - - protected CDMCursor getFieldCursor(CDMCursor container, int findex) throws DapException { - // Now, create a cursors for a field f this instance - DapVariable var = (DapVariable) getTemplate(); - DapStructure type = (DapStructure) var.getBaseType(); - DapVariable field = (DapVariable) type.getFields().get(findex); - DapType ftype = field.getBaseType(); - Scheme scheme = schemeFor(field); - CDMCursor fc = new CDMCursor(scheme, (CDMDSP) this.dsp, field, this); - StructureMembers.Member member = this.structdata.getStructureMembers().getMember(findex); - fc.setMember(member); - fc.setArray(this.structdata.getArray(fc.member)); - return fc; - } - - @Override - public CDMCursor readRecord(long i) throws DapException { - if (this.scheme != scheme.SEQUENCE) - throw new DapException("Attempt to read record from non-sequence cursor"); - if (i < 0 || i >= this.recordcount) - throw new DapException("Record index out of bounds"); - DapVariable var = (DapVariable) getTemplate(); - CDMCursor c = new CDMCursor(Scheme.RECORD, (CDMDSP) this.dsp, var, this); - c.setArray(this.array); - c.setRecordIndex(i); - return c; - } - - ////////////////////////////////////////////////// - // Support Methods - - protected Object readAtomic(List slices) throws DapException { - if (slices == null) - throw new DapException("DataCursor.read: null set of slices"); - assert (this.scheme == scheme.ATOMIC); - DapVariable atomvar = (DapVariable) getTemplate(); - assert slices != null && ((atomvar.getRank() == 0 && slices.size() == 1) || (slices.size() == atomvar.getRank())); - return sliceAtomic(slices, this.array, atomvar); - } - - protected Object sliceAtomic(List slices, Array array, DapVariable var) throws DapException { - List dimset = var.getDimensions(); - DapType basetype = var.getBaseType(); - // If content.getDataType returns object, then we - // really do not know its true datatype. So, as a rule, - // we will rely on this.basetype. - DataType datatype = CDMTypeFcns.daptype2cdmtype(basetype); - if (datatype == null) - throw new dap4.core.util.DapException("Unknown basetype: " + basetype); - Object content = array.get1DJavaArray(datatype); // not very efficient; should do conversion - Odometer odom = Odometer.factory(slices, dimset); - Object data = CDMTypeFcns.createVector(datatype, odom.totalSize()); - for (int dstoffset = 0; odom.hasNext(); dstoffset++) { - Index index = odom.next(); - long srcoffset = index.index(); - CDMTypeFcns.vectorcopy(basetype, content, data, srcoffset, dstoffset); - } - return data; - } - - - protected CDMCursor readStructure(Index index) throws DapException { - assert (index != null); - DapVariable var = (DapVariable) getTemplate(); - DapStructure type = (DapStructure) var.getBaseType(); - long pos = index.index(); - if (pos < 0 || pos > var.getCount()) - throw new IndexOutOfBoundsException("read: " + index); - ArrayStructure sarray = (ArrayStructure) this.array; - CDMCursor instance; - assert (this.scheme == scheme.STRUCTARRAY); - ucar.ma2.StructureData sd = sarray.getStructureData((int) pos); - assert sd != null; - instance = new CDMCursor(Scheme.STRUCTURE, (CDMDSP) this.dsp, var, null).setStructureData(sd); - instance.setIndex(index); - return instance; - } - - protected CDMCursor[] readSequence(List slices) throws DapException { - assert (this.scheme == scheme.SEQARRAY); - DapVariable var = (DapVariable) getTemplate(); - DapSequence type = (DapSequence) var.getBaseType(); - // new CDMCursor(Scheme.SEQUENCE, (CDMDSP) this.dsp, var, this); - CDMCursor[] instances = new CDMCursor[(int) DapUtil.sliceProduct(slices)]; - Array seqarray = this.array; - if (var.getRank() == 0) {// scalar - if (!DapUtil.isScalarSlices(slices)) - throw new DapException("Non-scalar slice set applied to scalar variable"); - instances[0] = new CDMCursor(Scheme.SEQUENCE, (CDMDSP) this.dsp, var, this); - instances[0].setArray(seqarray); - instances[0].setRecordCount(seqarray.getSize()); - } else { - List rlist = CDMUtil.createCDMRanges(slices); - Array instancearray; - try { - instancearray = seqarray.section(rlist); - } catch (InvalidRangeException e) { - throw new DapException("Illegal slice set", e); - } - // extracted via List. IN theory, this should be an array of arrays, - // but if the sequence field basetype is atomic, thenit is an array - // of atomic values. - int slicecount = (int) DapUtil.sliceProduct(slices); - for (int i = 0; i < slicecount; i++) { - Array ao = (Array) instancearray.getObject(i); - CDMCursor c = new CDMCursor(Scheme.SEQUENCE, (CDMDSP) this.dsp, var, this); - c.setArray(ao); - long rcount = ao.getSize(); - c.setRecordCount(rcount); - instances[i] = c; - } - } - return instances; - } - - ////////////////////////////////////////////////// - // CDMCursor Extensions - - public CDMCursor setArray(ucar.ma2.Array a) { - this.array = a; - return this; - } - - public ucar.ma2.Array getArray() { - return this.array; - } - - public CDMCursor setStructureData(ucar.ma2.StructureData sd) { - this.structdata = sd; - return this; - } - - public CDMCursor setMember(ucar.ma2.StructureMembers.Member m) { - this.member = m; - return this; - } - - -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDMR.java b/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDMR.java deleted file mode 100644 index 296d7cdeda..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDMR.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.dsp; - -import dap4.core.dmr.*; - -public class CDMDMR { - ////////////////////////////////////////////////// - - public static class CDMAttribute extends DapAttribute { - public CDMAttribute(String name, DapType basetype) { - super(name, basetype); - } - } - - public static class CDMAttributeSet extends DapAttributeSet { - public CDMAttributeSet(String name) { - super(name); - } - } - - public static class CDMDimension extends DapDimension { - public CDMDimension(String name, long size) { - super(name, size); - } - } - - public static class CDMMap extends DapMap { - public CDMMap(DapVariable target) { - super(target); - } - } - - public abstract static class CDMVariable extends DapVariable { - public CDMVariable(String name, DapType t) { - super(name, t); - } - } - - public static class CDMGroup extends DapGroup { - public CDMGroup(String name) { - super(name); - } - } - - public static class CDMDataset extends DapDataset { - public CDMDataset(String name) { - super(name); - } - } - - public static class CDMEnumeration extends DapEnumeration { - public CDMEnumeration(String name, DapType basetype) { - super(name, basetype); - } - } - - public static class CDMEnumConst extends DapEnumConst { - public CDMEnumConst(String name, long value) { - super(name, value); - } - } - - public static class CDMStructure extends DapStructure { - public CDMStructure(String name) { - super(name); - } - } - - public static class CDMSequence extends DapSequence { - public CDMSequence(String name) { - super(name); - } - } - - public static class CDMOtherXML extends DapOtherXML { - public CDMOtherXML(String name) { - super(name); - } - } -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDSP.java b/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDSP.java deleted file mode 100644 index 95b271e745..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDSP.java +++ /dev/null @@ -1,1056 +0,0 @@ -/* - * Copyright (c) 2012-2018 University Corporation for Atmospheric Research/Unidata - * See LICENSE for license information. - */ - -package dap4.cdm.dsp; - -import dap4.cdm.CDMTypeFcns; -import dap4.cdm.CDMUtil; -import dap4.cdm.NodeMap; -import dap4.core.data.DataCursor; -import dap4.core.dmr.*; -import dap4.core.util.Convert; -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.dap4lib.AbstractDSP; -import ucar.ma2.Array; -import ucar.ma2.DataType; -import ucar.ma2.IndexIterator; -import ucar.nc2.*; -import ucar.nc2.constants.CDM; -import ucar.nc2.dataset.*; -import ucar.nc2.util.CancelTask; -import java.io.IOException; -import java.util.*; -import ucar.nc2.write.CDLWriter; - -/** - * Wrap CDM source (NetcdfDataset) to be a DSP - * This basically means wrapping various (CDM)Array - * object to look like DataVariable objects. - * Currently only used on server side - */ - -public class CDMDSP extends AbstractDSP { - - ////////////////////////////////////////////////// - // Constants - - protected static final boolean DEBUG = false; - protected static final boolean DUMPCDL = false; - - // NetcdfDataset enhancement to use: need only coord systems - protected static Set ENHANCEMENT = EnumSet.of(NetcdfDataset.Enhance.CoordSystems); - - protected static final String FILLVALUE = "_FillValue"; - - ////////////////////////////////////////////////// - // Class variables - - protected static boolean nc4loaded = false; - - ////////////////////////////////////////////////// - // Class methods - - - ////////////////////////////////////////////////// - // Instance variables - - protected NetcdfDataset ncdfile = null; - protected boolean closed = false; - protected DMRFactory dmrfactory = null; - - // Keep various context-dependent maps between - // CDMNode instances and DapNode instances - // package access - - // Variable map - protected NodeMap varmap = new NodeMap<>(); - - // Variable <-> DapStructure (basetype) map; compound types only - protected NodeMap compoundmap = new NodeMap<>(); - - // Map Variable <-> DapSequence vlen type - protected NodeMap vlenmap = new NodeMap<>(); - - // Map All other kinds of CDMNode <-> DapNode - protected NodeMap nodemap = new NodeMap<>(); - - ////////////////////////////////////////////////// - // Constructor(s) - - public CDMDSP() {} - - public CDMDSP(String path) throws DapException { - super(); - setLocation(path); - } - - ////////////////////////////////////////////////// - // DSP Interface - - // This is intended to be the last DSP checked - @Override - public boolean dspMatch(String path, DapContext context) { - return true; - } - - /** - * @param filepath - absolute path to a file - * @return CDMDSP instance - * @throws DapException - */ - @Override - public CDMDSP open(String filepath) throws DapException { - try { - NetcdfFile ncfile = createNetcdfFile(filepath, null); - NetcdfDataset ncd = new NetcdfDataset(ncfile, ENHANCEMENT); - return open(ncd); - } catch (IOException ioe) { - throw new DapException("CDMDSP: cannot process: " + filepath, ioe); - } - } - - /** - * Provide an extra API for use in testing - * - * @param ncd netcdf dataset - * @return the cdmdsp - * @throws DapException - */ - public CDMDSP open(NetcdfDataset ncd) throws DapException { - assert this.context != null; - this.dmrfactory = new DMRFactory(); - this.ncdfile = ncd; - setLocation(this.ncdfile.getLocation()); - buildDMR(); - return this; - } - - @Override - public void close() throws IOException { - if (this.ncdfile != null) - this.ncdfile.close(); - } - - - @Override - public DataCursor getVariableData(DapVariable var) throws DapException { - Variable cdmvar = this.varmap.get(var); - if (cdmvar == null) - throw new DapException("Unknown variable: " + var); - CDMCursor vardata = (CDMCursor) super.getVariableData(var); - if (vardata == null) { - DataCursor.Scheme scheme = CDMCursor.schemeFor(var); - try { - vardata = new CDMCursor(scheme, this, var, null); - vardata.setArray(cdmvar.read()); - } catch (IOException e) { - throw new DapException(e); - } - super.addVariableData(var, vardata); - } - return vardata; - } - - ////////////////////////////////////////////////// - // Abstract DSP Abstract methods - - ////////////////////////////////////////////////// - // CDMDSP Specific Accessors - - public NetcdfDataset getNetcdfDataset() { - return this.ncdfile; - } - - ////////////////////////////////////////////////// - // Nodemap Management - - /* - * Make sure that we use the proper - * object in order to avoid identity - * problems. - */ - - /** - * Track generic CDMNode <-> DapNode - */ - protected void recordNode(CDMNode cdm, DapNode dap) { - assert this.nodemap.get(cdm) == null && this.nodemap.get(dap) == null; - this.nodemap.put(cdm, dap); - } - - /** - * Track Variable <-> DapVariable - */ - protected void recordVar(Variable cdm, DapVariable dap) { - cdm = CDMUtil.unwrap(cdm); - assert varmap.get(cdm) == null && varmap.get(dap) == null; - varmap.put(cdm, dap); - } - - /** - * Track Variable <-> DapStructure - */ - protected void recordStruct(Variable cdm, DapStructure dap) { - cdm = CDMUtil.unwrap(cdm); - assert this.nodemap.get(cdm) == null && this.nodemap.get(dap) == null; - compoundmap.put(cdm, dap); - } - - /** - * Track Variable <-> DapSequence - */ - protected void recordSeq(Variable cdm, DapSequence dap) { - cdm = CDMUtil.unwrap(cdm); - assert this.vlenmap.get(cdm) == null && this.vlenmap.get(dap) == null; - vlenmap.put(cdm, dap); - } - - /** - * Lookup a cdmnode in the cdmnodemap. - * Make sure that we use the proper - * object in order to avoid identity - * problems. - * - * @param cdmnode The CMDNode (variable, dimension, etc) to record - * @return The DapNode to which the cdmnode is to be mapped or null. - */ - /* - * protected DapNode - * lookupNode(CDMNode cdmnode) - * { - * CDMSort sort = cdmnode.getSort(); - * if(sort == CDMSort.VARIABLE || sort == CDMSort.STRUCTURE) { - * Variable basev = CDMUtil.unwrap((Variable) cdmnode); - * assert (basev != null) : "Unwrap() failed"; - * cdmnode = (CDMNode) basev; - * } - * return this.nodemap.get(cdmnode); - * } - */ - - ////////////////////////////////////////////////// - - /** - * Extract the metadata from the NetcdfDataset - * and build the DMR. - */ - - public void buildDMR() throws DapException { - if (getDMR() != null) - return; - try { - if (DUMPCDL) { - System.out.println("writecdl:"); - CDLWriter.writeCDL(this.ncdfile, System.out, false); - System.out.flush(); - } - // Use the file path to define the dataset name - String name = this.ncdfile.getLocation(); - // Normalize the name - name = DapUtil.canonicalpath(name); - // Remove any path prefix - int index = name.lastIndexOf('/'); - if (index >= 0) - name = name.substring(index + 1, name.length()); - // Initialize the root dataset node - setDMR((DapDataset) dmrfactory.newDataset(name).annotate(NetcdfDataset.class, this.ncdfile)); - // Map the CDM root group to this group - recordNode(this.ncdfile.getRootGroup(), getDMR()); - getDMR().setBase(DapUtil.canonicalpath(this.ncdfile.getLocation())); - - // Now recursively build the tree. Start by - // Filling the dataset with the contents of the ncfile - // root group. - fillgroup(getDMR(), this.ncdfile.getRootGroup()); - - // Add an order index to the tree - getDMR().sort(); - - // Now locate the coordinate variables for maps - - /* Walk looking for VariableDS instances */ - processmappedvariables(this.ncdfile.getRootGroup()); - - // Now set the view - getDMR().finish(); - - } catch (DapException e) { - setDMR(null); - throw new DapException(e); - } - } - - ////////////////////////////////////////////////// - // Actions - - protected void fillgroup(DapGroup dapgroup, Group cdmgroup) throws DapException { - // Create decls in dap group for Dimensions - for (Dimension cdmdim : cdmgroup.getDimensions()) { - DapDimension dapdim = builddim(cdmdim); - } - // Create decls in dap group for Enumerations - for (EnumTypedef cdmenum : cdmgroup.getEnumTypedefs()) { - String name = cdmenum.getShortName(); - DapEnumeration dapenum = buildenum(cdmenum); - dapenum.setShortName(name); - dapgroup.addDecl(dapenum); - } - // Create decls in dap group for vlen induced Sequences - // Do this before building compound types - for (Variable cdmvar0 : cdmgroup.getVariables()) { - Variable cdmvar = CDMUtil.unwrap(cdmvar0); - buildseqtypes(cdmvar); - } - // Create decls in dap group for Compound Types - for (Variable cdmvar0 : cdmgroup.getVariables()) { - Variable cdmvar = CDMUtil.unwrap(cdmvar0); - if (cdmvar.getDataType() != DataType.STRUCTURE && cdmvar.getDataType() != DataType.SEQUENCE) - continue; - DapStructure struct = buildcompoundtype(cdmvar, dapgroup); - } - - // Create decls in dap group for Variables - for (Variable cdmvar0 : cdmgroup.getVariables()) { - Variable cdmvar = CDMUtil.unwrap(cdmvar0); - DapNode newvar = buildvariable(cdmvar, dapgroup, cdmvar.getDimensions()); - } - // Create decls in dap group for subgroups - for (Group subgroup : cdmgroup.getGroups()) { - DapGroup newgroup = buildgroup(subgroup); - dapgroup.addDecl(newgroup); - } - // Create decls in dap group for group-level attributes - buildattributes(dapgroup, cdmgroup.attributes()); - } - - ////////////////////////////////////////////////// - // Declaration Builders - - protected DapDimension builddim(Dimension cdmdim) throws DapException { - if (cdmdim.isVariableLength()) - throw new DapException("* dimensions not supported"); - DapDimension dapdim = null; - long cdmsize = dapsize(cdmdim); - String name = cdmdim.getShortName(); - if (name != null && name.length() == 0) - name = null; - boolean shared = cdmdim.isShared(); - if (!shared) { - // Unlike the parser, since we are working - // from a NetcdfDataset instance, there might - // be multiple anonymous dimension objects - // the same size. So, just go ahead and create - // multiple instances. - dapdim = (DapDimension) dmrfactory.newDimension(null, cdmsize); - getDMR().addDecl(dapdim); - } else { // Non anonymous; create in current group - dapdim = (DapDimension) dmrfactory.newDimension(name, cdmsize); - dapdim.setShared(true); - if (cdmdim.isUnlimited()) { - dapdim.setUnlimited(true); - } - Group cdmparent = cdmdim.getGroup(); - DapGroup dapparent = (DapGroup) this.nodemap.get(cdmparent); - assert dapparent != null; - assert (dapparent != null); - dapparent.addDecl(dapdim); - } - recordNode(cdmdim, dapdim); - return dapdim; - } - - protected DapEnumeration buildenum(EnumTypedef cdmenum) throws DapException { - // Set the enum's basetype - DapType base = null; - switch (cdmenum.getBaseType()) { - case ENUM1: - base = DapType.INT8; - break; - case ENUM2: - base = DapType.INT16; - break; - case ENUM4: - default: - base = DapType.INT32; - break; - } - DapEnumeration dapenum = (DapEnumeration) dmrfactory.newEnumeration(cdmenum.getShortName(), base); - recordNode(cdmenum, dapenum); - // Create the enum constants - Map ecvalues = cdmenum.getMap(); - for (Map.Entry entry : ecvalues.entrySet()) { - String name = entry.getValue(); - assert (name != null); - int value = (int) entry.getKey(); - dapenum.addEnumConst(dmrfactory.newEnumConst(name, new Long(value))); - } - return dapenum; - } - - protected DapStructure buildcompoundtype(Variable cdmvar, DapNode parent) throws DapException { - cdmvar = CDMUtil.unwrap(cdmvar); - DapStructure struct; - if (cdmvar.getDataType() == DataType.STRUCTURE) - struct = (DapStructure) dmrfactory.newStructure(cdmvar.getShortName()); - else if (cdmvar.getDataType() == DataType.SEQUENCE) - struct = (DapStructure) dmrfactory.newSequence(cdmvar.getShortName()); - else - throw new DapException("Internal error"); - struct.setParent(parent); - recordStruct(cdmvar, struct); - Structure cdmstruct = (Structure) cdmvar; - List fields = cdmstruct.getVariables(); - // recurse to create compound types of any fields c - for (CDMNode node : fields) { - Variable cdmfield = (Variable) node; - List dimset = cdmfield.getDimensions(); - // Recurse on any nested compound types - if (cdmfield.getDataType() == DataType.STRUCTURE || cdmfield.getDataType() == DataType.SEQUENCE) { - DapStructure fieldstruct = buildcompoundtype(cdmfield, struct); - } - } - // Add the fields to this compound type - for (CDMNode node : fields) { - Variable cdmfield = (Variable) node; - DapType basetype = null; - switch (cdmfield.getDataType()) { - default: - basetype = CDMTypeFcns.cdmtype2daptype(cdmfield.getDataType()); - break; - case STRUCTURE: - case SEQUENCE: - basetype = compoundmap.get(cdmfield);// since no forward references - break; - } - // build the field variable - List fielddims = cdmfield.getDimensions(); - DapVariable dapfield; - if (CDMUtil.hasVLEN(cdmfield)) { - // Get the fake sequence associated with this vlen - DapSequence seq = vlenmap.get(cdmfield); - List coredims = getCoreDimset(fielddims); - // We need to build a variable whose basetype is the - // fake sequence rather than the cdmfield type - // First, build a variable using the existing cdmfield - dapfield = buildvariable(cdmfield, struct, coredims); - // Now modify it to use the fake sequence - dapfield.setBaseType(seq); - } else { - dapfield = buildvariable(cdmfield, struct, fielddims); - } - struct.addField(dapfield); - } - return struct; - } - - protected DapVariable buildvariable(Variable cdmbasevar, DapNode parent, List cdmdims) - throws DapException { - DapVariable dapvar = null; - CDMSort sort = cdmbasevar.getSort(); - switch (sort) { - case VARIABLE: - switch (cdmbasevar.getDataType()) { - default: - dapvar = buildatomicvar(cdmbasevar, parent); - break; - case ENUM1: - case ENUM2: - case ENUM4: - dapvar = buildenumvar(cdmbasevar); - break; - case OPAQUE: - dapvar = buildopaquevar(cdmbasevar); - break; - case STRING: - dapvar = buildstringvar(cdmbasevar); - break; - case STRUCTURE: - case SEQUENCE: - assert false : "Internal error"; // How could this ever happen? - break; - - } - builddimrefs(dapvar, cdmdims); - break; - case STRUCTURE: - dapvar = buildstructvar(cdmbasevar); - builddimrefs(dapvar, cdmdims); - break; - case SEQUENCE: - default: - assert false : "Internal Error"; - } - if (parent != null) - addToParent(parent, dapvar); - return dapvar; - } - - protected DapVariable buildatomicvar(Variable cdmvar, DapNode parent) throws DapException { - // Atomic => not opaque and not enum - DapType basetype = CDMTypeFcns.cdmtype2daptype(cdmvar.getDataType()); - if (basetype == null) - throw new DapException("DapFile: illegal CDM variable base type: " + cdmvar.getDataType()); - DapVariable dapvar = (DapVariable) dmrfactory.newVariable(cdmvar.getShortName(), basetype); - recordVar(cdmvar, dapvar); - buildattributes(dapvar, cdmvar.attributes()); - if (CDMUtil.hasVLEN(cdmvar)) { - // Get the fake sequence associated with this vlen - DapSequence seq = vlenmap.get(cdmvar); - List coredims = getCoreDimset(cdmvar.getDimensions()); - // We need to build a variable whose basetype is the - // fake sequence rather than the cdmfield type - // First, build a variable using the existing cdmfield - // Now modify it to use the fake sequence - dapvar.setBaseType(seq); - } - return dapvar; - } - - protected DapVariable buildopaquevar(Variable cdmvar) throws DapException { - assert (cdmvar.getDataType() == DataType.OPAQUE) : "Internal error"; - DapVariable dapvar = (DapVariable) dmrfactory.newVariable(cdmvar.getShortName(), DapType.OPAQUE); - recordVar(cdmvar, dapvar); - buildattributes(dapvar, cdmvar.attributes()); - Object osize = cdmvar.annotation(UCARTAGOPAQUE); - if (osize != null) { - dapvar.addXMLAttribute(UCARTAGOPAQUE, osize.toString()); - } - return dapvar; - } - - protected DapVariable buildstringvar(Variable cdmvar) throws DapException { - assert (cdmvar.getDataType() == DataType.STRING) : "Internal error"; - DapVariable dapvar = (DapVariable) dmrfactory.newVariable(cdmvar.getShortName(), DapType.STRING); - recordVar(cdmvar, dapvar); - buildattributes(dapvar, cdmvar.attributes()); - return dapvar; - } - - protected DapVariable buildenumvar(Variable cdmvar) throws DapException { - assert (cdmvar.getDataType() == DataType.ENUM1 || cdmvar.getDataType() == DataType.ENUM2 - || cdmvar.getDataType() == DataType.ENUM4) : "Internal error"; - - // Now, we need to locate the actual enumeration decl - EnumTypedef enumdef = cdmvar.getEnumTypedef(); - EnumTypedef trueenumdef = findMatchingEnum(enumdef); - // Modify the cdmvar - cdmvar.setEnumTypedef(trueenumdef); - // Now, map to a DapEnumeration - DapEnumeration dapenum = (DapEnumeration) this.nodemap.get(trueenumdef); - assert (dapenum != null); - DapVariable dapvar = (DapVariable) dmrfactory.newVariable(cdmvar.getShortName(), dapenum); - recordVar(cdmvar, dapvar); - buildattributes(dapvar, cdmvar.attributes()); - return dapvar; - } - - protected DapVariable buildstructvar(Variable cdmvar) throws DapException { - assert (cdmvar.getDataType() == DataType.STRUCTURE) : "Internal error"; - // Find the DapStructure that is the basetype for this var - DapStructure struct = compoundmap.get(cdmvar); - assert struct != null : "Internal Error"; - DapVariable dapvar = (DapVariable) dmrfactory.newVariable(cdmvar.getShortName(), struct); - recordVar(cdmvar, dapvar); - buildattributes(dapvar, cdmvar.attributes()); - return dapvar; - } - - /* - * Create a sequence from a variable with a - * variable length last dimension. - * Suppose we have cdm equivalent to this: - * T var[d1]...[dn]][*] - * We convert to the following - * - * - * - * ... - * - * - */ - - protected DapSequence buildseqtype(Variable cdmvar) throws DapException { - cdmvar = CDMUtil.unwrap(cdmvar); - assert (CDMUtil.hasVLEN(cdmvar)); - DataType dt = cdmvar.getDataType(); - DapType daptype = CDMTypeFcns.cdmtype2daptype(dt); - DapSequence seq = (DapSequence) dmrfactory.newSequence(cdmvar.getShortName()); - // fill DapSequence with a single field; note that the dimensions - // are elided because they will attach to the sequence variable, - // not the field - DapVariable field = dmrfactory.newVariable(cdmvar.getShortName(), daptype); - seq.addField(field); - field.setParent(seq); - recordSeq(cdmvar, seq); - return seq; - } - - /** - * Walk this variable, including fields, to construct sequence types - * for any contained vlen dimensions - * - * @param cdmvar variable to walk - */ - - protected void buildseqtypes(Variable cdmvar) throws DapException { - if (CDMUtil.hasVLEN(cdmvar)) { - buildseqtype(cdmvar); - } - if (cdmvar.getDataType() == DataType.STRUCTURE || cdmvar.getDataType() == DataType.SEQUENCE) { - Structure struct = (Structure) cdmvar; - List fields = struct.getVariables(); - for (int i = 0; i < fields.size(); i++) { - Variable field = fields.get(i); - buildseqtypes(field); // recurse for inner vlen dims - } - } - } - - protected void buildattributes(DapNode node, AttributeContainer attributes) throws DapException { - for (Attribute attr : attributes) { - if (!suppress(attr.getShortName())) { - DapAttribute dapattr = buildattribute(attr); - node.addAttribute(dapattr); - } - } - } - - protected DapAttribute buildattribute(Attribute cdmattr) throws DapException { - DapType attrtype = CDMTypeFcns.cdmtype2daptype(cdmattr.getDataType()); - EnumTypedef cdmenum = cdmattr.getEnumType(); - boolean enumfillvalue = (cdmattr.getShortName().equals(FILLVALUE) && cdmenum != null); - DapEnumeration dapenum = null; - - // We need to handle _FillValue specially if the - // the variable is enum typed. - if (enumfillvalue) { - cdmenum = findMatchingEnum(cdmenum); - // Make sure the cdm attribute has type enumx - if (!cdmenum.getBaseType().isEnum()) - throw new DapException("CDM _FillValue attribute type is not enumX"); - // Modify the attr - cdmattr.setEnumType(cdmenum); - // Now, map to a DapEnumeration - dapenum = (DapEnumeration) this.nodemap.get(cdmenum); - if (dapenum == null) - throw new DapException("Illegal CDM variable attribute type: " + cdmenum); - attrtype = dapenum; - } - if (attrtype == null) - throw new DapException("DapFile: illegal CDM variable attribute type: " + cdmattr.getDataType()); - DapAttribute dapattr = (DapAttribute) dmrfactory.newAttribute(cdmattr.getShortName(), attrtype); - recordNode(cdmattr, dapattr); - // Transfer the values - Array values = cdmattr.getValues(); - if (!validatecdmtype(cdmattr.getDataType(), values.getElementType())) - throw new DapException("Attr type versus attribute data mismatch: " + values.getElementType()); - IndexIterator iter = values.getIndexIterator(); - String[] valuelist = null; - Object vec = CDMTypeFcns.createVector(cdmattr.getDataType(), values.getSize()); - for (int i = 0; iter.hasNext(); i++) { - java.lang.reflect.Array.set(vec, i, iter.next()); - } - valuelist = (String[]) Convert.convert(DapType.STRING, attrtype, vec); - dapattr.setValues(valuelist); - return dapattr; - } - - /** - * Assign dimensions to a variable - * - * @param dapvar The variable to which we wish to assign dimensions - * @param cdmdims The cdm dimensions from which we will find the dimension info - */ - protected void builddimrefs(DapVariable dapvar, List cdmdims) throws DapException { - if (cdmdims == null || cdmdims.size() == 0) - return; - // It is unfortunately the case that the dimensions - // associated with the variable are not - // necessarily the same object as those dimensions - // as declared, so we need to use a non-trivial - // matching algorithm. - for (Dimension cdmdim : cdmdims) { - DapDimension dapdim = null; - if (cdmdim.isShared()) { - Dimension declareddim = finddimdecl(cdmdim); - if (declareddim == null) - throw new DapException("Unprocessed cdm dimension: " + cdmdim); - dapdim = (DapDimension) this.nodemap.get(declareddim); - assert dapdim != null; - } else if (cdmdim.isVariableLength()) {// ignore - continue; - } else {// anonymous - dapdim = builddim(cdmdim); - } - assert (dapdim != null) : "Internal error"; - dapvar.addDimension(dapdim); - } - } - - protected void processmappedvariables(Group g) throws DapException { - for (Variable v0 : g.getVariables()) { - Variable cdmvar = CDMUtil.unwrap(v0); - if (cdmvar == null) - throw new DapException("NetcdfDataset synthetic variable: " + v0); - DapNode dapvar = this.varmap.get(cdmvar); - if (dapvar == null) - throw new DapException("Unknown variable: " + cdmvar); - if (!(dapvar instanceof DapVariable)) - throw new DapException("CDMVariable not mapping to dap variable: " + cdmvar); - buildmaps((DapVariable) dapvar, v0); - } - } - - - /** - * @param dapvar The variable to which we wish to assign maps - * @param var The NetcdfDataset variable from which to extract coord system - */ - protected void buildmaps(DapVariable dapvar, Variable var) throws DapException { - // See if this cdm variable has one (or more) coordinate system - List css = null; - if (var.getSort() == CDMSort.VARIABLE) { - VariableDS vds = (VariableDS) var; - css = vds.getCoordinateSystems(); - } else { - StructureDS sds = (StructureDS) var; - css = sds.getCoordinateSystems(); - } - if (css != null && css.size() > 0) { - // Not sure what to do with multiple coordinate systems - // For now, only use the first - CoordinateSystem coordsystems = css.get(0); - for (CoordinateAxis axis : coordsystems.getCoordinateAxes()) { - // First step is to find the dap variable - // corresponding to the map - VariableDS vds = (VariableDS) axis.getOriginalVariable(); - if (vds != null) { - Variable v = CDMUtil.unwrap(vds); - if (v != null) { - DapVariable mapvar = varmap.get(v); - if (mapvar == null) - throw new DapException("Illegal map variable:" + v.toString()); - if (!mapvar.isAtomic()) - throw new DapException("Non-atomic map variable:" + v.toString()); - // Ignore maps where the map variable is inside this scope - /* - * if(!mapvar.isTopLevel()) { - * DapNode parent = mapvar.getContainer(); - * switch (parent.getSort()) { - * case SEQUENCE: - * case STRUCTURE: - * if(dapvar.getBaseType() == parent) // Do we need to do transitive closure? - * throw new DapException("Map var cannot be in same structure as map"); - * break; - * default: - * assert false : "Unexpected container type"; - * } - */ - DapMap map = (DapMap) dmrfactory.newMap(mapvar); - dapvar.addMap(map); - } - } - } - } - } - - protected DapGroup buildgroup(Group cdmgroup) throws DapException { - DapGroup dapgroup = (DapGroup) dmrfactory.newGroup(cdmgroup.getShortName()); - recordNode(cdmgroup, dapgroup); - dapgroup.setShortName(cdmgroup.getShortName()); - fillgroup(dapgroup, cdmgroup); - return dapgroup; - } - - ////////////////////////////////////////////////// - // Utilities - - /** - * Unfortunately, the CDM Iosp does not - * actually use the declared enums. Rather, - * for every enum type'd variable, a new - * enum decl is defined. So, we need - * to find the original enum decl that matches - * the variable's enum. - */ - - protected EnumTypedef findMatchingEnum(EnumTypedef varenum) throws DapException { - List candidates = new ArrayList<>(); - for (Map.Entry entry : this.nodemap.getCDMMap().entrySet()) { - CDMNode cdmnode = entry.getValue(); - if (cdmnode.getSort() != CDMSort.ENUMERATION) - continue; - // Compare the enumeration (note names will differ) - EnumTypedef target = (EnumTypedef) cdmnode; - /* - * Ideally, we should test the types of the enums, - * but, unfortunately, the var enum is always enum4. - * if(target.getBaseType() != varenum.getBaseType()) - * continue; - */ - Map targetmap = target.getMap(); - Map varmap = varenum.getMap(); - if (targetmap.size() != varmap.size()) - continue; - boolean match = true; // until otherwise shown - for (Map.Entry tpair : targetmap.entrySet()) { - String tname = tpair.getValue(); - int value = (int) tpair.getKey(); - boolean found = false; - for (Map.Entry vpair : varmap.entrySet()) { - if (tname.equals(vpair.getValue()) && value == (int) vpair.getKey()) { - found = true; - break; - } - } - if (!found) { - match = false; - break; - } - } - if (!match) - continue; - - // Save it unless it is shadowed by a closer enum - boolean shadowed = false; - for (EnumTypedef etd : candidates) { - if (shadows(etd.getGroup(), target.getGroup())) { - shadowed = true; - break; - } - } - if (!shadowed) - candidates.add(target); - } - - switch (candidates.size()) { - case 0: - throw new DapException("CDMDSP: No matching enum type decl: " + varenum.getShortName()); - case 1: - break; - default: - throw new DapException("CDMDSP: Multiple matching enum type decls: " + varenum.getShortName()); - } - return candidates.get(0); - } - - protected boolean shadows(Group parent, Group child) { - if (child == parent) - return true; - Group candidate = child; - do { - candidate = candidate.getGroup(); - } while (candidate != null && candidate != parent); - return (candidate == parent); - } - - // Convert cdm size to DapDimension size - protected long dapsize(Dimension cdmdim) { - assert (!cdmdim.isVariableLength()); - return (long) cdmdim.getLength(); - } - - protected boolean validatecdmtype(DataType datatype, Class typeclass) { - switch (datatype) { - case CHAR: - return typeclass == char.class; - case BYTE: - case UBYTE: - return typeclass == byte.class; - case SHORT: - case USHORT: - return typeclass == short.class; - case INT: - case UINT: - return typeclass == int.class; - case LONG: - case ULONG: - return typeclass == long.class; - case FLOAT: - return typeclass == float.class; - case DOUBLE: - return typeclass == double.class; - case STRING: - return typeclass == String.class; - case OPAQUE: - return typeclass == Byte[].class; - // For these, return the integer basetype - case ENUM1: - return typeclass == byte.class; - case ENUM2: - return typeclass == short.class; - case ENUM4: - return typeclass == int.class; - - // Undefined - case SEQUENCE: - case STRUCTURE: - default: - break; - } - return false; - } - - - protected Dimension finddimdecl(Dimension dimref) { - // Search on the full name, but be careful, - // the rule is that the declared dimension's fqn - // must be a prefix of the dimension reference. - for (Map.Entry entry : this.nodemap.getCDMMap().entrySet()) { - if (entry.getValue().getSort() != CDMSort.DIMENSION) - continue; - Dimension d = (Dimension) entry.getValue(); - if (isDimDeclFor(d, dimref)) - return d; - } - return null; - } - - protected boolean isDimDeclFor(Dimension decl, Dimension ref) { - if (!decl.isShared()) - return false; // Has no name - // First check shortname and size - if (!decl.getShortName().equals(ref.getShortName())) - return false; - if (decl.getLength() != ref.getLength()) - return false; - // Make sure they are in the same group - String dprefix = decl.getGroup().getFullName(); - String rprefix = ref.getGroup().getFullName(); - return (dprefix.equals(rprefix)); - } - - /* - * protected String - * fixvalue(Object o, DapType datatype) - * { - * TypeSort atype = datatype.getTypeSort(); - * if(o instanceof Character) { - * long l = (long) ((Character) o).charValue(); - * if(atype.isUnsigned()) - * l = l & 0xffL; - * o = Long.valueOf(l); - * } else if(o instanceof Float || o instanceof Double) { - * if(atype == TypeSort.Float32) - * o = Float.valueOf(((Number) o).floatValue()); - * else if(atype == TypeSort.Float64) - * o = Double.valueOf(((Number) o).doubleValue()); - * else - * assert false : "Internal error"; - * } else if(o instanceof Number) { - * long l = ((Number) o).longValue(); - * switch (atype) { - * case Char: - * case UInt8: - * l = l & 0xffL; - * break; - * case UInt16: - * l = l & 0xffffL; - * break; - * case UInt32: - * l = l & 0xffffffffL; - * break; - * default: - * break; - * } - * o = Long.valueOf(l); - * } else if(o instanceof String) { - * o = o.toString(); - * } else if(o instanceof ByteBuffer) { - * // leave it unchanged - * } else if(o instanceof byte[]) { - * o = ByteBuffer.wrap((byte[]) o); - * } else if(o instanceof Byte[]) { - * Byte[] ob = (Byte[]) o; - * byte[] bb = new byte[ob.length]; - * for(int i = 0; i < bb.length; i++) { - * bb[i] = (byte) ob[i]; - * } - * o = ByteBuffer.wrap(bb); - * } //else { // leave it unchanged - * return o; - * } - */ - - ////////////////////////////////////////////////// - - protected NetcdfFile createNetcdfFile(String location, CancelTask canceltask) throws DapException { - try { - NetcdfFile ncfile = NetcdfFile.open(location, -1, canceltask, getContext()); - return ncfile; - } catch (DapException de) { - if (DEBUG) - de.printStackTrace(); - throw de; - } catch (Exception e) { - if (DEBUG) - e.printStackTrace(); - throw new DapException(e); - } - } - - ////////////////////////////////////////////////// - // Utilities - - /** - * Strip vlen dimensions from a set of dimensions - * - * @param dimset - * @return subset of dimset with (trailing) vlen removed - * @throws DapException - */ - static List getCoreDimset(List dimset) throws DapException { - if (dimset == null) - return null; - List core = new ArrayList<>(); - int pos = -1; - int count = 0; - for (int i = 0; i < dimset.size(); i++) { - if (dimset.get(i).isVariableLength()) { - pos = i; - count++; - } else - core.add(dimset.get(i)); - } - if ((pos != dimset.size() - 1) || count > 1) - throw new DapException("Unsupported use of (*) Dimension"); - return core; - } - - /** - * Some attributes that are added by the NetcdfDataset - * need to be kept out of the DMR. This function - * defines that set. - * - * @param attrname A non-escaped attribute name to be tested for suppression - * @return true if the attribute should be suppressed, false otherwise. - */ - protected boolean suppress(String attrname) { - if (attrname.startsWith("_Coord")) - return true; - if (attrname.equals(CDM.UNSIGNED)) - return true; - return false; - } - - protected void addToParent(DapNode parent, DapVariable dapvar) throws DapException { - assert (parent != null); - switch (parent.getSort()) { - case GROUP: - case DATASET: - ((DapGroup) parent).addDecl(dapvar); - break; - case SEQUENCE: - case STRUCTURE: - dapvar.setParent(parent); - break; - default: - assert (false) : "Internal error"; - } - } - -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArray.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArray.java deleted file mode 100644 index 8fd48da4a2..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArray.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.nc2; - -import dap4.core.dmr.*; -import dap4.core.data.DSP; - -/** - * It is convenient to be able to create - * a common "parent" interface for all - * the CDM array classes - */ - -/* package */ interface CDMArray { - public DSP getDSP(); - - public DapVariable getTemplate(); - - public long getSizeBytes(); // In bytes - - public DapType getBaseType(); - - -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayAtomic.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayAtomic.java deleted file mode 100644 index b82b3fe2c9..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayAtomic.java +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.nc2; - -import dap4.cdm.CDMTypeFcns; -import dap4.cdm.CDMUtil; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DapType; -import dap4.core.dmr.DapVariable; -import dap4.core.util.Convert; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.core.util.Slice; -import ucar.ma2.Array; -import ucar.ma2.DataType; -import ucar.ma2.Index; -import ucar.ma2.IndexIterator; -import ucar.nc2.Group; -import java.io.IOException; -import java.util.List; -import static dap4.core.data.DataCursor.Scheme; - -/** - * CDMArrayAtomic wraps a DataCursor object to present - * the ucar.ma2.Array interface. - * CDMArrayAtomic manages a single CDM atomic variable: - * either top-level or for a member. - */ - -/* package */ class CDMArrayAtomic extends Array implements CDMArray { - ///////////////////////////////////////////////////// - // Constants - - ///////////////////////////////////////////////////// - // Instance variables - - protected DSP dsp = null; - protected DapVariable template = null; - protected DapType basetype = null; - - // CDMArray variables - protected DataCursor data = null; - protected Group cdmroot = null; - protected int elementsize = 0; // of one element - protected long dimsize = 0; // # of elements in array; scalar uses value 1 - protected long totalsize = 0; // elementsize*dimsize except when isbytestring - - ////////////////////////////////////////////////// - // Constructor(s) - - /** - * Constructor - * - * @param data DataCursor object providing the actual data - */ - CDMArrayAtomic(DataCursor data) throws DapException { - super(CDMTypeFcns.daptype2cdmtype(((DapVariable) data.getTemplate()).getBaseType()), - CDMUtil.computeEffectiveShape(((DapVariable) data.getTemplate()).getDimensions())); - this.dsp = data.getDSP(); - this.data = data; - this.template = (DapVariable) this.data.getTemplate(); - this.basetype = this.template.getBaseType(); - - this.dimsize = DapUtil.dimProduct(this.template.getDimensions()); - this.elementsize = this.basetype.getSize(); - } - - ///////////////////////////////////////////////// - // CDMArray Interface - - @Override - public DapType getBaseType() { - return this.basetype; - } - - @Override - public DSP getDSP() { - return this.dsp; - } - - @Override - public DapVariable getTemplate() { - return this.template; - } - - ////////////////////////////////////////////////// - // Accessors - - ////////////////////////////////////////////////// - // Array Interface - - public String toString() { - StringBuilder buf = new StringBuilder(); - DapType basetype = getBaseType(); - String sbt = (basetype == null ? "?" : basetype.toString()); - String st = (template == null ? "?" : template.getShortName()); - buf.append(String.format("%s %s[%d]", sbt, st, dimsize)); - return buf.toString(); - } - - ////////////////////////////////////////////////// - // Array API - // TODO: add index range checks - - public Class getElementType() { - DataType dt = CDMTypeFcns.daptype2cdmtype(this.basetype); - if (dt == null) - throw new IllegalArgumentException("Unknown datatype: " + this.basetype); - return CDMTypeFcns.cdmElementClass(dt); - } - - public double getDouble(ucar.ma2.Index cdmidx) { - return getDouble(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public float getFloat(ucar.ma2.Index cdmidx) { - return getFloat(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public long getLong(ucar.ma2.Index cdmidx) { - return getLong(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public int getInt(ucar.ma2.Index cdmidx) { - return getInt(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public short getShort(ucar.ma2.Index cdmidx) { - return getShort(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public byte getByte(ucar.ma2.Index cdmidx) { - return getByte(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public char getChar(ucar.ma2.Index cdmidx) { - return getChar(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public boolean getBoolean(ucar.ma2.Index cdmidx) { - return getBoolean(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - public Object getObject(ucar.ma2.Index cdmidx) { - return getObject(CDMUtil.cdmIndexToIndex(cdmidx)); - } - - // Convert int base to Index based - - public double getDouble(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getDouble(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public float getFloat(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getFloat(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public long getLong(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getLong(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public int getInt(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getInt(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public short getShort(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getShort(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public byte getByte(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getByte(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public char getChar(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getChar(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public boolean getBoolean(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getBoolean(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public Object getObject(int offset) { - DapVariable d4var = (DapVariable) getTemplate(); - long[] dimsizes = DapUtil.getDimSizes(d4var.getDimensions()); - return getObject(DapUtil.offsetToIndex(offset, dimsizes)); - } - - public Object getStorage() { - try { - List slices = DapUtil.dimsetToSlices(this.template.getDimensions()); - Object result = this.data.read(slices); - return result; - } catch (DapException e) { - throw new IllegalArgumentException(); - } - } - - - // Unsupported Methods - - public void setDouble(Index ima, double value) { - throw new UnsupportedOperationException(); - } - - public void setFloat(Index ima, float value) { - throw new UnsupportedOperationException(); - } - - public void setLong(Index ima, long value) { - throw new UnsupportedOperationException(); - } - - public void setInt(Index ima, int value) { - throw new UnsupportedOperationException(); - } - - public void setShort(Index ima, short value) { - throw new UnsupportedOperationException(); - } - - public void setByte(Index ima, byte value) { - throw new UnsupportedOperationException(); - } - - public void setChar(Index ima, char value) { - throw new UnsupportedOperationException(); - } - - public void setBoolean(Index ima, boolean value) { - throw new UnsupportedOperationException(); - } - - public void setObject(Index ima, Object value) { - throw new UnsupportedOperationException(); - } - - public void setDouble(int elem, double value) { - throw new UnsupportedOperationException(); - } - - public void setFloat(int elem, float value) { - throw new UnsupportedOperationException(); - } - - public void setLong(int elem, long value) { - throw new UnsupportedOperationException(); - } - - public void setInt(int elem, int value) { - throw new UnsupportedOperationException(); - } - - public void setShort(int elem, short value) { - throw new UnsupportedOperationException(); - } - - public void setByte(int elem, byte value) { - throw new UnsupportedOperationException(); - } - - public void setChar(int elem, char value) { - throw new UnsupportedOperationException(); - } - - public void setBoolean(int elem, boolean value) { - throw new UnsupportedOperationException(); - } - - public void setObject(int elem, Object value) { - throw new UnsupportedOperationException(); - } - - protected void copyTo1DJavaArray(IndexIterator indexIterator, Object o) { - throw new UnsupportedOperationException(); - } - - protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray) { - throw new UnsupportedOperationException(); - } - - protected Array createView(Index index) { - return this; - } - - ////////////////////////////////////////////////// - // Internal common extractors - - /** - * Get the array element at a specific dap4 index as a double - * - * @param idx of element to get - * @return value at index cast to double if necessary. - */ - protected double getDouble(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.FLOAT64, this.basetype, value); - return (Double) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a float - * converting as needed. - * - * @param idx of element to get - * @return value at index cast to float if necessary. - */ - protected float getFloat(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.FLOAT32, this.basetype, value); - return (Float) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a long - * - * @param idx of element to get - * @return value at index cast to long if necessary. - */ - protected long getLong(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.INT64, this.basetype, value); - return (Long) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a integer - * - * @param idx of element to get - * @return value at index cast to integer if necessary. - */ - protected int getInt(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.INT32, this.basetype, value); - return (Integer) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a short - * - * @param idx of element to get - * @return value at index cast to short if necessary. - */ - protected short getShort(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.INT16, this.basetype, value); - return (Short) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a byte - * - * @param idx of element to get - * @return value at index cast to byte if necessary. - */ - protected byte getByte(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.INT8, this.basetype, value); - return (Byte) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a char - * - * @param idx of element to get - * @return value at index cast to char if necessary. - */ - protected char getChar(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.CHAR, this.basetype, value); - return (Character) java.lang.reflect.Array.get(value, 0); - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as a boolean - * - * @param idx of element to get - * @return value at index cast to char if necessary. - */ - protected boolean getBoolean(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = Convert.convert(DapType.INT64, this.basetype, value); - return ((Long) java.lang.reflect.Array.get(value, 0)) != 0; - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - /** - * Get the array element at a specific dap4 index as an Object - * - * @param idx of element to get - * @return value at index cast to Object if necessary. - */ - protected Object getObject(dap4.core.util.Index idx) { - assert data.getScheme() == Scheme.ATOMIC; - try { - Object value = data.read(idx); - value = java.lang.reflect.Array.get(value, 0); - return value; - } catch (IOException ioe) { - throw new IndexOutOfBoundsException(ioe.getMessage()); - } - } - - - ////////////////////////////////////////////////// - // DataAtomic Interface - - public DapVariable getVariable() { - return this.template; - } - - public DapType getType() { - return this.basetype; - } - - /* - * protected Object - * read(long index, DapType datatype, DataAtomic content) - * throws DapException - * { - * Object result; - * int i = (int) index; - * long tmp = 0; - * switch (datatype.getTypeSort()) { - * case Int8: - * result = (Byte) content.getByte(i); - * break; - * case Char: - * result = (Character) content.getChar(i); - * break; - * case SHORT: - * result = (Short) content.getShort(i); - * break; - * case INT: - * result = (Integer) content.getInt(i); - * break; - * case LONG: - * result = (Long) content.getLong(i); - * break; - * case FLOAT: - * result = (Float) content.getFloat(i); - * break; - * case DOUBLE: - * result = (Double) content.getDouble(i); - * break; - * case STRING: - * result = content.getObject(i).toString(); - * break; - * case OBJECT: - * result = content.getObject(i); - * break; - * case UBYTE: - * tmp = content.getByte(i) & 0xFF; - * result = (Byte) (byte) tmp; - * break; - * case USHORT: - * tmp = content.getShort(i) & 0xFFFF; - * result = (Short) (short) tmp; - * break; - * case UINT: - * tmp = content.getInt(i) & 0xFFFFFFFF; - * result = (Integer) (int) tmp; - * break; - * case ULONG: - * result = (Long) content.getLong(i); - * break; - * case ENUM1: - * result = read(index, DataType.BYTE, content); - * break; - * case ENUM2: - * result = read(index, DataType.SHORT, content); - * break; - * case ENUM4: - * result = read(index, DataType.INT, content); - * break; - * case OPAQUE: - * result = content.getObject(i); - * break; - * case STRUCTURE: - * case SEQUENCE: - * default: - * throw new DapException("Attempt to read non-atomic value of type: " + datatype); - * } - * return result; - * } - */ - - ////////////////////////////////////////////////// - // Utilities -} - diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayDelegate.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayDelegate.java deleted file mode 100644 index ec75886200..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayDelegate.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.nc2; - -import dap4.core.dmr.*; -import dap4.core.data.DSP; - -/** - * Since we can't use AbstractCDMArray, - * we define a delegator for CDMArray. - * This class actually is never used, it is just - * a placeholder to store the API that should be - * included in every class implementing CMDArray. - * If this class fails to compile then any fix - * must be propagated to the CDMArray implementing classes. - */ - -/* package */ class CDMArrayDelegate implements CDMArray { - protected DSP dsp = null; - protected DapVariable template = null; - protected long bytesize = 0; - protected DapType basetype = null; - protected TypeSort primitivetype = null; - - /* - * The implementing class will need to - * initialize the fields. - * this.template = template; - * this.bytesize = 0; - * this.root = root; - * this.dsp = dsp; - * this.bytesize = size; - * this.basetype = this.template.getBaseType(); - * this.primitivetype = this.basetype.getPrimitiveType(); - */ - - @Override - public DSP getDSP() { - return this.dsp; - } - - @Override - public DapVariable getTemplate() { - return this.template; - } - - @Override - public long getSizeBytes() { - return this.bytesize; - } - - @Override - public DapType getBaseType() { - return this.basetype; - } - -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArraySequence.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArraySequence.java deleted file mode 100644 index b60a033e8f..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArraySequence.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.nc2; - -import dap4.cdm.CDMTypeFcns; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DapSequence; -import dap4.core.dmr.DapStructure; -import dap4.core.dmr.DapType; -import dap4.core.dmr.DapVariable; -import dap4.core.util.*; -import ucar.ma2.*; -import ucar.nc2.Group; -import java.io.IOException; -import java.util.List; - -/** - * CDM now has an ArraySequence type intended to - * support VLEN (aka CDM (*) dimension). - * So, sequence is simulated as a rank n+1 structure where - * the last dimension is "*" (i.e. variable length). - * That is, given the following DAP4: - * Sequence S {f1,f2,...fm} [d1][d2]...[dn] - * Represent it in CDM as this: - * Structure S {f1,f2,...fm} [d1][d2]...[dn][*] - * We cannot subclass CDMArrayStructure because we need to subclass - * ArraySequence, so we are forced to duplicate a lot of the CDMArrayStructure - * code. - * The important point to note is that for CDM, we do not need to support - * Dimensioned sequences; the dimensions are supported by the enclosing - * ArrayStructure covering the non-vlen dimensions - */ - -/* package */ class CDMArraySequence extends ArraySequence implements CDMArray { - - ////////////////////////////////////////////////// - // Type decls - - // Define an open wrapper around a field array in order - // to make the code somewhat more clear - - protected static class FieldSet { - public Array[] fields; - - FieldSet(int nfields) { - fields = new Array[nfields]; - } - } - - public static class SDI implements StructureDataIterator { - protected StructureData[] list; - protected int position; - - public SDI() { - this.list = null; - this.position = 0; - } - - public SDI setList(StructureData[] list) { - this.list = list; - return this; - } - - public boolean hasNext() throws IOException { - return position < list.length; - } - - public StructureData next() throws IOException { - if (position >= list.length) - throw new IOException("No next element"); - return list[position++]; - } - - public StructureDataIterator reset() { - position = 0; - return this; - } - - public int getCurrentRecno() { - return position; - } - - } - - ////////////////////////////////////////////////// - // Instance variables - - protected Group cdmroot = null; - protected DSP dsp; - protected DapVariable template; - protected DapType basetype; - protected long bytesize = 0; - protected long recordcount = 0; - protected int nmembers = 0; - - protected DataCursor seqdata = null; - - /** - * Since in CDM a sequence is the last dimension of - * array, we do not need to keep dimensionality info, only - * the variable length stuff, which we do using - * StructureDataA instances: 1 per record. - */ - - // Track the records of this sequence as an array - // Note: term records here means the elements of the array, - // not record as in Sequence - - protected FieldSet[] records = null; // list of records - - ////////////////////////////////////////////////// - // Constructor(s) - - /** - * Constructor - * - * @param data - */ - CDMArraySequence(Group group, DataCursor data) throws DapException { - super(CDMArrayStructure.computemembers((DapVariable) data.getTemplate()), new SDI(), 0); - this.template = (DapVariable) data.getTemplate(); - this.basetype = this.template.getBaseType(); - // Currently do not allow non-scalar sequences - if (this.template.getRank() != 0) - throw new DapException("Non-scalar sequences unsupported through CDM interface"); - assert data.getScheme() == DataCursor.Scheme.SEQARRAY; - this.cdmroot = group; - this.dsp = dsp; - // Since this is a scalar, pull out the single instance - this.seqdata = ((DataCursor[]) data.read(dap4.core.util.Index.SCALAR))[0]; - this.recordcount = this.seqdata.getRecordCount(); - this.nmembers = ((DapStructure) this.basetype).getFields().size(); - - // Fill in the structdata (in parent) and record vectors - super.sdata = new StructureDataA[(int) this.recordcount]; - records = new FieldSet[(int) this.recordcount]; - for (int i = 0; i < this.recordcount; i++) { - super.sdata[i] = new StructureDataA(this, i); - records[i] = new FieldSet(this.nmembers); - } - - ((SDI) super.iter).setList(super.sdata); - } - - ////////////////////////////////////////////////// - // Compiler API - - /* package */ - void add(long recno, int fieldno, Array field) { - // Make sure all the space is allocated - if (records.length <= recno) { - FieldSet[] newrecs = new FieldSet[(int) recno + 1]; - System.arraycopy(records, 0, newrecs, 0, records.length); - records = newrecs; - } - FieldSet fs = records[(int) recno]; - if (fs == null) { - records[(int) recno] = (fs = new FieldSet(this.nmembers)); - } - fs.fields[fieldno] = field; - } - - ////////////////////////////////////////////////// - // CDMArray Interface - - @Override - public DapType getBaseType() { - return this.basetype; - } - - @Override - public DSP getDSP() { - return this.dsp; - } - - @Override - public DapVariable getTemplate() { - return template; - } - - ////////////////////////////////////////////////// - - public String toString() { - StringBuilder buf = new StringBuilder(); - DapVariable var = this.template; - DapSequence seq = (DapSequence) this.basetype; - long dimsize = DapUtil.dimProduct(var.getDimensions()); - for (int i = 0; i < dimsize; i++) { - List fields = seq.getFields(); - if (i < (dimsize - 1)) - buf.append("\n"); - buf.append("Sequence {\n"); - buf.append(String.format("} [%d/%d]", i, dimsize)); - } - return buf.toString(); - } - - - ////////////////////////////////////////////////// - // ArraySequence/ArrayStructure overrides - - @Override - public int getStructureDataCount() { - return this.records.length; - } - - @Override - protected StructureData makeStructureData(ArrayStructure as, int index) { - throw new UnsupportedOperationException("Cannot subset a Sequence"); - } - - /** - * Get the index'th StructureData(StructureDataA) object - * We need instances of StructureData to give to the user. - * We use StructureDataA so we can centralize everything - * in this class. The total number of StructureData objects - * is dimsize. - * - * @param index - * @return - */ - @Override - public StructureData getStructureData(int index) { - assert (super.sdata != null); - if (index < 0 || index >= this.records.length) - throw new IllegalArgumentException(index + " >= " + super.sdata.length); - assert (super.sdata[index] != null); - return super.sdata[index]; - } - - public ArraySequence getArraySequence(StructureMembers.Member m) { - return this; - } - - ///////////////////////// - // Define API required by StructureDataA - @Override - public Array copy() { - return this; // temporary - } - - /** - * Get member data of any type for a specific record as an Array. - * This may avoid the overhead of creating the StructureData object, - * but is equivalent to getStructure(recno).getArray( Member m). - * - * @param recno get data from the recnum-th StructureData of the ArrayStructure. - * Must be less than getSize(); - * @param m get data from this StructureMembers.Member. - * @return Array values. - */ - public Array getArray(int recno, StructureMembers.Member m) { - return (ucar.ma2.Array) memberArray(recno, CDMArrayStructure.memberIndex(m)); - } - - ///////////////////////// - - protected CDMArrayAtomic getAtomicArray(int index, StructureMembers.Member m) { - Array dd = memberArray(index, CDMArrayStructure.memberIndex(m)); - if (dd.getDataType() != DataType.STRUCTURE && dd.getDataType() != DataType.SEQUENCE) - return (CDMArrayAtomic) dd; - throw new ForbiddenConversionException("Cannot convert structure to AtomicArray"); - } - - protected Array memberArray(int recno, int memberindex) { - - Object[] values = new Object[(int) this.recordcount]; - for (int i = 0; i < this.recordcount; i++) { - FieldSet fs = records[i]; - values[i] = fs.fields[memberindex]; - } - DapVariable field = ((DapStructure) this.basetype).getField(memberindex); - DapType base = field.getBaseType(); - if (base == null) - throw new IllegalStateException("Unknown field type: " + field); - DataType dt = CDMTypeFcns.daptype2cdmtype(base); - Class elemtype = CDMTypeFcns.cdmElementClass(dt); - int shape[] = new int[] {(int) this.recordcount}; - return new ArrayObject(dt, elemtype, false, shape, values); - } -} - diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayStructure.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayStructure.java deleted file mode 100644 index 57421103f9..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayStructure.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.cdm.nc2; - -import dap4.cdm.CDMTypeFcns; -import dap4.cdm.CDMUtil; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DapStructure; -import dap4.core.dmr.DapType; -import dap4.core.dmr.DapVariable; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.core.util.Slice; -import dap4.dap4lib.LibTypeFcns; -import ucar.ma2.*; -import ucar.nc2.Group; -import java.nio.ByteBuffer; -import java.util.List; -import static dap4.core.data.DataCursor.Scheme; - -/** - * Implementation of ArrayStructure that wraps - * DAP4 databuffer - * (Note: Needs serious optimization applied). - *

- * Given - * Structure S {f1,f2,...fm} [d1][d2]...[dn], - * internally, this is stored as a 2-D array - * CDMArray[][] instances; - * The first dimension's length is d1*d2*...dn. - * The second dimension has size |members| i.e. the number - * of fields in the sequence. - */ - -/* package */ class CDMArrayStructure extends ArrayStructure implements CDMArray { - ////////////////////////////////////////////////// - // Type decls - - /** - * We need to keep a map of index X fieldno -> Array - * representing the Array behind each field for each - * struct instance in a matrix of struct instances. - * To promote some clarity a eschew Array[|dimset|][|fields|] - * in favor of FieldArrays[|dimset|]. - */ - protected static class FieldArrays { - public Array[] fields; // Make externally accessible - - FieldArrays(int nfields) { - fields = new Array[nfields]; - } - - } - - ////////////////////////////////////////////////// - // Instance variables - - // CDMArry variables - protected Group cdmroot = null; - protected DSP dsp = null; - protected DapVariable template = null; - protected DapType basetype = null; - protected long dimsize = 0; - protected int nmembers = 0; - - protected DataCursor data = null; - - /** - * Since we are using StructureDataA, - * we store a list Field sets - * So we have a map: index -> Field object. - * Total number of objects is dimsize. - * Accessed by calls from StructureDataA. - * Note: We use the super.sdata field to store - * the StructureData instances. - */ - - // Note: term records here means the elements of the array, - // not record as in Sequence - - protected FieldArrays[] records = null; // list of Structure elements - - - ////////////////////////////////////////////////// - // Constructor(s) - - /** - * Constructor - * - * @param cdmroot the parent CDMDataset - * @param data the structure data - */ - CDMArrayStructure(Group cdmroot, DataCursor data) { - super(computemembers((DapVariable) data.getTemplate()), - CDMUtil.computeEffectiveShape(((DapVariable) data.getTemplate()).getDimensions())); - this.template = (DapVariable) data.getTemplate(); - assert data.getScheme() == Scheme.STRUCTARRAY; - this.dsp = data.getDSP(); - this.cdmroot = cdmroot; - this.basetype = this.template.getBaseType(); - this.dimsize = DapUtil.dimProduct(template.getDimensions()); - this.nmembers = ((DapStructure) template.getBaseType()).getFields().size(); - - this.data = data; - - // Fill in the structdata (in parent) and instance vectors - super.sdata = new StructureDataA[(int) this.dimsize]; - records = new FieldArrays[(int) this.dimsize]; - for (int i = 0; i < dimsize; i++) { - super.sdata[i] = new StructureDataA(this, i); - records[i] = new FieldArrays(this.nmembers); - } - } - - /** - * - * @param recno struct instance - * @param fieldno field of that struct - * @param field Array backing this field in this struct instance - */ - /* package */ - void add(long recno, int fieldno, Array field) { - FieldArrays fs = records[(int) recno]; - if (fs == null) - records[(int) recno] = (fs = new FieldArrays(this.nmembers)); - fs.fields[fieldno] = field; - } - ////////////////////////////////////////////////// - // CDMArray Interface - - @Override - public DSP getDSP() { - return this.dsp; - } - - @Override - public DapVariable getTemplate() { - return this.template; - } - - @Override - public DapType getBaseType() { - return this.basetype; - } - - ////////////////////////////////////////////////// - // Accessors - - @Override - public long getSize() { - return this.dimsize; - } - - ////////////////////////////////////////////////// - - public String toString() { - StringBuilder buf = new StringBuilder(); - DapVariable var = (DapVariable) this.template; - DapStructure struct = (DapStructure) var.getBaseType(); - for (int i = 0; i < this.dimsize; i++) { - List fields = struct.getFields(); - if (i < (this.dimsize - 1)) - buf.append("\n"); - buf.append("Structure {\n"); - if (fields != null) { - for (int j = 0; j < this.nmembers; j++) { - Array field = records[i].fields[j]; - String sfield = (field == null ? "null" : fields.toString()); - buf.append(sfield + "\n"); - } - } - buf.append(String.format("} [%d/%d]", i, dimsize)); - } - return buf.toString(); - } - - ////////////////////////////////////////////////// - // ArrayStructure interface - - /** - * Get the index'th StructureData(StructureDataA) object - * We need instances of StructureData to give to the user. - * We use StructureDataA so we can centralize everything - * in this class. The total number of StructureData objects - * is dimsize. - * - * @param index - * @return - */ - @Override - public StructureData getStructureData(int index) { - assert (super.sdata != null); - if (index < 0 || index >= this.dimsize) - throw new IllegalArgumentException(index + " >= " + super.sdata.length); - assert (super.sdata[index] != null); - return super.sdata[index]; - } - - public double getScalarDouble(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getDouble(0); - } - - public float getScalarFloat(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getFloat(0); - } - - public byte getScalarByte(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getByte(0); - } - - public short getScalarShort(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getShort(0); - } - - public int getScalarInt(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getInt(0); - } - - public long getScalarLong(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getLong(0); - } - - public char getScalarChar(int index, StructureMembers.Member m) { - CDMArrayAtomic data = getAtomicArray(index, m); - return data.getChar(0); - } - - /** - * Get member databuffer of type String or char. - * - * @param recnum get databuffer from the recnum-th StructureData of the ArrayStructure. Must be less than getSize(); - * @param m get databuffer from this StructureMembers.Member. Must be of type String or char. - * @return scalar String value - */ - public String getScalarString(int recnum, StructureMembers.Member m) { - Array data = m.getDataArray(); - return (String) data.getObject(recnum).toString(); - } - - public double[] getJavaArrayDouble(int recnum, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(recnum, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (double[]) LibTypeFcns.convertVector(DapType.FLOAT64, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public float[] getJavaArrayFloat(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (float[]) LibTypeFcns.convertVector(DapType.FLOAT32, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public byte[] getJavaArrayByte(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (byte[]) LibTypeFcns.convertVector(DapType.INT8, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public short[] getJavaArrayShort(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (short[]) LibTypeFcns.convertVector(DapType.INT16, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public int[] getJavaArrayInt(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (int[]) LibTypeFcns.convertVector(DapType.INT32, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public long[] getJavaArrayLong(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (long[]) LibTypeFcns.convertVector(DapType.INT64, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public char[] getJavaArrayChar(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - if (!array.getBaseType().isNumericType()) - throw new IllegalArgumentException("Cannot convert non-numeric type"); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (char[]) LibTypeFcns.convertVector(DapType.CHAR, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public String[] getJavaArrayString(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (String[]) LibTypeFcns.convertVector(DapType.STRING, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - public ByteBuffer[] getJavaArrayOpaque(int index, StructureMembers.Member m) { - CDMArrayAtomic array = getAtomicArray(index, m); - DapType atomtype = array.getBaseType(); - try { - List slices = CDMUtil.shapeToSlices(m.getShape()); - Object vector = data.read(slices); - return (ByteBuffer[]) LibTypeFcns.convertVector(DapType.OPAQUE, atomtype, vector); - } catch (DapException de) { - throw new UnsupportedOperationException(de); - } - } - - // Non-atomic cases - - public StructureData getScalarStructure(int index, StructureMembers.Member m) { - if (m.getDataType() != DataType.STRUCTURE) - throw new ForbiddenConversionException("Atomic field cannot be converted to Structure"); - Array ca = memberArray(index, memberIndex(m)); - if (ca.getDataType() != DataType.STRUCTURE && ca.getDataType() != DataType.SEQUENCE) - throw new ForbiddenConversionException("Attempt to access non-structure member"); - CDMArrayStructure as = (CDMArrayStructure) ca; - return as.getStructureData(0); - } - - public ArrayStructure getArrayStructure(int index, StructureMembers.Member m) { - if (m.getDataType() != DataType.STRUCTURE) - throw new ForbiddenConversionException("Atomic field cannot be converted to Structure"); - Array dd = memberArray(index, memberIndex(m)); - if (dd.getDataType() != DataType.STRUCTURE && dd.getDataType() != DataType.SEQUENCE) - throw new ForbiddenConversionException("Attempt to access non-structure member"); - return (CDMArrayStructure) dd; - } - - public ArraySequence getArraySequence(StructureMembers.Member m) { - throw new UnsupportedOperationException("CDMArraySequence"); - } - - @Override - public Array copy() { - return this; // temporary - } - - ///////////////////////// - // Define API required by StructureDataA - - /** - * Key interface method coming in from StructureDataA. - * - * @param recno The instance # of the array of Structure instances - * @param m The member of interest in the Structure instance - * @return The ucar.ma2.Array instance corresponding to the instance. - *

- * Hidden: friend of StructureDataA - */ - @Override - public ucar.ma2.Array getArray(int recno, StructureMembers.Member m) { - return (ucar.ma2.Array) memberArray(recno, memberIndex(m)); - } - - ////////////////////////////////////////////////// - // Utilities - - @Override - protected StructureData makeStructureData(ArrayStructure as, int index) { - if (super.sdata[index] == null) - super.sdata[index] = new StructureDataA(as, index); - return super.sdata[index]; - } - - /** - * Compute the StructureMembers object - * from a DapStructure. May need to recurse - * if a field is itself a Structure - * - * @param var The DapVariable to use to construct - * a StructureMembers object. - * @return The StructureMembers object for the given DapStructure - */ - static StructureMembers computemembers(DapVariable var) { - DapStructure ds = (DapStructure) var.getBaseType(); - StructureMembers sm = new StructureMembers(ds.getShortName()); - List fields = ds.getFields(); - for (int i = 0; i < fields.size(); i++) { - DapVariable field = fields.get(i); - DapType dt = field.getBaseType(); - DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt); - StructureMembers.Member m = - sm.addMember(field.getShortName(), "", null, cdmtype, CDMUtil.computeEffectiveShape(field.getDimensions())); - m.setDataParam(i); // So we can index into various lists - // recurse if this field is itself a structure - if (dt.getTypeSort().isStructType()) { - StructureMembers subsm = computemembers(field); - m.setStructureMembers(subsm); - } - } - return sm; - } - - /** - * @param recno The instance # of the array of Structure instances - * @param memberindex The member of interest in the Structure instance - * @return The ucar.ma2.Array instance corresponding to the instance. - */ - protected Array memberArray(int recno, int memberindex) { - DapVariable var = (DapVariable) this.getTemplate(); - DapStructure struct = (DapStructure) var.getBaseType(); - DapVariable field = struct.getField(memberindex); - DapType base = field.getBaseType(); - if (base == null) - throw new IllegalStateException("Unknown field type: " + field); - Object[] values = new Object[(int) field.getCount()]; - FieldArrays fs = records[recno]; - Array fa = fs.fields[memberindex]; - return fa; - } - - protected static int memberIndex(StructureMembers.Member m) { - return m.getDataParam(); - } - - protected CDMArrayAtomic getAtomicArray(int index, StructureMembers.Member m) { - Array dd = memberArray(index, memberIndex(m)); - if (dd.getDataType() != DataType.STRUCTURE && dd.getDataType() != DataType.SEQUENCE) - return (CDMArrayAtomic) dd; - throw new ForbiddenConversionException("Cannot convert structure to AtomicArray"); - } - -} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DataToCDM.java b/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DataToCDM.java deleted file mode 100644 index 96b85a765d..0000000000 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DataToCDM.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - - -package dap4.cdm.nc2; - -import dap4.cdm.NodeMap; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.*; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.core.util.Index; -import dap4.core.util.Odometer; -import ucar.ma2.Array; -import ucar.nc2.Attribute; -import ucar.nc2.Group; -import ucar.nc2.Variable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Create a set of CDM ucar.ma2.array objects that wrap a DSP. - */ - -public class DataToCDM { - public static boolean DEBUG = false; - - ////////////////////////////////////////////////// - // Constants - - protected static final int COUNTSIZE = 8; // databuffer as specified by the DAP4 spec - - protected static final String LBRACE = "{"; - protected static final String RBRACE = "}"; - - ////////////////////////////////////////////////// - // Instance variables - - protected DapNetcdfFile ncfile = null; - protected DSP dsp = null; - protected DapDataset dmr = null; - protected Group cdmroot = null; - protected Map arraymap = null; - protected NodeMap nodemap = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - /** - * Constructor - * - * @param ncfile the target NetcdfDataset - * @param dsp the compiled D4 databuffer - */ - - public DataToCDM(DapNetcdfFile ncfile, DSP dsp, NodeMap nodemap) throws DapException { - this.ncfile = ncfile; - this.dsp = dsp; - this.dmr = dsp.getDMR(); - this.nodemap = nodemap; - this.cdmroot = ncfile.getRootGroup(); - arraymap = new HashMap(); - // Add endianness attribute to the group - /* - * ByteOrder remoteorder = ncfile.getDSP().getOrder(); - * String endianness = null; - * if(remoteorder != null) { - * if(remoteorder == ByteOrder.BIG_ENDIAN) - * endianness = "big"; - * else if(remoteorder == ByteOrder.BIG_ENDIAN) - * endianness = "little"; - * } - * if(endianness != null) { - * Attribute aendian = new Attribute(DapUtil.ENDIANATTRNAME, endianness); - * this.cdmroot.addAttribute(aendian); - * } - */ - } - - ////////////////////////////////////////////////// - // Compile DataCursor objects to ucar.ma2.Array objects - - /* package access */ - Map create() throws DapException { - // iterate over the variables represented in the DSP - List topvars = this.dmr.getTopVariables(); - Map map = null; - for (DapVariable var : topvars) { - DataCursor cursor = this.dsp.getVariableData(var); - Array array = createVar(cursor); - Variable cdmvar = (Variable) nodemap.get(var); - arraymap.put(cdmvar, array); - } - return this.arraymap; - } - - protected Array createVar(DataCursor data) throws DapException { - Array array = null; - DapVariable d4var = (DapVariable) data.getTemplate(); - switch (d4var.getBaseType().getTypeSort()) { - default: // atomic var - array = createAtomicVar(data); - break; - case Sequence: - array = createSequence(data); - break; - case Structure: - array = createStructure(data); - break; - } - if (d4var.isTopLevel() && this.dsp.getChecksumMode().enabled(dsp.getChecksumMode())) { - // transfer the checksum attribute - int csum = d4var.getChecksum(); - String scsum = String.format("0x%08x", csum); - Variable cdmvar = (Variable) nodemap.get(d4var); - Attribute acsum = new Attribute(DapUtil.CHECKSUMATTRNAME, scsum); - cdmvar.addAttribute(acsum); - } - return array; - } - - /** - * Create an Atomic Valued variable. - * - * @return An Array object wrapping d4var. - * @throws DapException - */ - protected CDMArrayAtomic createAtomicVar(DataCursor data) throws DapException { - CDMArrayAtomic array = new CDMArrayAtomic(data); - return array; - } - - /** - * Create an array of structures. WARNING: the underlying CDM code - * (esp. NetcdfDataset) apparently does not support nested - * structure arrays; so this code may throw an exception. - * - * @return A CDMArrayStructure for the databuffer for this struct. - * @throws DapException - */ - protected CDMArrayStructure createStructure(DataCursor data) throws DapException { - CDMArrayStructure arraystruct = new CDMArrayStructure(this.cdmroot, data); - DapVariable var = (DapVariable) data.getTemplate(); - DapStructure struct = (DapStructure) var.getBaseType(); - int nmembers = struct.getFields().size(); - List dimset = var.getDimensions(); - Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset)); - while (odom.hasNext()) { - Index index = odom.next(); - long offset = index.index(); - DataCursor[] cursors = (DataCursor[]) data.read(index); - DataCursor ithelement = cursors[0]; - for (int f = 0; f < nmembers; f++) { - DataCursor dc = (DataCursor) ithelement.readField(f); - Array afield = createVar(dc); - arraystruct.add(offset, f, afield); - } - } - return arraystruct; - } - - /** - * Create a sequence. WARNING: the underlying CDM code - * (esp. NetcdfDataset) apparently does not support nested - * sequence arrays. - * - * @param data the data underlying this sequence instance - * @return A CDMArraySequence for this instance - * @throws DapException - */ - - protected CDMArraySequence createSequence(DataCursor data) throws DapException { - CDMArraySequence arrayseq = new CDMArraySequence(this.cdmroot, data); - DapVariable var = (DapVariable) data.getTemplate(); - DapSequence template = (DapSequence) var.getBaseType(); - List dimset = var.getDimensions(); - long dimsize = DapUtil.dimProduct(dimset); - int nfields = template.getFields().size(); - Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset)); - while (odom.hasNext()) { - odom.next(); - DataCursor seq = ((DataCursor[]) data.read(odom.indices()))[0]; - long nrecords = seq.getRecordCount(); - for (int r = 0; r < nrecords; r++) { - DataCursor rec = seq.readRecord(r); - for (int f = 0; f < nfields; f++) { - DataCursor dc = rec.readField(f); - Array afield = createVar(dc); - arrayseq.add(r, f, afield); - } - } - } - return arrayseq; - } -} diff --git a/dap4/d4cdm/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider b/dap4/d4cdm/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider deleted file mode 100644 index 8acc1012f6..0000000000 --- a/dap4/d4cdm/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider +++ /dev/null @@ -1 +0,0 @@ -dap4.cdm.nc2.DapNetcdfFileProvider \ No newline at end of file diff --git a/dap4/d4core/build.gradle b/dap4/d4core/build.gradle deleted file mode 100644 index 9e4a50d5b4..0000000000 --- a/dap4/d4core/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -// d4core has no dependencies -apply from: "$rootDir/gradle/any/java-library.gradle" - -dependencies { -} diff --git a/dap4/d4core/src/main/java/dap4/core/data/ChecksumMode.java b/dap4/d4core/src/main/java/dap4/core/data/ChecksumMode.java deleted file mode 100644 index 5554e36c42..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/data/ChecksumMode.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.data; - -/** - * Define possible checksum modes: - * - */ -public enum ChecksumMode { - NONE, // => serialized data has no checksums - IGNORE, // => skip, but ignore any checksumming (client side) - DMR, // => compute checksums for DMR requests only - DAP, // => compute checksums for Data requests only - ALL; // => compute checksums for both kinds of requestsNONE, DMR, DAP, ALL; - - /** - * Return true if the ckm mode is allowed with this, false otherwise - * - * @param ckm - * @return true, if enabled - */ - public boolean enabled(ChecksumMode ckm) { - if (ckm == null || this == NONE) - return false; - if (this == ckm) - return true; - if (this == ALL) - return true; - return false; - } - - public static ChecksumMode modeFor(String s) { - if (s == null || s.length() == 0) - return DAP; - for (ChecksumMode mode : values()) { - if (mode.name().equalsIgnoreCase(s)) - return mode; - } - return null; - } -} diff --git a/dap4/d4core/src/main/java/dap4/core/data/Constraint.java b/dap4/d4core/src/main/java/dap4/core/data/Constraint.java deleted file mode 100644 index 271e341d78..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/data/Constraint.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.data; - -/** - * This interface is intended to serve - * as a standin for some kind of constraint. - */ - -public interface Constraint { - // Deliberately empty -} diff --git a/dap4/d4core/src/main/java/dap4/core/data/DSP.java b/dap4/d4core/src/main/java/dap4/core/data/DSP.java deleted file mode 100644 index 7715ee5a35..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/data/DSP.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.data; - -import dap4.core.dmr.DapDataset; -import dap4.core.dmr.DapVariable; -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import java.io.IOException; -import java.nio.ByteOrder; - -public interface DSP { - /* - * All implementing classes must implement: - * 1. a static dspMatch() function - * 2. A parameterless constructor - */ - - /** - * Determine if a path refers to an object processable by this DSP - * - * @param path - * @param context - * @return true if this path can be processed by an instance of this DSP - */ - public boolean dspMatch(String path, DapContext context); - - /** - * @param path It is assumed that the path - * is appropriate to the dsp - * E.g. an absolute path or a url - * @return DSP wrapping the path source - * @throws dap4.core.util.DapException - */ - public DSP open(String path) throws DapException; - - public void close() throws IOException; - - public String getLocation(); - - public DSP setLocation(String location); - - public Object getContext(); - - public void setContext(DapContext cxt); - - public DapDataset getDMR() throws dap4.core.util.DapException; - - public DataCursor getVariableData(DapVariable var) throws DapException; - - public ByteOrder getOrder(); - - public ChecksumMode getChecksumMode(); - -} diff --git a/dap4/d4core/src/main/java/dap4/core/data/DataCursor.java b/dap4/d4core/src/main/java/dap4/core/data/DataCursor.java deleted file mode 100644 index 2da280d972..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/data/DataCursor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.data; - -import dap4.core.dmr.DapNode; -import dap4.core.util.DapException; -import dap4.core.util.Index; -import dap4.core.util.Slice; -import java.util.List; - -/** - * For data access, we adopt a cursor model. - * This comes from database technology where a - * cursor object is used to walk over the - * results of a database query. Here the cursor - * walks the underlying data and stores enough - * state to extract data depending on its - * sort. The cursor may (or may not) contain - * internal subclasses to track various kinds of - * state. - */ - -public interface DataCursor { - ////////////////////////////////////////////////// - // Kinds of Cursor - - public static enum Scheme { - ATOMIC, STRUCTARRAY, STRUCTURE, SEQARRAY, SEQUENCE, RECORD; - - public boolean isCompoundArray() { - return this == STRUCTARRAY || this == SEQARRAY; - } - } - - ////////////////////////////////////////////////// - // API - - public Scheme getScheme(); - - public DSP getDSP(); - - public DapNode getTemplate(); - - public Index getIndex() throws DapException; - - public boolean isScalar(); - - public boolean isField(); - - // Return null if top-level, else return the struct/seq from which this is derived - public DataCursor getContainer(); - - ////////////////////////////////////////////////// - // Atomic Data Management - - // As a rule, only one will be fully implemented and the other written - // to use the fully implemented one. - // Returns: - // atomic - array of data values - // structure/sequence - DataCursor[] - // Even if the result is a scalar, - // a 1-element array will be returned. - - public Object read(List slices) throws DapException; - - public Object read(Index index) throws DapException; - - ////////////////////////////////////////////////// - // Sequence record management - // assert scheme == SEQUENCE - - public long getRecordCount() throws DapException; - - public DataCursor readRecord(long i) throws DapException; - - public long getRecordIndex() throws DapException; // assert scheme == RECORD - - ////////////////////////////////////////////////// - // field management - // assert scheme == STRUCTURE | scheme == RECORD - - public int fieldIndex(String name) throws DapException; // Convert a name to an index - - public DataCursor readField(int fieldindex) throws DapException; -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/AnnotatedNode.java b/dap4/d4core/src/main/java/dap4/core/dmr/AnnotatedNode.java deleted file mode 100644 index d1fc804b04..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/AnnotatedNode.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr; - -public interface AnnotatedNode { - public void annotate(Object key, Object value); - - public Object annotation(Object key); - - public void clearAnnotations(); -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapXML.java b/dap4/d4core/src/main/java/dap4/core/dmr/DapXML.java deleted file mode 100644 index 74256c63b5..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapXML.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr; - -import dap4.core.util.DapException; -import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class is not intended to be a full org.w3c.DOM - * implementation. Rather it stores more-or-less - * equivalent information in a more AST like form. - */ - -public class DapXML { - ////////////////////////////////////////////////// - // Types - - public static class XMLList extends ArrayList { - } - - // This corresponds to a subset of the org.w3c.dom.Node - // nodetype codes. - - public static enum NodeType { - ELEMENT(Node.ELEMENT_NODE), ATTRIBUTE(Node.ATTRIBUTE_NODE), TEXT(Node.TEXT_NODE), CDATA( - Node.CDATA_SECTION_NODE), COMMENT( - Node.COMMENT_NODE), DOCUMENT(Node.DOCUMENT_NODE), DOCTYPE(Node.DOCUMENT_TYPE_NODE); - - private short w3c_nodetype; - - private NodeType(short nodetype) { - this.w3c_nodetype = nodetype; - } - - public short getW3CNodeType() { - return w3c_nodetype; - } - } - - ////////////////////////////////////////////////// - // Instance Variables - - protected String name = null; - protected DapXML parent = null; - - // Applies to all (or almost all) node types - protected NodeType nodetype = null; - protected String prefix = null; // namespace prefix or null - - // case NodeType.ELEMENT - protected List elements = new ArrayList(); - protected Map xmlattributes = new HashMap(); - - // case NodeType.ATTRIBUTE - protected String value = null; // for attribute nodes - - // case NodeType.TEXT - // case NodeType.CDATA - // case NodeType.COMMENT - protected String text = null; // for text or cdata nodes - - // case NodeType.DOCUMENT - // case NodeType.DOCTYPE - // unused - - ////////////////////////////////////////////////// - // Constructor(s) - - public DapXML() { - super(); - } - - public DapXML(NodeType nodetype, String fullname) { - setNodeType(nodetype); - // Decompose name into prefix plus short name - int i = fullname.indexOf(':'); - if (i >= 0) { - this.prefix = fullname.substring(i); - fullname = fullname.substring(i + 1, fullname.length()); - if (this.prefix.length() == 0) - this.prefix = null; - } - setName(fullname); - } - - ////////////////////////////////////////////////// - // Get/Set - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public NodeType getNodeType() { - return nodetype; - } - - public void setNodeType(NodeType nodetype) { - this.nodetype = nodetype; - this.prefix = null; - String fullname = null; - switch (nodetype) { - case COMMENT: - fullname = "#comment"; - break; - case TEXT: - fullname = "#text"; - break; - case DOCUMENT: - fullname = "#document"; - break; - case CDATA: - fullname = "#cdata-section"; - break; - default: - break; - } - setName(fullname); - } - - public String getLocalName() { - return getName(); - } - - public void setLocalName(String localname) { - setName(localname); - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public DapXML getParent() { - return this.parent; - } - - public void setParent(DapXML parent) { - this.parent = parent; - } - - public List getElements() { - return this.elements; - } - - public void addElement(DapXML child) { - if (elements == null) - this.elements = new ArrayList(); - elements.add(child); - child.setParent(this); - } - - public Map getXMLAttributes() { - return xmlattributes; - } - - public void addXMLAttribute(DapXML attr) throws DapException { - if (xmlattributes == null) - this.xmlattributes = new HashMap(); - if (xmlattributes.containsKey(attr.getName())) - throw new DapException("DapXML: attempt to add duplicate xml attribute: " + attr.getName()); - xmlattributes.put(attr.getName(), attr); - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String toString() { - StringBuilder buf = new StringBuilder(); - stringify(0, buf); - return buf.toString(); - } - - protected void stringify(int depth, StringBuilder buf) { - switch (this.nodetype) { - case ELEMENT: - indent(depth, buf); - buf.append(this.name); - for (Map.Entry entry : xmlattributes.entrySet()) { - buf.append(' '); - entry.getValue().stringify(depth + 1, buf); - } - buf.append(">\n"); - for (DapXML sub : elements) { - sub.stringify(depth + 1, buf); - } - buf.append("\n"); - break; - case ATTRIBUTE: - buf.append(this.name); - buf.append('='); - buf.append('"'); - buf.append(this.value); - buf.append('"'); - break; - case TEXT: - indent(depth, buf); - buf.append(this.text); - buf.append("\n"); - break; - case CDATA: - indent(depth, buf); - buf.append("\n"); - break; - case COMMENT: - indent(depth, buf); - buf.append("\n"); - break; - case DOCUMENT: - case DOCTYPE: - break; - } - } - - protected void indent(int n, StringBuilder buf) { - for (int i = 0; i < n; i++) { - buf.append(' '); - } - } - -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Bison.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Bison.java deleted file mode 100644 index 245bfffc17..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Bison.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -/** - * Define Bison specific decls. - */ - -package dap4.core.dmr.parser.bison; - -import org.xml.sax.Locator; - -public abstract class Bison { - public static class Position { - public Locator location; - - public Position(Locator loc) { - this.location = loc; - } - - public String toString() { - return location.getLineNumber() + ":" + location.getColumnNumber(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Position)) - return false; - Position po = (Position) o; - return po.location.getLineNumber() == po.location.getLineNumber() - && po.location.getColumnNumber() == po.location.getColumnNumber(); - } - - @Override - public int hashCode() { - return location.getLineNumber() << 20 | location.getColumnNumber(); - } - } - - /** - * A class defining a pair of positions. Positions, defined by the - * Bison.Position class, denote a point in the input. - * Locations represent a part of the input through the beginning - * and ending positions. - */ - public static class Location { - /** - * The first, inclusive, position in the range. - */ - public Bison.Position begin; - - /** - * The first position beyond the range. - */ - public Bison.Position end; - - /** - * Create a Location denoting an empty range located at - * a given point. - * - * @param loc The position at which the range is anchored. - */ - public Location(Bison.Position loc) { - this.begin = this.end = loc; - } - - /** - * Create a Location from the endpoints of the range. - * - * @param begin The first position included in the range. - * @param end The first position beyond the range. - */ - public Location(Bison.Position begin, Bison.Position end) { - this.begin = begin; - this.end = end; - } - - /** - * Print a representation of the location. For this to be correct, - * Bison.Position should override the equals - * method. - */ - public String toString() { - if (begin.equals(end)) - return begin.toString(); - else - return begin.toString() + "-" + end.toString(); - } - } - -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Actions.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Actions.java deleted file mode 100644 index 6843d415a9..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Actions.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import dap4.core.dmr.DapXML; -import dap4.core.dmr.parser.ParseException; -import dap4.core.util.DapException; -import dap4.core.util.DapSort; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -/** - * The role of this class is as follows: - * 1. Define the abstract action procedures - * 2. Define useful common constants - * 3. Define useful common utility procedures - */ - -public abstract class Dap4Actions extends Dap4EventHandler { - - ////////////////////////////////////////////////// - // Constants - - static final float DAPVERSION = 4.0f; - static final float DMRVERSION = 1.0f; - - static final int RULENULL = 0; - static final int RULEDIMREF = 1; - static final int RULEMAPREF = 2; - static final int RULEVAR = 3; - static final int RULEMETADATA = 4; - - static final String[] RESERVEDTAGS = new String[] {"_edu.ucar"}; - - static final BigInteger BIG_INT64_MAX = BigInteger.valueOf(Long.MAX_VALUE); - - static final DapSort[] METADATASCOPES = new DapSort[] {DapSort.DATASET, DapSort.GROUP, DapSort.DIMENSION, DapSort.MAP, - DapSort.VARIABLE, DapSort.STRUCTURE, DapSort.SEQUENCE, DapSort.ATTRIBUTESET}; - - ////////////////////////////////////////////////// - // Type Decls - - // Predefined map types - static class XMLAttributeMap extends HashMap { - } - - static class NamespaceList extends ArrayList { - } - - - ////////////////////////////////////////////////// - // Instance variables - - ////////////////////////////////////////////////// - // Constructor(s) - - public Dap4Actions() {} - - /////////////////////////////////////////////////// - // Non-abstract parser actions - - XMLAttributeMap xml_attribute_map() throws DapException { - return new XMLAttributeMap(); - } - - XMLAttributeMap xml_attribute_map(XMLAttributeMap map, SaxEvent token) throws DapException { - assert (map != null && token != null); - if (map.containsKey(token.name)) - throw new DapException("XML attribute: duplicate xml attribute: " + token.name); - map.put(token.name.toLowerCase(), token); - return map; - } - - NamespaceList namespace_list() throws DapException { - return new NamespaceList(); - } - - NamespaceList namespace_list(NamespaceList list, SaxEvent token) throws DapException { - assert (list != null); - if (token != null && !list.contains(token.name)) - list.add(token.name); - return list; - } - - DapXML createxmltext(String text) throws DapException { - DapXML node = new DapXML(DapXML.NodeType.TEXT, null); - node.setText(text); - return node; - } - - DapXML createxmlelement(SaxEvent open, XMLAttributeMap map) throws DapException { - DapXML node = new DapXML(DapXML.NodeType.ELEMENT, open.name); - for (Map.Entry entry : map.entrySet()) { - SaxEvent att = entry.getValue(); - DapXML a = new DapXML(DapXML.NodeType.ATTRIBUTE, att.name); - a.addXMLAttribute(a); - } - return node; - } - - ////////////////////////////////////////////////// - // Abstract (subclass defined) parser actions - - abstract void enterdataset(XMLAttributeMap attrs) throws ParseException; - - abstract void leavedataset() throws ParseException; - - abstract void entergroup(XMLAttributeMap attrs) throws ParseException; - - abstract void leavegroup() throws ParseException; - - abstract void enterenumdef(XMLAttributeMap attrs) throws ParseException; - - abstract void leaveenumdef() throws ParseException; - - abstract void enumconst(SaxEvent name, SaxEvent value) throws ParseException; - - abstract void enterdimdef(XMLAttributeMap attrs) throws ParseException; - - abstract void leavedimdef() throws ParseException; - - abstract void dimref(SaxEvent nameorsize) throws ParseException; - - abstract void enteratomicvariable(SaxEvent open, XMLAttributeMap attrs) throws ParseException; - - abstract void leaveatomicvariable(SaxEvent close) throws ParseException; - - abstract void enterenumvariable(XMLAttributeMap attrs) throws ParseException; - - abstract void leaveenumvariable(SaxEvent close) throws ParseException; - - abstract void entermap(SaxEvent name) throws ParseException; - - abstract void leavemap() throws ParseException; - - abstract void enterstructurevariable(XMLAttributeMap attrs) throws ParseException; - - abstract void leavestructurevariable(SaxEvent close) throws ParseException; - - abstract void entersequencevariable(XMLAttributeMap attrs) throws ParseException; - - abstract void leavesequencevariable(SaxEvent close) throws ParseException; - - abstract void enteratomicattribute(XMLAttributeMap attrs, NamespaceList nslist) throws ParseException; - - abstract void leaveatomicattribute() throws ParseException; - - abstract void entercontainerattribute(XMLAttributeMap attrs, NamespaceList nslist) throws ParseException; - - abstract void leavecontainerattribute() throws ParseException; - - abstract void value(SaxEvent value) throws ParseException; - - abstract void value(String value) throws ParseException; - - abstract void entererror(XMLAttributeMap attrs) throws ParseException; - - abstract void leaveerror() throws ParseException; - - abstract void errormessage(String value) throws ParseException; - - abstract void errorcontext(String value) throws ParseException; - - abstract void errorotherinfo(String value) throws ParseException; - - abstract void otherxml(XMLAttributeMap attrs, DapXML root) throws ParseException; - - abstract DapXML.XMLList xml_body(DapXML.XMLList body, DapXML elemortext) throws ParseException; - - abstract DapXML element_or_text(SaxEvent open, XMLAttributeMap xmlattrlist, DapXML.XMLList body, SaxEvent close) - throws ParseException; - - abstract DapXML xmltext(SaxEvent text) throws ParseException; - - abstract String textstring(String prefix, SaxEvent text) throws ParseException; - -}// class Dap4Actions diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4BisonParser.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4BisonParser.java deleted file mode 100644 index c35758d2dd..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4BisonParser.java +++ /dev/null @@ -1,1954 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* - * Skeleton implementation for Bison LALR(1) parsers in Java - * - * Copyright (C) 2007-2015 Free Software Foundation, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* - * As a special exception, you may create a larger work that contains - * part or all of the Bison parser skeleton and distribute that work - * under terms of your choice, so long as that work isn't itself a - * parser generator using the skeleton or a modified version thereof - * as a parser skeleton. Alternatively, if you modify or redistribute - * the parser skeleton itself, you may (at your option) remove this - * special exception, which will cause the skeleton and the resulting - * Bison output files to be licensed under the GNU General Public - * License without this special exception. - * - * This special exception was added by the Free Software Foundation in - * version 2.2 of Bison. - */ - -package dap4.core.dmr.parser.bison; -/* First part of user declarations. */ - -/* "Dap4BisonParser.java":37 */ /* lalr1.java:91 */ - -/* "Dap4BisonParser.java":39 */ /* lalr1.java:92 */ -/* "%code imports" blocks. */ -/* "dap4.y":17 */ /* lalr1.java:93 */ - -import dap4.core.util.DapException; -import dap4.core.dmr.DapXML; - -/* "Dap4BisonParser.java":46 */ /* lalr1.java:93 */ - -/** - * A Bison parser, automatically generated from dap4.y. - * - * @author LALR (1) parser skeleton written by Paolo Bonzini. - */ -abstract class Dap4BisonParser extends Dap4Actions { - /** Version number for the Bison executable that generated this parser. */ - public static final String bisonVersion = "3.0.4"; - - /** Name of the skeleton that generated this parser. */ - public static final String bisonSkeleton = "lalr1.java"; - - - /** - * True if verbose error messages are enabled. - */ - private boolean yyErrorVerbose = true; - - /** - * Return whether verbose error messages are enabled. - */ - public final boolean getErrorVerbose() { - return yyErrorVerbose; - } - - /** - * Set the verbosity of error messages. - * - * @param verbose True to request verbose error messages. - */ - public final void setErrorVerbose(boolean verbose) { - yyErrorVerbose = verbose; - } - - - - /** - * Communication interface between the scanner and the Bison-generated - * parser Dap4BisonParser. - */ - public interface Lexer { - /** Token returned by the scanner to signal the end of its input. */ - public static final int EOF = 0; - - /* Tokens. */ - /** Token number,to be returned by the scanner. */ - static final int DATASET_ = 258; - /** Token number,to be returned by the scanner. */ - static final int _DATASET = 259; - /** Token number,to be returned by the scanner. */ - static final int GROUP_ = 260; - /** Token number,to be returned by the scanner. */ - static final int _GROUP = 261; - /** Token number,to be returned by the scanner. */ - static final int ENUMERATION_ = 262; - /** Token number,to be returned by the scanner. */ - static final int _ENUMERATION = 263; - /** Token number,to be returned by the scanner. */ - static final int ENUMCONST_ = 264; - /** Token number,to be returned by the scanner. */ - static final int _ENUMCONST = 265; - /** Token number,to be returned by the scanner. */ - static final int NAMESPACE_ = 266; - /** Token number,to be returned by the scanner. */ - static final int _NAMESPACE = 267; - /** Token number,to be returned by the scanner. */ - static final int DIMENSION_ = 268; - /** Token number,to be returned by the scanner. */ - static final int _DIMENSION = 269; - /** Token number,to be returned by the scanner. */ - static final int DIM_ = 270; - /** Token number,to be returned by the scanner. */ - static final int _DIM = 271; - /** Token number,to be returned by the scanner. */ - static final int ENUM_ = 272; - /** Token number,to be returned by the scanner. */ - static final int _ENUM = 273; - /** Token number,to be returned by the scanner. */ - static final int MAP_ = 274; - /** Token number,to be returned by the scanner. */ - static final int _MAP = 275; - /** Token number,to be returned by the scanner. */ - static final int STRUCTURE_ = 276; - /** Token number,to be returned by the scanner. */ - static final int _STRUCTURE = 277; - /** Token number,to be returned by the scanner. */ - static final int SEQUENCE_ = 278; - /** Token number,to be returned by the scanner. */ - static final int _SEQUENCE = 279; - /** Token number,to be returned by the scanner. */ - static final int VALUE_ = 280; - /** Token number,to be returned by the scanner. */ - static final int _VALUE = 281; - /** Token number,to be returned by the scanner. */ - static final int ATTRIBUTE_ = 282; - /** Token number,to be returned by the scanner. */ - static final int _ATTRIBUTE = 283; - /** Token number,to be returned by the scanner. */ - static final int OTHERXML_ = 284; - /** Token number,to be returned by the scanner. */ - static final int _OTHERXML = 285; - /** Token number,to be returned by the scanner. */ - static final int ERROR_ = 286; - /** Token number,to be returned by the scanner. */ - static final int _ERROR = 287; - /** Token number,to be returned by the scanner. */ - static final int MESSAGE_ = 288; - /** Token number,to be returned by the scanner. */ - static final int _MESSAGE = 289; - /** Token number,to be returned by the scanner. */ - static final int CONTEXT_ = 290; - /** Token number,to be returned by the scanner. */ - static final int _CONTEXT = 291; - /** Token number,to be returned by the scanner. */ - static final int OTHERINFO_ = 292; - /** Token number,to be returned by the scanner. */ - static final int _OTHERINFO = 293; - /** Token number,to be returned by the scanner. */ - static final int CHAR_ = 294; - /** Token number,to be returned by the scanner. */ - static final int _CHAR = 295; - /** Token number,to be returned by the scanner. */ - static final int BYTE_ = 296; - /** Token number,to be returned by the scanner. */ - static final int _BYTE = 297; - /** Token number,to be returned by the scanner. */ - static final int INT8_ = 298; - /** Token number,to be returned by the scanner. */ - static final int _INT8 = 299; - /** Token number,to be returned by the scanner. */ - static final int UINT8_ = 300; - /** Token number,to be returned by the scanner. */ - static final int _UINT8 = 301; - /** Token number,to be returned by the scanner. */ - static final int INT16_ = 302; - /** Token number,to be returned by the scanner. */ - static final int _INT16 = 303; - /** Token number,to be returned by the scanner. */ - static final int UINT16_ = 304; - /** Token number,to be returned by the scanner. */ - static final int _UINT16 = 305; - /** Token number,to be returned by the scanner. */ - static final int INT32_ = 306; - /** Token number,to be returned by the scanner. */ - static final int _INT32 = 307; - /** Token number,to be returned by the scanner. */ - static final int UINT32_ = 308; - /** Token number,to be returned by the scanner. */ - static final int _UINT32 = 309; - /** Token number,to be returned by the scanner. */ - static final int INT64_ = 310; - /** Token number,to be returned by the scanner. */ - static final int _INT64 = 311; - /** Token number,to be returned by the scanner. */ - static final int UINT64_ = 312; - /** Token number,to be returned by the scanner. */ - static final int _UINT64 = 313; - /** Token number,to be returned by the scanner. */ - static final int FLOAT32_ = 314; - /** Token number,to be returned by the scanner. */ - static final int _FLOAT32 = 315; - /** Token number,to be returned by the scanner. */ - static final int FLOAT64_ = 316; - /** Token number,to be returned by the scanner. */ - static final int _FLOAT64 = 317; - /** Token number,to be returned by the scanner. */ - static final int STRING_ = 318; - /** Token number,to be returned by the scanner. */ - static final int _STRING = 319; - /** Token number,to be returned by the scanner. */ - static final int URL_ = 320; - /** Token number,to be returned by the scanner. */ - static final int _URL = 321; - /** Token number,to be returned by the scanner. */ - static final int OPAQUE_ = 322; - /** Token number,to be returned by the scanner. */ - static final int _OPAQUE = 323; - /** Token number,to be returned by the scanner. */ - static final int ATTR_BASE = 324; - /** Token number,to be returned by the scanner. */ - static final int ATTR_BASETYPE = 325; - /** Token number,to be returned by the scanner. */ - static final int ATTR_DAPVERSION = 326; - /** Token number,to be returned by the scanner. */ - static final int ATTR_DMRVERSION = 327; - /** Token number,to be returned by the scanner. */ - static final int ATTR_ENUM = 328; - /** Token number,to be returned by the scanner. */ - static final int ATTR_HREF = 329; - /** Token number,to be returned by the scanner. */ - static final int ATTR_NAME = 330; - /** Token number,to be returned by the scanner. */ - static final int ATTR_NAMESPACE = 331; - /** Token number,to be returned by the scanner. */ - static final int ATTR_NS = 332; - /** Token number,to be returned by the scanner. */ - static final int ATTR_SIZE = 333; - /** Token number,to be returned by the scanner. */ - static final int ATTR_TYPE = 334; - /** Token number,to be returned by the scanner. */ - static final int ATTR_VALUE = 335; - /** Token number,to be returned by the scanner. */ - static final int ATTR_HTTPCODE = 336; - /** Token number,to be returned by the scanner. */ - static final int ATTR_SPECIAL = 337; - /** Token number,to be returned by the scanner. */ - static final int TEXT = 338; - /** Token number,to be returned by the scanner. */ - static final int UNKNOWN_ATTR = 339; - /** Token number,to be returned by the scanner. */ - static final int UNKNOWN_ELEMENT_ = 340; - /** Token number,to be returned by the scanner. */ - static final int _UNKNOWN_ELEMENT = 341; - - - - /** - * Method to retrieve the semantic value of the last scanned token. - * - * @return the semantic value of the last scanned token. - */ - Object getLVal(); - - /** - * Entry point for the scanner. Returns the token identifier corresponding - * to the next token and prepares to return the semantic value - * of the token. - * - * @return the token identifier corresponding to the next token. - */ - int yylex() throws DapException; - - /** - * Entry point for error reporting. Emits an error - * in a user-defined way. - * - * - * @param msg The string for the error message. - */ - void yyerror(String msg); - } - - private class YYLexer implements Lexer { - /* "%code lexer" blocks. */ - /* "dap4.y":22 */ /* lalr1.java:236 */ - - public Object getLVal() { - return null; - } - - public int yylex() { - return 0; - } - - public Bison.Position getStartPos() { - return null; - } - - public Bison.Position getEndPos() { - return null; - } - - public void yyerror(String s) { - System.err.println(s); - System.err.printf("near %s%n", getLocator()); - } - - - /* "Dap4BisonParser.java":304 */ /* lalr1.java:236 */ - - } - - /** - * The object doing lexical analysis for us. - */ - private Lexer yylexer; - - - - /** - * Instantiates the Bison-generated parser. - */ - public Dap4BisonParser() { - - this.yylexer = new YYLexer(); - - } - - - /** - * Instantiates the Bison-generated parser. - * - * @param yylexer The scanner that will supply tokens to the parser. - */ - protected Dap4BisonParser(Lexer yylexer) { - - this.yylexer = yylexer; - - } - - private java.io.PrintStream yyDebugStream = System.err; - - /** - * Return the PrintStream on which the debugging output is - * printed. - */ - public final java.io.PrintStream getDebugStream() { - return yyDebugStream; - } - - /** - * Set the PrintStream on which the debug output is printed. - * - * @param s The stream that is used for debugging output. - */ - public final void setDebugStream(java.io.PrintStream s) { - yyDebugStream = s; - } - - private int yydebug = 0; - - /** - * Answer the verbosity of the debugging output; 0 means that all kinds of - * output from the parser are suppressed. - */ - public final int getDebugLevel() { - return yydebug; - } - - /** - * Set the verbosity of the debugging output; 0 means that all kinds of - * output from the parser are suppressed. - * - * @param level The verbosity level for debugging output. - */ - public final void setDebugLevel(int level) { - yydebug = level; - } - - /** - * Print an error message via the lexer. - * - * @param msg The error message. - */ - public final void yyerror(String msg) { - yylexer.yyerror(msg); - } - - - protected final void yycdebug(String s) { - if (yydebug > 0) - yyDebugStream.println(s); - } - - private final class YYStack { - private int[] stateStack = new int[16]; - - private Object[] valueStack = new Object[16]; - - public int size = 16; - public int height = -1; - - public final void push(int state, Object value) { - height++; - if (size == height) { - int[] newStateStack = new int[size * 2]; - System.arraycopy(stateStack, 0, newStateStack, 0, height); - stateStack = newStateStack; - - - Object[] newValueStack = new Object[size * 2]; - System.arraycopy(valueStack, 0, newValueStack, 0, height); - valueStack = newValueStack; - - size *= 2; - } - - stateStack[height] = state; - - valueStack[height] = value; - } - - public final void pop() { - pop(1); - } - - public final void pop(int num) { - // Avoid memory leaks... garbage collection is a white lie! - if (num > 0) { - java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null); - - } - height -= num; - } - - public final int stateAt(int i) { - return stateStack[height - i]; - } - - public final Object valueAt(int i) { - return valueStack[height - i]; - } - - // Print the state stack on the debug stream. - public void print(java.io.PrintStream out) { - out.print("Stack now"); - - for (int i = 0; i <= height; i++) { - out.print(' '); - out.print(stateStack[i]); - } - out.println(); - } - } - - /** - * Returned by a Bison action in order to stop the parsing process and - * return success (true). - */ - public static final int YYACCEPT = 0; - - /** - * Returned by a Bison action in order to stop the parsing process and - * return failure (false). - */ - public static final int YYABORT = 1; - - - /** - * Returned by a Bison action in order to request a new token. - */ - public static final int YYPUSH_MORE = 4; - - /** - * Returned by a Bison action in order to start error recovery without - * printing an error message. - */ - public static final int YYERROR = 2; - - /** - * Internal return codes that are not supported for user semantic - * actions. - */ - private static final int YYERRLAB = 3; - private static final int YYNEWSTATE = 4; - private static final int YYDEFAULT = 5; - private static final int YYREDUCE = 6; - private static final int YYERRLAB1 = 7; - private static final int YYRETURN = 8; - private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing. */ - - private int yyerrstatus_ = 0; - - - /* Lookahead and lookahead in internal form. */ - int yychar = yyempty_; - int yytoken = 0; - - /* State. */ - int yyn = 0; - int yylen = 0; - int yystate = 0; - YYStack yystack = new YYStack(); - int label = YYNEWSTATE; - - /* Error handling. */ - int yynerrs_ = 0; - - - /* Semantic value of the lookahead. */ - Object yylval = null; - - /** - * Return whether error recovery is being done. In this state, the parser - * reads token until it reaches a known state, and then restarts normal - * operation. - */ - public final boolean recovering() { - return yyerrstatus_ == 0; - } - - /** - * Compute post-reduction state. - * - * @param yystate the current state - * @param yysym the nonterminal to push on the stack - */ - private int yy_lr_goto_state_(int yystate, int yysym) { - int yyr = yypgoto_[yysym - yyntokens_] + yystate; - if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) - return yytable_[yyr]; - else - return yydefgoto_[yysym - yyntokens_]; - } - - private int yyaction(int yyn, YYStack yystack, int yylen) throws DapException { - Object yyval; - - - /* - * If YYLEN is nonzero, implement the default value of the action: - * '$$ = $1'. Otherwise, use the top of the stack. - * - * Otherwise, the following line sets YYVAL to garbage. - * This behavior is undocumented and Bison - * users should not rely upon it. - */ - if (yylen > 0) - yyval = yystack.valueAt(yylen - 1); - else - yyval = yystack.valueAt(0); - - yy_reduce_print(yyn, yystack); - - switch (yyn) { - case 4: - if (yyn == 4) - /* "dap4.y":106 */ /* lalr1.java:489 */ - { - leavedataset(); - } ; - break; - - - case 5: - if (yyn == 5) - /* "dap4.y":112 */ /* lalr1.java:489 */ - { - enterdataset(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 6: - if (yyn == 6) - /* "dap4.y":119 */ /* lalr1.java:489 */ - { - leavegroup(); - } ; - break; - - - case 7: - if (yyn == 7) - /* "dap4.y":125 */ /* lalr1.java:489 */ - { - entergroup(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 14: - if (yyn == 14) - /* "dap4.y":147 */ /* lalr1.java:489 */ - { - leaveenumdef(); - } ; - break; - - - case 15: - if (yyn == 15) - /* "dap4.y":153 */ /* lalr1.java:489 */ - { - enterenumdef(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 18: - if (yyn == 18) - /* "dap4.y":163 */ /* lalr1.java:489 */ - { - enumconst(((SaxEvent) (yystack.valueAt(4 - (2)))), ((SaxEvent) (yystack.valueAt(4 - (3))))); - } ; - break; - - - case 19: - if (yyn == 19) - /* "dap4.y":165 */ /* lalr1.java:489 */ - { - enumconst(((SaxEvent) (yystack.valueAt(4 - (3)))), ((SaxEvent) (yystack.valueAt(4 - (2))))); - } ; - break; - - - case 20: - if (yyn == 20) - /* "dap4.y":172 */ /* lalr1.java:489 */ - { - leavedimdef(); - } ; - break; - - - case 21: - if (yyn == 21) - /* "dap4.y":178 */ /* lalr1.java:489 */ - { - enterdimdef(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 22: - if (yyn == 22) - /* "dap4.y":183 */ /* lalr1.java:489 */ - { - dimref(((SaxEvent) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 23: - if (yyn == 23) - /* "dap4.y":185 */ /* lalr1.java:489 */ - { - dimref(((SaxEvent) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 28: - if (yyn == 28) - /* "dap4.y":200 */ /* lalr1.java:489 */ - { - leaveatomicvariable(((SaxEvent) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 29: - if (yyn == 29) - /* "dap4.y":207 */ /* lalr1.java:489 */ - { - enteratomicvariable(((SaxEvent) (yystack.valueAt(2 - (1)))), ((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 30: - if (yyn == 30) - /* "dap4.y":214 */ /* lalr1.java:489 */ - { - leaveenumvariable(((SaxEvent) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 31: - if (yyn == 31) - /* "dap4.y":221 */ /* lalr1.java:489 */ - { - enterenumvariable(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 32: - if (yyn == 32) - /* "dap4.y":226 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 33: - if (yyn == 33) - /* "dap4.y":227 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 34: - if (yyn == 34) - /* "dap4.y":228 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 35: - if (yyn == 35) - /* "dap4.y":229 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 36: - if (yyn == 36) - /* "dap4.y":230 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 37: - if (yyn == 37) - /* "dap4.y":231 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 38: - if (yyn == 38) - /* "dap4.y":232 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 39: - if (yyn == 39) - /* "dap4.y":233 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 40: - if (yyn == 40) - /* "dap4.y":234 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 41: - if (yyn == 41) - /* "dap4.y":235 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 42: - if (yyn == 42) - /* "dap4.y":236 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 43: - if (yyn == 43) - /* "dap4.y":237 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 44: - if (yyn == 44) - /* "dap4.y":238 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 45: - if (yyn == 45) - /* "dap4.y":239 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 46: - if (yyn == 46) - /* "dap4.y":240 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 47: - if (yyn == 47) - /* "dap4.y":244 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 48: - if (yyn == 48) - /* "dap4.y":245 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 49: - if (yyn == 49) - /* "dap4.y":246 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 50: - if (yyn == 50) - /* "dap4.y":247 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 51: - if (yyn == 51) - /* "dap4.y":248 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 52: - if (yyn == 52) - /* "dap4.y":249 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 53: - if (yyn == 53) - /* "dap4.y":250 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 54: - if (yyn == 54) - /* "dap4.y":251 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 55: - if (yyn == 55) - /* "dap4.y":252 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 56: - if (yyn == 56) - /* "dap4.y":253 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 57: - if (yyn == 57) - /* "dap4.y":254 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 58: - if (yyn == 58) - /* "dap4.y":255 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 59: - if (yyn == 59) - /* "dap4.y":256 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 60: - if (yyn == 60) - /* "dap4.y":257 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 61: - if (yyn == 61) - /* "dap4.y":258 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 62: - if (yyn == 62) - /* "dap4.y":259 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 67: - if (yyn == 67) - /* "dap4.y":273 */ /* lalr1.java:489 */ - { - leavemap(); - } ; - break; - - - case 68: - if (yyn == 68) - /* "dap4.y":279 */ /* lalr1.java:489 */ - { - entermap(((SaxEvent) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 69: - if (yyn == 69) - /* "dap4.y":286 */ /* lalr1.java:489 */ - { - leavestructurevariable(((SaxEvent) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 70: - if (yyn == 70) - /* "dap4.y":292 */ /* lalr1.java:489 */ - { - enterstructurevariable(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 76: - if (yyn == 76) - /* "dap4.y":307 */ /* lalr1.java:489 */ - { - leavesequencevariable(((SaxEvent) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 77: - if (yyn == 77) - /* "dap4.y":313 */ /* lalr1.java:489 */ - { - entersequencevariable(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 89: - if (yyn == 89) - /* "dap4.y":345 */ /* lalr1.java:489 */ - { - leaveatomicattribute(); - } ; - break; - - - case 90: - if (yyn == 90) - /* "dap4.y":349 */ /* lalr1.java:489 */ - { - leaveatomicattribute(); - } ; - break; - - - case 91: - if (yyn == 91) - /* "dap4.y":356 */ /* lalr1.java:489 */ - { - enteratomicattribute(((XMLAttributeMap) (yystack.valueAt(3 - (2)))), - ((NamespaceList) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 92: - if (yyn == 92) - /* "dap4.y":361 */ /* lalr1.java:489 */ - { - yyval = namespace_list(); - } ; - break; - - - case 93: - if (yyn == 93) - /* "dap4.y":363 */ /* lalr1.java:489 */ - { - yyval = namespace_list(((NamespaceList) (yystack.valueAt(2 - (1)))), ((SaxEvent) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 94: - if (yyn == 94) - /* "dap4.y":370 */ /* lalr1.java:489 */ - { - yyval = (((SaxEvent) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 95: - if (yyn == 95) - /* "dap4.y":377 */ /* lalr1.java:489 */ - { - leavecontainerattribute(); - } ; - break; - - - case 96: - if (yyn == 96) - /* "dap4.y":384 */ /* lalr1.java:489 */ - { - entercontainerattribute(((XMLAttributeMap) (yystack.valueAt(3 - (2)))), - ((NamespaceList) (yystack.valueAt(3 - (3))))); - } ; - break; - - - case 101: - if (yyn == 101) - /* "dap4.y":401 */ /* lalr1.java:489 */ - { - value(((String) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 102: - if (yyn == 102) - /* "dap4.y":403 */ /* lalr1.java:489 */ - { - value(((SaxEvent) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 103: - if (yyn == 103) - /* "dap4.y":411 */ /* lalr1.java:489 */ - { - otherxml(((XMLAttributeMap) (yystack.valueAt(4 - (2)))), ((DapXML) (yystack.valueAt(4 - (3))))); - } ; - break; - - - case 104: - if (yyn == 104) - /* "dap4.y":415 */ /* lalr1.java:489 */ - { - yyval = xml_body(null, ((DapXML) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 105: - if (yyn == 105) - /* "dap4.y":416 */ /* lalr1.java:489 */ - { - yyval = xml_body(((DapXML.XMLList) (yystack.valueAt(2 - (1)))), ((DapXML) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 106: - if (yyn == 106) - /* "dap4.y":424 */ /* lalr1.java:489 */ - { - yyval = - element_or_text(((SaxEvent) (yystack.valueAt(4 - (1)))), ((XMLAttributeMap) (yystack.valueAt(4 - (2)))), - ((DapXML.XMLList) (yystack.valueAt(4 - (3)))), ((SaxEvent) (yystack.valueAt(4 - (4))))); - } ; - break; - - - case 107: - if (yyn == 107) - /* "dap4.y":426 */ /* lalr1.java:489 */ - { - yyval = xmltext(((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 108: - if (yyn == 108) - /* "dap4.y":434 */ /* lalr1.java:489 */ - { - yyval = xml_attribute_map(); - } ; - break; - - - case 109: - if (yyn == 109) - /* "dap4.y":436 */ /* lalr1.java:489 */ - { - yyval = xml_attribute_map(((XMLAttributeMap) (yystack.valueAt(2 - (1)))), - ((SaxEvent) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 184: - if (yyn == 184) - /* "dap4.y":530 */ /* lalr1.java:489 */ - { - leaveerror(); - } ; - break; - - - case 185: - if (yyn == 185) - /* "dap4.y":537 */ /* lalr1.java:489 */ - { - entererror(((XMLAttributeMap) (yystack.valueAt(2 - (2))))); - } ; - break; - - - case 188: - if (yyn == 188) - /* "dap4.y":547 */ /* lalr1.java:489 */ - { - errormessage(((String) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 189: - if (yyn == 189) - /* "dap4.y":549 */ /* lalr1.java:489 */ - { - errorcontext(((String) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 190: - if (yyn == 190) - /* "dap4.y":551 */ /* lalr1.java:489 */ - { - errorotherinfo(((String) (yystack.valueAt(3 - (2))))); - } ; - break; - - - case 191: - if (yyn == 191) - /* "dap4.y":556 */ /* lalr1.java:489 */ - { - yyval = textstring(null, ((SaxEvent) (yystack.valueAt(1 - (1))))); - } ; - break; - - - case 192: - if (yyn == 192) - /* "dap4.y":558 */ /* lalr1.java:489 */ - { - yyval = textstring(((String) (yystack.valueAt(2 - (1)))), ((SaxEvent) (yystack.valueAt(2 - (2))))); - } ; - break; - - - - /* "Dap4BisonParser.java":1087 */ /* lalr1.java:489 */ - default: - break; - } - - yy_symbol_print("-> $$ =", yyr1_[yyn], yyval); - - yystack.pop(yylen); - yylen = 0; - - /* Shift the result of the reduction. */ - int yystate = yy_lr_goto_state_(yystack.stateAt(0), yyr1_[yyn]); - yystack.push(yystate, yyval); - return YYNEWSTATE; - } - - - /* - * Return YYSTR after stripping away unnecessary quotes and - * backslashes, so that it's suitable for yyerror. The heuristic is - * that double-quoting is unnecessary unless the string contains an - * apostrophe, a comma, or backslash (other than backslash-backslash). - * YYSTR is taken from yytname. - */ - private final String yytnamerr_(String yystr) { - if (yystr.charAt(0) == '"') { - StringBuffer yyr = new StringBuffer(); - strip_quotes: for (int i = 1; i < yystr.length(); i++) - switch (yystr.charAt(i)) { - case '\'': - case ',': - break strip_quotes; - - case '\\': - if (yystr.charAt(++i) != '\\') - break strip_quotes; - /* Fall through. */ - default: - yyr.append(yystr.charAt(i)); - break; - - case '"': - return yyr.toString(); - } - } else if (yystr.equals("$end")) - return "end of input"; - - return yystr; - } - - - /*--------------------------------. - | Print this symbol on YYOUTPUT. | - `--------------------------------*/ - - private void yy_symbol_print(String s, int yytype, Object yyvaluep) { - if (yydebug > 0) - yycdebug(s + (yytype < yyntokens_ ? " token " : " nterm ") + yytname_[yytype] + " (" - + (yyvaluep == null ? "(null)" : yyvaluep.toString()) + ")"); - } - - - - /** - * Push Parse input from external lexer - * - * @param yylextoken current token - * @param yylexval current lval - * - * - * @return YYACCEPT, YYABORT, YYPUSH_MORE - */ - public int push_parse(int yylextoken, Object yylexval) throws DapException, DapException { - - - - if (!this.push_parse_initialized) { - push_parse_initialize(); - - yycdebug("Starting parse\n"); - yyerrstatus_ = 0; - } else - label = YYGETTOKEN; - - boolean push_token_consumed = true; - - for (;;) - switch (label) { - /* - * New state. Unlike in the C/C++ skeletons, the state is already - * pushed when we come here. - */ - case YYNEWSTATE: - yycdebug("Entering state " + yystate + "\n"); - if (yydebug > 0) - yystack.print(yyDebugStream); - - /* Accept? */ - if (yystate == yyfinal_) { - label = YYACCEPT; - break; - } - - /* Take a decision. First try without lookahead. */ - yyn = yypact_[yystate]; - if (yy_pact_value_is_default_(yyn)) { - label = YYDEFAULT; - break; - } - /* Fall Through */ - - case YYGETTOKEN: - /* Read a lookahead token. */ - if (yychar == yyempty_) { - - if (!push_token_consumed) - return YYPUSH_MORE; - yycdebug("Reading a token: "); - yychar = yylextoken; - yylval = yylexval; - push_token_consumed = false; - - } - - /* Convert token to internal form. */ - if (yychar <= Lexer.EOF) { - yychar = yytoken = Lexer.EOF; - yycdebug("Now at end of input.\n"); - } else { - yytoken = yytranslate_(yychar); - yy_symbol_print("Next token is", yytoken, yylval); - } - - /* - * If the proper action on seeing token YYTOKEN is to reduce or to - * detect an error, take that action. - */ - yyn += yytoken; - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) - label = YYDEFAULT; - - /* <= 0 means reduce or error. */ - else if ((yyn = yytable_[yyn]) <= 0) { - if (yy_table_value_is_error_(yyn)) - label = YYERRLAB; - else { - yyn = -yyn; - label = YYREDUCE; - } - } - - else { - /* Shift the lookahead token. */ - yy_symbol_print("Shifting", yytoken, yylval); - - /* Discard the token being shifted. */ - yychar = yyempty_; - - /* - * Count tokens shifted since error; after three, turn off error - * status. - */ - if (yyerrstatus_ > 0) - --yyerrstatus_; - - yystate = yyn; - yystack.push(yystate, yylval); - label = YYNEWSTATE; - } - break; - - /*-----------------------------------------------------------. - | yydefault -- do the default action for the current state. | - `-----------------------------------------------------------*/ - case YYDEFAULT: - yyn = yydefact_[yystate]; - if (yyn == 0) - label = YYERRLAB; - else - label = YYREDUCE; - break; - - /*-----------------------------. - | yyreduce -- Do a reduction. | - `-----------------------------*/ - case YYREDUCE: - yylen = yyr2_[yyn]; - label = yyaction(yyn, yystack, yylen); - yystate = yystack.stateAt(0); - break; - - /*------------------------------------. - | yyerrlab -- here on detecting error | - `------------------------------------*/ - case YYERRLAB: - /* If not already recovering from an error, report this error. */ - if (yyerrstatus_ == 0) { - ++yynerrs_; - if (yychar == yyempty_) - yytoken = yyempty_; - yyerror(yysyntax_error(yystate, yytoken)); - } - - - if (yyerrstatus_ == 3) { - /* - * If just tried and failed to reuse lookahead token after an - * error, discard it. - */ - - if (yychar <= Lexer.EOF) { - /* Return failure if at end of input. */ - if (yychar == Lexer.EOF) { - label = YYABORT; - break; - } - } else - yychar = yyempty_; - } - - /* - * Else will try to reuse lookahead token after shifting the error - * token. - */ - label = YYERRLAB1; - break; - - /*-------------------------------------------------. - | errorlab -- error raised explicitly by YYERROR. | - `-------------------------------------------------*/ - case YYERROR: - - - /* - * Do not reclaim the symbols of the rule which action triggered - * this YYERROR. - */ - yystack.pop(yylen); - yylen = 0; - yystate = yystack.stateAt(0); - label = YYERRLAB1; - break; - - /*-------------------------------------------------------------. - | yyerrlab1 -- common code for both syntax error and YYERROR. | - `-------------------------------------------------------------*/ - case YYERRLAB1: - yyerrstatus_ = 3; /* Each real token shifted decrements this. */ - - for (;;) { - yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_(yyn)) { - yyn += yyterror_; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) { - yyn = yytable_[yyn]; - if (0 < yyn) - break; - } - } - - /* - * Pop the current state because it cannot handle the - * error token. - */ - if (yystack.height == 0) { - label = YYABORT; - break; - } - - - yystack.pop(); - yystate = yystack.stateAt(0); - if (yydebug > 0) - yystack.print(yyDebugStream); - } - - if (label == YYABORT) - /* Leave the switch. */ - break; - - - - /* Shift the error token. */ - yy_symbol_print("Shifting", yystos_[yyn], yylval); - - yystate = yyn; - yystack.push(yyn, yylval); - label = YYNEWSTATE; - break; - - /* Accept. */ - case YYACCEPT: - this.push_parse_initialized = false; - return YYACCEPT; - - /* Abort. */ - case YYABORT: - this.push_parse_initialized = false; - return YYABORT; - } - } - - boolean push_parse_initialized = false; - - /** - * (Re-)Initialize the state of the push parser. - */ - public void push_parse_initialize() { - /* Lookahead and lookahead in internal form. */ - this.yychar = yyempty_; - this.yytoken = 0; - - /* State. */ - this.yyn = 0; - this.yylen = 0; - this.yystate = 0; - this.yystack = new YYStack(); - this.label = YYNEWSTATE; - - /* Error handling. */ - this.yynerrs_ = 0; - - - /* Semantic value of the lookahead. */ - this.yylval = null; - - yystack.push(this.yystate, this.yylval); - - this.push_parse_initialized = true; - - } - - - - // Generate an error message. - private String yysyntax_error(int yystate, int tok) { - if (yyErrorVerbose) { - /* - * There are many possibilities here to consider: - * - If this state is a consistent state with a default action, - * then the only way this function was invoked is if the - * default action is an error action. In that case, don't - * check for expected tokens because there are none. - * - The only way there can be no lookahead present (in tok) is - * if this state is a consistent state with a default action. - * Thus, detecting the absence of a lookahead is sufficient to - * determine that there is no unexpected or expected token to - * report. In that case, just report a simple "syntax error". - * - Don't assume there isn't a lookahead just because this - * state is a consistent state with a default action. There - * might have been a previous inconsistent state, consistent - * state with a non-default action, or user semantic action - * that manipulated yychar. (However, yychar is currently out - * of scope during semantic actions.) - * - Of course, the expected token list depends on states to - * have correct lookahead information, and it depends on the - * parser not to perform extra reductions after fetching a - * lookahead from the scanner and before detecting a syntax - * error. Thus, state merging (from LALR or IELR) and default - * reductions corrupt the expected token list. However, the - * list is correct for canonical LR with one exception: it - * will still contain any token that will not be accepted due - * to an error action in a later state. - */ - if (tok != yyempty_) { - /* - * FIXME: This method of building the message is not compatible - * with internationalization. - */ - StringBuffer res = new StringBuffer("syntax error, unexpected "); - res.append(yytnamerr_(yytname_[tok])); - int yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_(yyn)) { - /* - * Start YYX at -YYN if negative to avoid negative - * indexes in YYCHECK. In other words, skip the first - * -YYN actions for this state because they are default - * actions. - */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = yylast_ - yyn + 1; - int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; - int count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yyterror_ && !yy_table_value_is_error_(yytable_[x + yyn])) - ++count; - if (count < 5) { - count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yyterror_ && !yy_table_value_is_error_(yytable_[x + yyn])) { - res.append(count++ == 0 ? ", expecting " : " or "); - res.append(yytnamerr_(yytname_[x])); - } - } - } - return res.toString(); - } - } - - return "syntax error"; - } - - /** - * Whether the given yypact_ value indicates a defaulted state. - * - * @param yyvalue the value to check - */ - private static boolean yy_pact_value_is_default_(int yyvalue) { - return yyvalue == yypact_ninf_; - } - - /** - * Whether the given yytable_ - * value indicates a syntax error. - * - * @param yyvalue the value to check - */ - private static boolean yy_table_value_is_error_(int yyvalue) { - return yyvalue == yytable_ninf_; - } - - private static final short yypact_ninf_ = -186; - private static final short yytable_ninf_ = -97; - - /* - * YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - * STATE-NUM. - */ - private static final short yypact_[] = yypact_init(); - - private static final short[] yypact_init() { - return new short[] {5, -186, -186, 12, -186, -186, -186, -186, 315, 315, -186, 36, 41, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, 29, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, 14, -186, - -10, -186, -186, -38, -38, -38, -186, 315, 315, 315, 315, 315, 315, 315, 43, 204, -62, 129, -186, -5, 255, 217, - 315, 271, 316, -36, -186, 104, -186, -186, 107, -186, -14, -32, -12, 197, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, 25, -186, -186, 0, 30, -186, -186, -186, -186, 55, -186, 32, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, 83, -16, -186, -186, -186, -186, -186, - -186, -186, -186, 50, -186, -186, 43, 121, 164, 159, 190, -186, -4, -186, -186, 195, 137, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186}; - } - - /* - * YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - * Performed when YYTABLE does not specify something else to do. Zero - * means the default is an error. - */ - private static final short yydefact_[] = yydefact_init(); - - private static final short[] yydefact_init() { - return new short[] {0, 108, 108, 0, 2, 8, 3, 186, 5, 185, 1, 0, 0, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 109, 4, 108, 108, 108, 108, 108, 108, 108, 108, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 13, 8, 10, 0, 9, 83, 11, 24, 63, 25, 63, 108, 26, 71, 27, 78, 12, 85, 86, 0, 87, 0, 88, 184, 0, - 0, 0, 187, 7, 15, 21, 31, 70, 77, 92, 0, 0, 0, 0, 16, 0, 0, 0, 29, 0, 0, 0, 90, 0, 99, 97, 0, 191, 0, 0, 0, 91, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 107, 153, 0, 108, 6, 0, 0, 14, 17, 20, 84, 0, 62, 0, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 28, 65, 83, 66, 30, 69, 72, 73, 74, 75, 76, 79, 80, 81, 82, 0, 0, 89, - 100, 95, 98, 188, 192, 189, 190, 0, 93, 103, 0, 0, 0, 0, 0, 68, 0, 102, 101, 0, 0, 104, 18, 19, 22, 23, 67, 94, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 105, 106}; - } - - /* YYPGOTO[NTERM-NUM]. */ - private static final short yypgoto_[] = yypgoto_init(); - - private static final short[] yypgoto_init() { - return new short[] {-186, -186, -186, -186, -186, -186, 160, -186, -186, -186, 122, -186, -186, 72, 74, -186, -186, - -186, -186, -186, -186, 152, 76, -186, -186, -186, -186, -186, -186, -186, 45, -91, -66, -186, -186, -186, -186, - -186, -186, -186, -186, 116, -186, -186, -185, -2, -186, -186, -186, -186, -186, -186, -186, -63}; - } - - /* YYDEFGOTO[NTERM-NUM]. */ - private static final short yydefgoto_[] = yydefgoto_init(); - - private static final short[] yydefgoto_init() { - return new short[] {-1, 3, 4, 5, 52, 53, 11, 54, 55, 90, 91, 56, 57, 167, 58, 59, 60, 61, 62, 63, 168, 93, 169, 170, - 64, 65, 96, 66, 67, 97, 92, 68, 69, 70, 71, 108, 194, 72, 73, 103, 100, 101, 74, 206, 140, 8, 27, 141, 245, 6, - 7, 12, 79, 105}; - } - - /* - * YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - * positive, shift that token. If negative, reduce the rule whose - * number is the opposite. If YYTABLE_NINF, syntax error. - */ - private static final short yytable_[] = yytable_init(); - - private static final short[] yytable_init() { - return new short[] {9, 148, 171, 171, 191, 177, 182, 102, 1, 147, 204, 207, 10, 143, 106, 107, 212, 35, 144, 36, - 189, 244, 35, 35, 36, 36, 192, 80, 81, 82, 83, 84, 85, 86, 87, 184, 2, 188, 89, 98, 28, 29, 99, 30, 183, 104, - 109, 104, 110, 31, 111, 190, 112, 32, 113, 195, 114, 33, 115, 34, 116, 95, 117, 35, 118, 36, 119, 190, 120, 190, - 121, 190, 122, 75, 76, 37, 77, 38, 78, 39, 197, 40, 123, 41, 124, 42, 125, 43, 126, 44, 127, 45, 128, 46, 129, - 47, 130, 48, 131, 49, 132, 50, 133, 51, 134, 198, 135, 201, 136, 203, 137, 148, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 205, 25, 138, 26, 139, 98, 199, 208, 185, 200, 35, 187, 36, 145, 89, 196, 109, 214, 110, 215, - 111, 216, 112, 217, 113, 218, 114, 219, 115, 220, 116, 221, 117, 222, 118, 223, 119, 224, 120, 225, 121, 226, - 122, 227, 174, 179, 175, 180, 176, 181, 209, 210, 123, 228, 124, 229, 125, 230, 126, 231, 127, 232, 128, 233, - 129, 234, 130, 235, 131, 236, 132, 237, 133, 238, 134, 239, 135, 240, 136, 241, 137, 242, 211, 213, 193, 29, - 142, 30, 146, 88, 94, 202, 186, 31, 0, 0, 138, 32, 139, 243, -96, 33, -96, 34, 0, 0, 0, 35, 149, 36, 0, 172, - 151, 0, 0, 0, 0, 0, 0, 37, 35, 38, 36, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 49, - 0, 50, 149, 51, 0, 150, 151, 0, 0, 0, 0, 0, 0, 0, 35, 0, 36, 0, 149, 0, 32, 0, 151, 0, 33, 173, 34, 152, 0, 153, - 35, 154, 36, 155, 0, 156, 0, 157, 0, 158, 0, 159, 37, 160, 38, 161, 39, 162, 40, 163, 41, 164, 42, 165, 43, 166, - 44, 0, 45, 0, 46, 0, 47, 149, 48, 32, 49, 151, 50, 33, 51, 34, 178, 0, 0, 35, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 25, 0, 26}; - } - - private static final short yycheck_[] = yycheck_init(); - - private static final short[] yycheck_init() { - return new short[] {2, 92, 93, 94, 36, 96, 97, 73, 3, 14, 26, 196, 0, 75, 77, 78, 20, 27, 80, 29, 34, 206, 27, 27, - 29, 29, 38, 29, 30, 31, 32, 33, 34, 35, 36, 98, 31, 103, 9, 25, 4, 5, 28, 7, 80, 83, 3, 83, 5, 13, 7, 83, 9, 17, - 11, 30, 13, 21, 15, 23, 17, 63, 19, 27, 21, 29, 23, 83, 25, 83, 27, 83, 29, 32, 33, 39, 35, 41, 37, 43, 80, 45, - 39, 47, 41, 49, 43, 51, 45, 53, 47, 55, 49, 57, 51, 59, 53, 61, 55, 63, 57, 65, 59, 67, 61, 75, 63, 75, 65, 26, - 67, 202, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 74, 82, 83, 84, 85, 25, 75, 10, 28, 78, 27, 28, 29, 8, - 9, 141, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 96, 97, 96, 97, 96, 97, 10, 16, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 16, 12, 11, 5, 6, 7, 90, 53, 62, 170, 100, 13, -1, -1, 83, 17, 85, 86, - 27, 21, 29, 23, -1, -1, -1, 27, 15, 29, -1, 18, 19, -1, -1, -1, -1, -1, -1, 39, 27, 41, 29, 43, -1, 45, -1, 47, - -1, 49, -1, 51, -1, 53, -1, 55, -1, 57, -1, 59, -1, 61, -1, 63, -1, 65, 15, 67, -1, 18, 19, -1, -1, -1, -1, -1, - -1, -1, 27, -1, 29, -1, 15, -1, 17, -1, 19, -1, 21, 22, 23, 40, -1, 42, 27, 44, 29, 46, -1, 48, -1, 50, -1, 52, - -1, 54, 39, 56, 41, 58, 43, 60, 45, 62, 47, 64, 49, 66, 51, 68, 53, -1, 55, -1, 57, -1, 59, 15, 61, 17, 63, 19, - 65, 21, 67, 23, 24, -1, -1, 27, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 41, -1, 43, -1, 45, -1, 47, - -1, 49, -1, 51, -1, 53, -1, 55, -1, 57, -1, 59, -1, 61, -1, 63, -1, 65, -1, 67, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, -1, 82, -1, 84}; - } - - /* - * YYSTOS[STATE-NUM] -- The (internal number of the) accessing - * symbol of state STATE-NUM. - */ - private static final short yystos_[] = yystos_init(); - - private static final short[] yystos_init() { - return new short[] {0, 3, 31, 88, 89, 90, 136, 137, 132, 132, 0, 93, 138, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 82, 84, 133, 4, 5, 7, 13, 17, 21, 23, 27, 29, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, - 67, 91, 92, 94, 95, 98, 99, 101, 102, 103, 104, 105, 106, 111, 112, 114, 115, 118, 119, 120, 121, 124, 125, 129, - 32, 33, 35, 37, 139, 132, 132, 132, 132, 132, 132, 132, 132, 93, 9, 96, 97, 117, 108, 108, 132, 113, 116, 25, - 28, 127, 128, 119, 126, 83, 140, 140, 140, 122, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 39, 41, 43, - 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 83, 85, 131, 134, 6, 75, 80, 8, 97, 14, 118, 15, 18, 19, 40, 42, - 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 100, 107, 109, 110, 118, 18, 22, 100, 101, 109, 118, 24, - 100, 101, 109, 118, 80, 140, 28, 128, 28, 119, 34, 83, 36, 38, 11, 123, 30, 132, 80, 75, 75, 78, 75, 117, 26, - 26, 74, 130, 131, 10, 10, 16, 16, 20, 12, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 40, 42, 44, 46, - 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 86, 131, 135}; - } - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ - private static final short yyr1_[] = yyr1_init(); - - private static final short[] yyr1_init() { - return new short[] {0, 87, 88, 88, 89, 90, 91, 92, 93, 93, 93, 93, 93, 93, 94, 95, 96, 96, 97, 97, 98, 99, 100, 100, - 101, 101, 101, 101, 102, 103, 104, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 109, - 110, 111, 112, 113, 113, 113, 113, 113, 114, 115, 116, 116, 116, 116, 116, 117, 117, 118, 119, 119, 119, 120, - 120, 121, 122, 122, 123, 124, 125, 126, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 132, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 136, 137, 138, 138, 139, 139, 139, 140, 140}; - } - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ - private static final byte yyr2_[] = yyr2_init(); - - private static final byte[] yyr2_init() { - return new byte[] {0, 2, 1, 1, 3, 2, 3, 2, 0, 2, 2, 2, 2, 2, 3, 2, 1, 2, 4, 4, 3, 2, 3, 3, 1, 1, 1, 1, 3, 2, 3, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 3, 2, - 3, 2, 0, 2, 2, 2, 2, 3, 2, 0, 2, 2, 2, 2, 0, 2, 1, 1, 1, 1, 3, 2, 3, 0, 2, 3, 3, 3, 1, 2, 1, 2, 3, 3, 4, 1, 2, - 4, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 2, 0, 2, 3, 3, 3, 1, 2}; - } - - /* - * YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding - * to YYLEX-NUM. - */ - private static final short yytoken_number_[] = yytoken_number_init(); - - private static final short[] yytoken_number_init() { - return new short[] {0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, - 340, 341}; - } - - /* - * YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - * First, the terminals, then, starting at \a yyntokens_, nonterminals. - */ - private static final String yytname_[] = yytname_init(); - - private static final String[] yytname_init() { - return new String[] {"$end", "error", "$undefined", "DATASET_", "_DATASET", "GROUP_", "_GROUP", "ENUMERATION_", - "_ENUMERATION", "ENUMCONST_", "_ENUMCONST", "NAMESPACE_", "_NAMESPACE", "DIMENSION_", "_DIMENSION", "DIM_", - "_DIM", "ENUM_", "_ENUM", "MAP_", "_MAP", "STRUCTURE_", "_STRUCTURE", "SEQUENCE_", "_SEQUENCE", "VALUE_", - "_VALUE", "ATTRIBUTE_", "_ATTRIBUTE", "OTHERXML_", "_OTHERXML", "ERROR_", "_ERROR", "MESSAGE_", "_MESSAGE", - "CONTEXT_", "_CONTEXT", "OTHERINFO_", "_OTHERINFO", "CHAR_", "_CHAR", "BYTE_", "_BYTE", "INT8_", "_INT8", - "UINT8_", "_UINT8", "INT16_", "_INT16", "UINT16_", "_UINT16", "INT32_", "_INT32", "UINT32_", "_UINT32", - "INT64_", "_INT64", "UINT64_", "_UINT64", "FLOAT32_", "_FLOAT32", "FLOAT64_", "_FLOAT64", "STRING_", "_STRING", - "URL_", "_URL", "OPAQUE_", "_OPAQUE", "ATTR_BASE", "ATTR_BASETYPE", "ATTR_DAPVERSION", "ATTR_DMRVERSION", - "ATTR_ENUM", "ATTR_HREF", "ATTR_NAME", "ATTR_NAMESPACE", "ATTR_NS", "ATTR_SIZE", "ATTR_TYPE", "ATTR_VALUE", - "ATTR_HTTPCODE", "ATTR_SPECIAL", "TEXT", "UNKNOWN_ATTR", "UNKNOWN_ELEMENT_", "_UNKNOWN_ELEMENT", "$accept", - "response", "dataset", "datasetprefix", "group", "groupprefix", "groupbody", "enumdef", "enumdefprefix", - "enumconst_list", "enumconst", "dimdef", "dimdefprefix", "dimref", "variable", "atomicvariable", - "atomicvariableprefix", "enumvariable", "enumvariableprefix", "atomictype_", "_atomictype", "varbody", "mapref", - "maprefprefix", "structurevariable", "structurevariableprefix", "structbody", "sequencevariable", - "sequencevariableprefix", "sequencebody", "metadatalist", "metadata", "attribute", "atomicattribute", - "atomicattributeprefix", "namespace_list", "namespace", "containerattribute", "containerattributeprefix", - "attributelist", "valuelist", "value", "otherxml", "xml_body", "element_or_text", "xml_attribute_map", - "xml_attribute", "xml_open", "xml_close", "error_response", "error_responseprefix", "error_body", - "error_element", "textstring", null}; - } - - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ - private static final short yyrline_[] = yyrline_init(); - - private static final short[] yyrline_init() { - return new short[] {0, 98, 98, 99, 103, 110, 116, 123, 134, 136, 137, 138, 139, 140, 144, 151, 157, 158, 162, 164, - 169, 176, 182, 184, 189, 190, 191, 192, 197, 205, 211, 219, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 262, - 264, 265, 266, 270, 277, 283, 290, 295, 297, 298, 299, 300, 304, 311, 316, 318, 319, 320, 321, 324, 326, 330, - 334, 335, 336, 342, 347, 353, 361, 362, 367, 374, 381, 389, 390, 395, 396, 400, 402, 407, 415, 416, 420, 425, - 434, 435, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, - 489, 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 527, 534, 540, 542, 546, 548, 550, 555, 557}; - } - - - // Report on the debug stream that the rule yyrule is going to be reduced. - private void yy_reduce_print(int yyrule, YYStack yystack) { - if (yydebug == 0) - return; - - int yylno = yyrline_[yyrule]; - int yynrhs = yyr2_[yyrule]; - /* Print the symbols being reduced, and their result. */ - yycdebug("Reducing stack by rule " + (yyrule - 1) + " (line " + yylno + "), "); - - /* The symbols being reduced. */ - for (int yyi = 0; yyi < yynrhs; yyi++) - yy_symbol_print(" $" + (yyi + 1) + " =", yystos_[yystack.stateAt(yynrhs - (yyi + 1))], - ((yystack.valueAt(yynrhs - (yyi + 1))))); - } - - /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - private static final byte yytranslate_table_[] = yytranslate_table_init(); - - private static final byte[] yytranslate_table_init() { - return new byte[] {0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86}; - } - - private static final byte yytranslate_(int t) { - if (t >= 0 && t <= yyuser_token_number_max_) - return yytranslate_table_[t]; - else - return yyundef_token_; - } - - private static final int yylast_ = 399; - private static final int yynnts_ = 54; - private static final int yyempty_ = -2; - private static final int yyfinal_ = 10; - private static final int yyterror_ = 1; - private static final int yyerrcode_ = 256; - private static final int yyntokens_ = 87; - - private static final int yyuser_token_number_max_ = 341; - private static final int yyundef_token_ = 2; - - /* User implementation code. */ - -} - diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4EventHandler.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4EventHandler.java deleted file mode 100644 index cc1416b024..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4EventHandler.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import java.util.HashMap; -import java.util.Map; -import static dap4.core.dmr.parser.bison.Dap4BisonParser.Lexer.*; -import static dap4.core.dmr.parser.bison.Dap4BisonParser.YYABORT; -import static dap4.core.dmr.parser.bison.Dap4BisonParser.YYACCEPT; - -public class Dap4EventHandler extends SaxEventHandler { - ////////////////////////////////////////////////// - // Constants - - public static String SPECIALATTRPREFIX = "_"; - - ////////////////////////////////////////////////// - // static types - - ////////////////////////////////////////////////// - // static fields - - static Map elementmap; - static Map attributemap; - - static { - elementmap = new HashMap(); - attributemap = new HashMap(); - - elementmap.put("Dataset", - new Lexeme("Dataset", DATASET_, _DATASET, new String[] {"name", "dapVersion", "dmrVersion"})); // legal - // attributes - // (lower case) - elementmap.put("Group", new Lexeme("Group", GROUP_, _GROUP, new String[] {"name"})); - elementmap.put("Enumeration", - new Lexeme("Enumeration", ENUMERATION_, _ENUMERATION, new String[] {"name", "basetype"})); - elementmap.put("EnumConst", new Lexeme("EnumConst", ENUMCONST_, _ENUMCONST, new String[] {"name", "value"})); - elementmap.put("Namespace", new Lexeme("Namespace", NAMESPACE_, _NAMESPACE, new String[] {"href"})); - elementmap.put("Dimension", new Lexeme("Dimension", DIMENSION_, _DIMENSION, new String[] {"name", "size"})); - elementmap.put("Dim", new Lexeme("Dim", DIM_, _DIM, new String[] {"name", "size"})); - elementmap.put("Enum", new Lexeme("Enum", ENUM_, _ENUM, new String[] {"enum", "name"})); - elementmap.put("Map", new Lexeme("Map", MAP_, _MAP, new String[] {"name"})); - elementmap.put("Structure", new Lexeme("Structure", STRUCTURE_, _STRUCTURE, new String[] {"name"})); - elementmap.put("Sequence", new Lexeme("Sequence", SEQUENCE_, _SEQUENCE, new String[] {"name"})); - elementmap.put("Value", new Lexeme("Value", VALUE_, _VALUE, new String[] {"value"})); - elementmap.put("Attribute", new Lexeme("Attribute", ATTRIBUTE_, _ATTRIBUTE, new String[] {"name", "type"})); - - elementmap.put("Char", new Lexeme("Char", CHAR_, _CHAR, new String[] {"name"})); - elementmap.put("Byte", new Lexeme("Byte", BYTE_, _BYTE, new String[] {"name"})); - elementmap.put("Int8", new Lexeme("Int8", INT8_, _INT8, new String[] {"name"})); - elementmap.put("UInt8", new Lexeme("UInt8", UINT8_, _UINT8, new String[] {"name"})); - elementmap.put("Int16", new Lexeme("Int16", INT16_, _INT16, new String[] {"name"})); - elementmap.put("UInt16", new Lexeme("UInt16", UINT16_, _UINT16, new String[] {"name"})); - elementmap.put("Int32", new Lexeme("Int32", INT32_, _INT32, new String[] {"name"})); - elementmap.put("UInt32", new Lexeme("UInt32", UINT32_, _UINT32, new String[] {"name"})); - elementmap.put("Int64", new Lexeme("Int64", INT64_, _INT64, new String[] {"name"})); - elementmap.put("UInt64", new Lexeme("UInt64", UINT64_, _UINT64, new String[] {"name"})); - elementmap.put("Float32", new Lexeme("Float32", FLOAT32_, _FLOAT32, new String[] {"name"})); - elementmap.put("Float64", new Lexeme("Float64", FLOAT64_, _FLOAT64, new String[] {"name"})); - elementmap.put("String", new Lexeme("String", STRING_, _STRING, new String[] {"name"})); - elementmap.put("URL", new Lexeme("URL", URL_, _URL, new String[] {"name"})); - elementmap.put("Opaque", new Lexeme("Opaque", OPAQUE_, _OPAQUE, new String[] {"name"})); - - // related elements - elementmap.put("Error", new Lexeme("Error", ERROR_, _ERROR, new String[] {"httpcode"})); - elementmap.put("Message", new Lexeme("Message", MESSAGE_, _MESSAGE, null)); - elementmap.put("Context", new Lexeme("Context", CONTEXT_, _CONTEXT, null)); - elementmap.put("OtherInfo", new Lexeme("OtherInfo", OTHERINFO_, _OTHERINFO, null)); - - // Always insert the lowercase name - attributemap.put("base", new Lexeme("base", ATTR_BASE)); - attributemap.put("basetype", new Lexeme("basetype", ATTR_BASETYPE)); - attributemap.put("dapversion", new Lexeme("dapversion", ATTR_DAPVERSION)); - attributemap.put("dmrversion", new Lexeme("dmrversion", ATTR_DMRVERSION)); - attributemap.put("enum", new Lexeme("enum", ATTR_ENUM)); - attributemap.put("href", new Lexeme("href", ATTR_HREF)); - attributemap.put("name", new Lexeme("name", ATTR_NAME)); - attributemap.put("namespace", new Lexeme("namespace", ATTR_NAMESPACE)); - attributemap.put("size", new Lexeme("size", ATTR_SIZE)); - attributemap.put("type", new Lexeme("type", ATTR_TYPE)); - attributemap.put("value", new Lexeme("value", ATTR_VALUE)); - attributemap.put("ns", new Lexeme("ns", ATTR_NS)); - // related xml attributes - attributemap.put("httpcode", new Lexeme("httpcode", ATTR_HTTPCODE)); - } - - ; - - ////////////////////////////////////////////////// - // Instance variables - - boolean textok = false; - boolean accepted = false; - boolean otherxml = false; - - ////////////////////////////////////////////////// - // Constructor(s) - - public Dap4EventHandler() {} - - ////////////////////////////////////////////////// - // Abstract method overrides - - // Push the token to the parser - // @throws SAXException if parser return YYABORT - - public void yyevent(SaxEvent saxtoken) throws SAXException { - if (accepted) { - throw new SAXException("yyevent called after parser has accepted"); - } - - SaxEventType event = saxtoken.eventtype; - String name = saxtoken.name; - int yytoken = 0; - Lexeme element = null; - Lexeme attr = null; - - element = elementmap.get(name); - - switch (event) { - - case STARTELEMENT: - if (element == null) {// undefined - yytoken = UNKNOWN_ELEMENT_; - break; - } - yytoken = element.open; - if (yytoken == OTHERXML_) { - otherxml = true; - textok = true; - } else if (!otherxml && yytoken == VALUE_) - textok = true; - break; - - case ATTRIBUTE: - String lcname = name.toLowerCase(); - attr = attributemap.get(lcname); - if (attr == null) { - if (lcname.startsWith(SPECIALATTRPREFIX)) - yytoken = ATTR_SPECIAL; - else - yytoken = UNKNOWN_ATTR; - } else - yytoken = attr.atoken; - break; - - case ENDELEMENT: - if (element == null) {// undefined - yytoken = _UNKNOWN_ELEMENT; - break; - } - yytoken = element.close; - if (yytoken == _OTHERXML) { - otherxml = false; - textok = false; - } else if (!otherxml && yytoken == _VALUE) - textok = false; - break; - - case CHARACTERS: - if (!textok) - return; // ignore - yytoken = TEXT; - break; - - case ENDDOCUMENT: - yytoken = EOF; - break; - - default: - return; // ignore - - } // switch - - int status = 0; - try { - Locator loc = getLocator(); - Dap4BisonParser parser = (Dap4BisonParser) this; - // Bison.Position pos = new Bison.Position(loc); - // Dap4BisonParser.Location yyloc = parser.new Location(pos); - status = parser.push_parse(yytoken, saxtoken); - } catch (Exception e) { - throw new SAXException(e); - } - if (status == YYABORT) - throw new SAXException("YYABORT"); - else if (status == YYACCEPT) - accepted = true; - } - -} // class Dap4EventHandler diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4ParserImpl.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4ParserImpl.java deleted file mode 100644 index eb5fa09979..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4ParserImpl.java +++ /dev/null @@ -1,1056 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import dap4.core.dmr.*; -import dap4.core.dmr.parser.Dap4Parser; -import dap4.core.dmr.parser.ParseException; -import dap4.core.dmr.parser.ParseUtil; -import dap4.core.util.DapException; -import dap4.core.util.DapSort; -import dap4.core.util.DapUtil; -import dap4.core.util.Escape; -import org.xml.sax.SAXException; -import java.math.BigInteger; -import java.util.*; - -/** - * Implement the Dap4 Parse Actions - */ - -public class Dap4ParserImpl extends Dap4BisonParser implements Dap4Parser { - - ////////////////////////////////////////////////// - // Constants - - ////////////////////////////////////////////////// - // static variables - - protected static int globaldebuglevel = 0; - - ////////////////////////////////////////////////// - // Static methods - - public static void setGlobalDebugLevel(int level) { - globaldebuglevel = level; - } - - ////////////////////////////////////////////////// - // Instance variables - - protected DMRFactory factory = null; - - protected ErrorResponse errorresponse = null; - - protected Deque scopestack = new ArrayDeque(); - - protected DapDataset root = null; // of the parse - - protected boolean debug = false; - - ////////////////////////////////////////////////// - // Constructors - - public Dap4ParserImpl(DMRFactory factory) { - super(); - this.factory = (factory == null ? new DMRFactory() : factory); // see Dap4Actions - if (globaldebuglevel > 0) - setDebugLevel(globaldebuglevel); - } - - ////////////////////////////////////////////////// - // Accessors - - public ErrorResponse getErrorResponse() { - return errorresponse; - } - - public DapDataset getDMR() { - return this.root; - } - - ////////////////////////////////////////////////// - // Parser API - - public boolean parse(String input) throws SAXException { - return super.parse(input); - } - - ////////////////////////////////////////////////// - // Parser specific methods - - DapGroup getGroupScope() throws DapException { - DapGroup gscope = (DapGroup) searchScope(DapSort.GROUP, DapSort.DATASET); - if (gscope == null) - throw new DapException("Undefined Group Scope"); - return gscope; - } - - DapNode getMetadataScope() throws DapException { - // Search up the stack for first match. - DapNode match = searchScope(METADATASCOPES); - if (match == null) - throw new ParseException("No enclosing metadata capable scope"); - return match; - } - - DapNode getParentScope() throws DapException { - DapNode parent = searchScope(DapSort.VARIABLE, DapSort.GROUP, DapSort.DATASET); - if (parent == null) - throw new DapException("Undefined parent scope"); - return parent; - } - - DapVariable getVariableScope() throws DapException { - DapNode match = searchScope(DapSort.VARIABLE); - if (match == null) - throw new ParseException("No enclosing variable scope"); - return (DapVariable) match; - } - - DapNode getScope(DapSort... sort) throws DapException { - DapNode node = searchScope(sort); - if (node == null) // return exception if not found - throw new ParseException("No enclosing scope of specified type"); - return node; - } - - DapNode searchScope(DapSort... sort) { - Iterator it = scopestack.iterator(); - while (it.hasNext()) { - DapNode node = (DapNode) it.next(); - for (int j = 0; j < sort.length; j++) { - if (node.getSort() == sort[j]) - return node; - } - } - return null; - } - - DapVariable findVariable(DapNode parent, String name) { - DapVariable var = null; - switch (parent.getSort()) { - case DATASET: - case GROUP: - var = ((DapGroup) parent).findVariable(name); - break; - case VARIABLE: - DapVariable v = (DapVariable) parent; - DapType t = v.getBaseType(); - switch (t.getTypeSort()) { - case Structure: - var = (DapVariable) ((DapStructure) t).findByName(name); - break; - case Sequence: - var = (DapVariable) ((DapSequence) t).findByName(name); - break; - default: - assert false : "Container cannot be atomic variable"; - } - default: - break; - } - return var; - } - - // Attribute map utilities - SaxEvent pull(XMLAttributeMap map, String name) { - SaxEvent event = map.remove(name.toLowerCase()); - return event; - } - - /** - * add any reserved xml attributes to a node unchanged - */ - void passReserved(XMLAttributeMap map, DapNode node) throws ParseException { - try { - DapAttribute attr = null; - for (Map.Entry entry : map.entrySet()) { - SaxEvent event = entry.getValue(); - String key = entry.getKey(); - String value = event.value; - if (isReserved(key)) - node.addXMLAttribute(key, value); - } - } catch (DapException de) { - throw new ParseException(de); - } - } - - // Attribute map utilities - SaxEvent peek(XMLAttributeMap map, String name) { - SaxEvent event = map.get(name.toLowerCase()); - return event; - } - - ////////////////////////////////////////////////// - // Attribute construction - - DapAttribute makeAttribute(DapSort sort, String name, DapType basetype, List nslist, DapNode parent) - throws DapException { - DapAttribute attr = new DapAttribute(name, basetype); - if (sort == DapSort.ATTRIBUTE) { - attr.setBaseType(basetype); - } - parent.addAttribute(attr); - attr.setNamespaceList(nslist); - return attr; - } - - boolean isempty(SaxEvent token) { - return token == null || isempty(token.value); - } - - boolean isempty(String text) { - return (text == null || text.length() == 0); - } - - List convertNamespaceList(NamespaceList nslist) { - return nslist; - } - - boolean islegalenumtype(DapType kind) { - return kind.isIntegerType(); - } - - boolean islegalattributetype(DapType kind) { - return kind.isLegalAttrType(); - } - - DapAttribute lookupAttribute(DapNode parent, XMLAttributeMap attrs) throws DapException { - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Attribute: Empty attribute name"); - String attrname = name.value; - return parent.findAttribute(attrname); - } - - void changeAttribute(DapAttribute attr, XMLAttributeMap description) throws DapException { - SaxEvent name = pull(description, "name"); - if (isempty(name)) - throw new ParseException("Attribute: Empty attribute name"); - String attrname = name.value; - if (!attr.getShortName().equals(attrname)) - throw new ParseException("Attribute: DATA DMR: Attribute name mismatch:" + name.name); - switch (attr.getSort()) { - case ATTRIBUTE: - SaxEvent atype = pull(description, "type"); - String typename = (atype == null ? "Int32" : atype.value); - if ("Byte".equalsIgnoreCase(typename)) - typename = "UInt8"; - DapType basetype = (DapType) root.lookup(typename, DapSort.ENUMERATION, DapSort.ATOMICTYPE); - if (basetype != attr.getBaseType()) - throw new ParseException("Attribute: DATA DMR: Attempt to change attribute type: " + typename); - attr.clearValues(); - SaxEvent value = pull(description, "value"); - if (value != null) - attr.setValues(new String[] {value.value}); - break; - case ATTRIBUTESET: - // clear the contained attributes - attr.setAttributes(new HashMap()); - break; - case OTHERXML: - throw new ParseException("Attribute: DATA DMR: OtherXML attributes not supported"); - } - } - - DapAttribute createatomicattribute(XMLAttributeMap attrs, NamespaceList nslist, DapNode parent) throws DapException { - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Attribute: Empty attribute name"); - String attrname = name.value; - SaxEvent atype = pull(attrs, "type"); - String typename = (atype == null ? "Int32" : atype.value); - if ("Byte".equalsIgnoreCase(typename)) - typename = "UInt8"; - DapType basetype = (DapType) root.lookup(typename, DapSort.ENUMERATION, DapSort.ATOMICTYPE); - if (basetype == null || !islegalattributetype(basetype)) - throw new ParseException("Attribute: Invalid attribute type: " + typename); - List hreflist = convertNamespaceList(nslist); - DapAttribute attr = makeAttribute(DapSort.ATTRIBUTE, name.value, basetype, hreflist, parent); - return attr; - } - - DapAttribute createcontainerattribute(XMLAttributeMap attrs, NamespaceList nslist, DapNode parent) - throws DapException { - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("ContainerAttribute: Empty attribute name"); - List hreflist = convertNamespaceList(nslist); - DapAttribute attr = makeAttribute(DapSort.ATTRIBUTESET, name.value, null, hreflist, parent); - return attr; - } - - void createvalue(String value, DapAttribute parent) throws DapException { - // Since this came from ... - // Clean it up - value = cleanup(value); - if (parent != null) - parent.setValues(new String[] {value}); - } - - protected String cleanup(String value) { - value = value.trim(); - int first = -1; - for (int i = 0; i < value.length(); i++) { - if (first < 0 && value.charAt(i) > ' ') { - first = i; - break; - } - } - int last = -1; - for (int i = value.length() - 1; i >= 0; i--) { - if (last < 0 && value.charAt(i) > ' ') { - last = i; - break; - } - } - if (last < 0) - last = value.length() - 1; - if (first < 0) - first = 0; - value = value.substring(first, last + 1); - return value; - } - - void createvalue(SaxEvent value, DapAttribute parent) throws DapException { - List textlist = null; - if (value.eventtype == SaxEventType.CHARACTERS) { - textlist = ParseUtil.collectValues(value.text); - } else if (value.eventtype == SaxEventType.ATTRIBUTE) { - textlist = new ArrayList(); - textlist.add(value.value); - } - if (textlist != null) - parent.setValues(textlist.toArray(new String[textlist.size()])); - } - - DapOtherXML createotherxml(XMLAttributeMap attrs, DapNode parent) throws DapException { - SaxEvent name = pull(attrs, "name"); - SaxEvent href = pull(attrs, "href"); - if (isempty(name)) - throw new ParseException("OtherXML: Empty name"); - List nslist = new ArrayList(); - if (!isempty(href)) - nslist.add(href.value); - DapOtherXML other = (DapOtherXML) makeAttribute(DapSort.OTHERXML, name.value, null, nslist, parent); - parent.setAttribute(other); - return other; - } - - ////////////////////////////////////////////////// - // Abstract action definitions - @Override - void enterdataset(XMLAttributeMap attrs) throws ParseException { - this.debug = getDebugLevel() > 0; // make sure we have the latest value - if (debug) - report("enterdataset"); - SaxEvent name = pull(attrs, "name"); - SaxEvent dapversion = pull(attrs, "dapversion"); - SaxEvent dmrversion = pull(attrs, "dmrversion"); - if (isempty(name)) - throw new ParseException("Empty dataset name attribute"); - // convert and test version numbers - float ndapversion = DAPVERSION; - if (dapversion != null) - try { - ndapversion = Float.parseFloat(dapversion.value); - } catch (NumberFormatException nfe) { - ndapversion = DAPVERSION; - } - if (ndapversion != DAPVERSION) - throw new ParseException("Dataset dapVersion mismatch: " + dapversion.value); - float ndmrversion = DMRVERSION; - if (dmrversion != null) - try { - ndmrversion = Float.parseFloat(dmrversion.value); - } catch (NumberFormatException nfe) { - ndmrversion = DMRVERSION; - } - if (ndmrversion != DMRVERSION) - throw new ParseException("Dataset dmrVersion mismatch: " + dmrversion.value); - this.root = new DapDataset(name.value); - this.root.setDapVersion(Float.toString(ndapversion)); - this.root.setDMRVersion(Float.toString(ndmrversion)); - this.root.setDataset(this.root); - passReserved(attrs, this.root); - scopestack.push(this.root); - } - - @Override - void leavedataset() throws ParseException { - if (debug) - report("leavedataset"); - assert (scopestack.peek() != null && scopestack.peek().getSort() == DapSort.DATASET); - this.root.sort(); - scopestack.pop(); - if (!scopestack.isEmpty()) - throw new ParseException("Dataset: nested dataset"); - this.root.finish(); - } - - @Override - void entergroup(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("entergroup"); - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Empty group name"); - try { - DapGroup parent = getGroupScope(); - DapGroup group; - group = new DapGroup(name.value); - passReserved(attrs, group); - parent.addDecl(group); - scopestack.push(group); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leavegroup() throws ParseException { - if (debug) - report("leavegroup"); - scopestack.pop(); - } - - @Override - void enterenumdef(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("enterenumdef"); - try { - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Enumdef: Empty Enum Declaration name"); - - SaxEvent basetype = pull(attrs, "basetype"); - DapType basedaptype = null; - if (basetype == null) { - basedaptype = DapEnumeration.DEFAULTBASETYPE; - } else { - String typename = basetype.value; - if ("Byte".equalsIgnoreCase(typename)) - typename = "UInt8"; - basedaptype = (DapType) this.root.lookup(typename, DapSort.ATOMICTYPE); - if (basedaptype == null || !islegalenumtype(basedaptype)) - throw new ParseException("Enumdef: Invalid Enum Declaration Type name: " + basetype.value); - } - DapEnumeration dapenum = null; - dapenum = new DapEnumeration(name.value, basedaptype); - passReserved(attrs, dapenum); - DapGroup parent = getGroupScope(); - parent.addDecl(dapenum); - scopestack.push(dapenum); - } catch (DapException de) { - throw new ParseException(de); - } - } - - - @Override - void leaveenumdef() throws ParseException { - if (debug) - report("leaveenumdef"); - DapEnumeration eparent = (DapEnumeration) scopestack.pop(); - List econsts = eparent.getNames(); - if (econsts.size() == 0) - throw new ParseException("Enumdef: no enum constants specified"); - } - - @Override - void enumconst(SaxEvent name, SaxEvent value) throws ParseException { - if (debug) - report("enumconst"); - if (isempty(name)) - throw new ParseException("Enumconst: Empty enum constant name"); - if (isempty(value)) - throw new ParseException("Enumdef: Invalid enum constant value: " + value.value); - long lvalue = 0; - try { - BigInteger bivalue = new BigInteger(value.value); - bivalue = DapUtil.BIG_UMASK64.and(bivalue); - lvalue = bivalue.longValue(); - } catch (NumberFormatException nfe) { - throw new ParseException("Enumconst: illegal value: " + value.value); - } - try { - DapEnumeration parent = (DapEnumeration) getScope(DapSort.ENUMERATION); - // Verify that the name is a legal enum constant name, which is restricted - // vis-a-vis other names - if (!ParseUtil.isLegalEnumConstName(name.value)) - throw new ParseException("Enumconst: illegal enumeration constant name: " + name.value); - parent.addEnumConst(new DapEnumConst(name.value, lvalue)); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void enterdimdef(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("enterdimdef"); - SaxEvent name = pull(attrs, "name"); - SaxEvent size = pull(attrs, "size"); - long lvalue = 0; - if (isempty(name)) - throw new ParseException("Dimdef: Empty dimension declaration name"); - if (isempty(size)) - throw new ParseException("Dimdef: Empty dimension declaration size"); - try { - lvalue = Long.parseLong(size.value); - if (lvalue <= 0) - throw new ParseException("Dimdef: value <= 0: " + lvalue); - } catch (NumberFormatException nfe) { - throw new ParseException("Dimdef: non-integer value: " + size.value); - } - DapDimension dim = null; - try { - dim = new DapDimension(name.value, lvalue); - passReserved(attrs, dim); - dim.setShared(true); - DapGroup parent = getGroupScope(); - parent.addDecl(dim); - scopestack.push(dim); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leavedimdef() throws ParseException { - if (debug) - report("leavedimdef"); - scopestack.pop(); - } - - @Override - void dimref(SaxEvent nameorsize) throws ParseException { - if (debug) - report("dimref"); - try { - DapDimension dim = null; - DapVariable var = getVariableScope(); - assert var != null : "Internal error"; - - boolean isname = nameorsize.name.equals("name"); - if (isname && isempty(nameorsize)) - throw new ParseException("Dimref: Empty dimension reference name"); - else if (isempty(nameorsize)) - throw new ParseException("Dimref: Empty dimension size"); - if (isname) { - DapGroup dg = var.getGroup(); - if (dg == null) - throw new ParseException("Internal error: variable has no containing group"); - DapGroup grp = var.getGroup(); - if (grp == null) - throw new ParseException("Variable has no group"); - dim = (DapDimension) grp.findByFQN(nameorsize.value, DapSort.DIMENSION); - } else {// Size only is given; presume a number; create unique anonymous dimension - String ssize = nameorsize.value.trim(); - { - // Note that we create it in the root group - assert (root != null); - long anonsize; - try { - anonsize = Long.parseLong(nameorsize.value.trim()); - } catch (NumberFormatException nfe) { - throw new ParseException("Dimref: Illegal dimension size"); - } - dim = root.createAnonymous(anonsize); - } - } - if (dim == null) - throw new ParseException("Unknown dimension: " + nameorsize.value); - var.addDimension(dim); - } catch (DapException de) { - throw new ParseException(de.getMessage(), de.getCause()); - } - } - - @Override - void enteratomicvariable(SaxEvent open, XMLAttributeMap attrs) throws ParseException { - if (debug) - report("enteratomicvariable"); - try { - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Atomicvariable: Empty dimension reference name"); - String typename = open.name; - if ("Byte".equals(typename)) - typename = "UInt8"; // special case - DapType basetype = (DapType) this.root.lookup(typename, DapSort.ENUMERATION, DapSort.ATOMICTYPE); - if (basetype == null) - throw new ParseException("AtomicVariable: Illegal type: " + open.name); - DapVariable var = null; - // Do type substitutions - var = new DapVariable(name.value, basetype); - passReserved(attrs, var); - // Look at the parent scope - DapNode parent = scopestack.peek(); - if (parent == null) - throw new ParseException("Variable has no parent"); - switch (parent.getSort()) { - case DATASET: - case GROUP: - ((DapGroup) parent).addDecl(var); - break; - case VARIABLE: - addField((DapVariable) parent, var); - break; - default: - assert false : "Atomic variable in illegal scope"; - } - scopestack.push(var); - } catch (DapException de) { - throw new ParseException(de); - } - } - - void openclosematch(SaxEvent close, DapSort sort) throws ParseException { - String typename = close.name; - if ("Byte".equals(typename)) - typename = "UInt8"; // special case - switch (sort) { - case VARIABLE: - TypeSort atype = TypeSort.getTypeSort(typename); - DapVariable var = (DapVariable) searchScope(sort); - assert var != null; - TypeSort vartype = var.getBaseType().getTypeSort(); - if (atype == null) - throw new ParseException("Variable: Illegal type: " + typename); - if (atype != vartype) - throw new ParseException(String.format("variable: open/close type mismatch: <%s> ", vartype, atype)); - break; - default: - throw new ParseException("Variable: Illegal type: " + typename); - } - } - - void leavevariable() throws ParseException { - scopestack.pop(); - } - - void leaveatomicvariable(SaxEvent close) throws ParseException { - openclosematch(close, DapSort.VARIABLE); - leavevariable(); - } - - @Override - void enterenumvariable(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("enterenumvariable"); - try { - SaxEvent name = pull(attrs, "name"); - SaxEvent enumtype = pull(attrs, "enum"); - if (isempty(name)) - throw new ParseException("Enumvariable: Empty variable name"); - if (isempty(enumtype)) - throw new ParseException("Enumvariable: Empty enum type name"); - DapEnumeration target = (DapEnumeration) root.findByFQN(enumtype.value, DapSort.ENUMERATION); - if (target == null) - throw new ParseException("EnumVariable: no such enum: " + name.value); - DapVariable var = null; - var = new DapVariable(name.value, target); - passReserved(attrs, var); - // Look at the parent scope - DapNode parent = scopestack.peek(); - if (parent == null) - throw new ParseException("Variable has no parent"); - switch (parent.getSort()) { - case DATASET: - case GROUP: - ((DapGroup) parent).addDecl(var); - break; - case VARIABLE: - addField((DapVariable) parent, var); - break; - default: - assert false : "Atomic variable in illegal scope"; - } - scopestack.push(var); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leaveenumvariable(SaxEvent close) throws ParseException { - if (debug) - report("leaveenumvariable"); - openclosematch(close, DapSort.VARIABLE); - leavevariable(); - } - - @Override - void entermap(SaxEvent name) throws ParseException { - if (debug) - report("entermap"); - if (isempty(name)) - throw new ParseException("Mapref: Empty map name"); - DapVariable var; - try { - var = (DapVariable) root.findByFQN(name.value, DapSort.VARIABLE); - } catch (DapException de) { - throw new ParseException(de); - } - if (var == null) - throw new ParseException("Mapref: undefined variable: " + name.name); - // Verify that this is a legal map => - // 1. it is outside the scope of its parent if the parent - // is a structure. - DapNode container = var.getContainer(); - DapNode scope; - try { - scope = getParentScope(); - } catch (DapException de) { - throw new ParseException(de); - } - if ((container.getSort() == DapSort.STRUCTURE || container.getSort() == DapSort.SEQUENCE) && container == scope) - throw new ParseException("Mapref: map variable not in outer scope: " + name.name); - DapMap map = new DapMap(var); - try { - // Pull the top variable scope - DapVariable parent = (DapVariable) searchScope(DapSort.VARIABLE); - if (parent == null) - throw new ParseException("Variable has no parent: " + var); - parent.addMap(map); - } catch (DapException de) { - throw new ParseException(de); - } - scopestack.push(map); - } - - @Override - void leavemap() throws ParseException { - if (debug) - report("leavemap"); - scopestack.pop(); - } - - @Override - void enterstructurevariable(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("enterstructurevariable"); - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Structure: Empty structure name"); - try { - DapStructure type = null; - DapVariable var = null; - type = new DapStructure(name.value); - passReserved(attrs, type); - var = new DapVariable(name.value, type); - // Look at the parent scope - DapNode parent = scopestack.peek(); - if (parent == null) - throw new ParseException("Variable has no parent"); - switch (parent.getSort()) { - case DATASET: - case GROUP: - ((DapGroup) parent).addDecl(var); - var.getGroup().addDecl(type); - break; - case VARIABLE: - addField((DapVariable) parent, var); - var.getGroup().addDecl(type); - break; - default: - assert false : "Structure variable in illegal scope"; - } - scopestack.push(var); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leavestructurevariable(SaxEvent close) throws ParseException { - if (debug) - report("leavestructurevariable"); - openclosematch(close, DapSort.VARIABLE); - leavevariable(); - } - - @Override - void entersequencevariable(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("entersequencevariable"); - SaxEvent name = pull(attrs, "name"); - if (isempty(name)) - throw new ParseException("Sequence: Empty sequence name"); - try { - DapVariable var = null; - DapType type = null; - type = new DapSequence(name.value); - passReserved(attrs, type); - var = new DapVariable(name.value, type); - // Look at the parent scope - DapNode parent = scopestack.peek(); - if (parent == null) - throw new ParseException("Variable has no parent"); - switch (parent.getSort()) { - case DATASET: - case GROUP: - ((DapGroup) parent).addDecl(var); - var.getGroup().addDecl(type); - break; - case VARIABLE: - addField((DapVariable) parent, var); - var.getGroup().addDecl(type); - break; - default: - assert false : "Structure variable in illegal scope"; - } - scopestack.push(var); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leavesequencevariable(SaxEvent close) throws ParseException { - if (debug) - report("leavesequencevariable"); - openclosematch(close, DapSort.VARIABLE); - leavevariable(); - } - - @Override - void enteratomicattribute(XMLAttributeMap attrs, NamespaceList nslist) throws ParseException { - if (debug) - report("enteratomicattribute"); - try { - DapNode parent = getMetadataScope(); - DapAttribute attr = null; - attr = createatomicattribute(attrs, nslist, parent); - scopestack.push(attr); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leaveatomicattribute() throws ParseException { - if (debug) - report("leaveatomicattribute"); - DapAttribute attr = (DapAttribute) scopestack.pop(); - // Ensure that the attribute has at least one value - if (java.lang.reflect.Array.getLength(attr.getValues()) == 0) - throw new ParseException("AtomicAttribute: attribute has no values"); - } - - @Override - void entercontainerattribute(XMLAttributeMap attrs, NamespaceList nslist) throws ParseException { - if (debug) - report("entercontainerattribute"); - try { - DapNode parent = getMetadataScope(); - DapAttribute attr = null; - attr = createcontainerattribute(attrs, nslist, parent); - scopestack.push(attr); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void leavecontainerattribute() throws ParseException { - if (debug) - report("leavecontainerattribute"); - scopestack.pop(); - } - - /** - * This is called for ... - * - * @param value - * @throws ParseException - */ - @Override - void value(String value) throws ParseException { - if (debug) - report("value"); - try { - DapAttribute parent = (DapAttribute) getScope(DapSort.ATTRIBUTE); - createvalue(value, parent); - } catch (DapException de) { - throw new ParseException(de); - } - } - - /** - * This is called for - * - * @param value - * @throws ParseException - */ - @Override - void value(SaxEvent value) throws ParseException { - if (debug) - report("value"); - try { - DapAttribute parent = (DapAttribute) getScope(DapSort.ATTRIBUTE); - createvalue(value, parent); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - void otherxml(XMLAttributeMap attrs, DapXML root) throws ParseException { - if (debug) - report("enterotherxml"); - try { - DapNode parent = getMetadataScope(); - DapOtherXML other = createotherxml(attrs, parent); - parent.setAttribute(other); - other.setRoot(root); - if (debug) - report("leaveotherxml"); - } catch (DapException de) { - throw new ParseException(de); - } - } - - @Override - DapXML.XMLList xml_body(DapXML.XMLList body, DapXML elemortext) throws ParseException { - if (debug) - report("xml_body.enter"); - if (body == null) - body = new DapXML.XMLList(); - if (elemortext != null) - body.add(elemortext); - if (debug) - report("xml_body.exit"); - return body; - } - - @Override - DapXML element_or_text(SaxEvent open, XMLAttributeMap map, DapXML.XMLList body, SaxEvent close) - throws ParseException { - try { - if (debug) - report("element_or_text.enter"); - if (!open.name.equalsIgnoreCase(close.name)) - throw new ParseException(String.format("OtherXML: mismatch: <%s> vs ", open.name, close.name)); - DapXML thisxml = createxmlelement(open, map); - for (DapXML xml : body) { - thisxml.addElement(xml); - } - if (debug) - report("element_or_text.exit"); - return thisxml; - } catch (DapException e) { - throw new ParseException(e); - } - } - - @Override - DapXML xmltext(SaxEvent text) throws ParseException { - try { - if (debug) - report("xmltext"); - DapXML txt = createxmltext(text.text); - return txt; - } catch (DapException e) { - throw new ParseException(e); - } - } - - @Override - void entererror(XMLAttributeMap attrs) throws ParseException { - if (debug) - report("entererror"); - SaxEvent xhttpcode = pull(attrs, "httpcode"); - String shttpcode = (xhttpcode == null ? "400" : xhttpcode.value); - int httpcode = 0; - try { - httpcode = Integer.parseInt(shttpcode); - } catch (NumberFormatException nfe) { - throw new ParseException("Error Response; illegal http code: " + shttpcode); - } - this.errorresponse = new ErrorResponse(); - this.errorresponse.setCode(httpcode); - } - - @Override - void leaveerror() throws ParseException { - if (debug) - report("leaveerror"); - assert (this.errorresponse != null) : "Internal Error"; - } - - @Override - void errormessage(String value) throws ParseException { - if (debug) - report("errormessage"); - assert (this.errorresponse != null) : "Internal Error"; - String message = value; - message = Escape.entityUnescape(message); // Remove XML encodings - this.errorresponse.setMessage(message); - } - - @Override - void errorcontext(String value) throws ParseException { - if (debug) - report("errorcontext"); - assert (this.errorresponse != null) : "Internal Error"; - String context = value; - context = Escape.entityUnescape(context); // Remove XML encodings - this.errorresponse.setContext(context); - } - - @Override - void errorotherinfo(String value) throws ParseException { - if (debug) - report("errorotherinfo"); - assert (this.errorresponse != null) : "Internal Error"; - String other = value; - other = Escape.entityUnescape(other); // Remove XML encodings - this.errorresponse.setOtherInfo(other); - } - - @Override - String textstring(String prefix, SaxEvent text) throws ParseException { - if (debug) - report("text"); - if (prefix == null) - return text.text; - else - return prefix + text.text; - } - - ////////////////////////////////////////////////// - // Utilities - - void addField(DapVariable instance, DapVariable field) throws DapException { - DapType t = instance.getBaseType(); - switch (t.getTypeSort()) { - case Structure: - case Sequence: - ((DapStructure) t).addField(field); - field.setParent(instance); - break; - default: - assert false : "Container cannot be atomic variable"; - } - } - - void report(String action) { - getDebugStream().println("ACTION: " + action); - getDebugStream().flush(); - } - - static boolean isReserved(String name) { - for (String tag : RESERVEDTAGS) { - if (name.startsWith(tag)) - return true; - } - return false; - } -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Token.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Token.java deleted file mode 100644 index 5fb23a9334..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4Token.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -public class Dap4Token extends SaxEvent { - - public Dap4Token() {} - -} // class Dap4Token - diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Debug.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Debug.java deleted file mode 100644 index e3346eab08..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Debug.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import dap4.core.dmr.parser.ParseUtil; -import dap4.core.util.Escape; -import java.util.Map; - -public abstract class Debug { - - static void addtext(StringBuilder dst, String txt, int flags) { - int len; - int pos; - boolean shortened = false; - - if (txt == null) { - dst.append("null"); - return; - } - if ((flags & ParseUtil.FLAG_TRIMTEXT) != 0) { - txt = txt.trim(); - } - len = txt.length(); - if ((flags & ParseUtil.FLAG_ELIDETEXT) != 0 && len > ParseUtil.MAXTEXT) { - len = ParseUtil.MAXTEXT; - shortened = true; - } - dst.append('|'); - for (int i = 0; i < txt.length(); i++) { - char c = txt.charAt(i); - if (len-- <= 0) - continue; - if ((flags & ParseUtil.FLAG_ESCAPE) != 0 && c < ' ') { - dst.append('\\'); - switch (c) { - case '\n': - dst.append('n'); - break; - case '\r': - dst.append('r'); - break; - case '\f': - dst.append('f'); - break; - case '\t': - dst.append('t'); - break; - default: {// convert to octal - int uc = c; - int oct; - oct = ((uc >> 6) & 077); - dst.append((char) ('0' + oct)); - oct = ((uc >> 3) & 077); - dst.append((char) ('0' + oct)); - oct = ((uc) & 077); - dst.append((char) ('0' + oct)); - } - break; - } - } else if ((flags & ParseUtil.FLAG_NOCR) != 0 && c == '\r') { - continue; - } else { - dst.append((char) c); - } - } - if (shortened) { - dst.append("..."); - } - dst.append('|'); - } - - // Trace a SAX Token - public static String trace(SaxEvent token) { - return trace(token, ParseUtil.DEFAULTFLAGS); - } - - public static String trace(SaxEvent token, int flags) { - StringBuilder result = new StringBuilder(); - String name = "UNDEFINED"; - String value = ""; - String text = ""; - SaxEventType event = null; - - name = token.name; - value = token.value; - text = token.text; - event = token.eventtype; - - result.append("[" + event.name() + "] "); - - switch (event) { - case STARTELEMENT: - case ENDELEMENT: - result.append(": element=|"); - result.append(name); - result.append("|"); - break; - case CHARACTERS: - result.append(" text="); - addtext(result, text, flags); - String trans = Escape.entityUnescape(text); - result.append(" translation="); - addtext(result, trans, flags); - break; - case ATTRIBUTE: - result.append(": name="); - addtext(result, name, flags); - result.append(" value="); - addtext(result, value, flags); - break; - case STARTDOCUMENT: - break; - case ENDDOCUMENT: - break; - default: - assert (false) : "Unexpected tokentype"; - } - result.append(" eventtype=" + event.name()); - return result.toString(); - } - - static String traceList(Dap4Actions.XMLAttributeMap map) { - StringBuilder result = new StringBuilder(); - for (Map.Entry entry : map.entrySet()) { - SaxEvent event = entry.getValue(); - String trace = trace(event); - if (result.length() != 0) - result.append("\n"); - result.append(entry.getKey()); - result.append(": "); - result.append(trace); - } - return result.toString(); - } - - -}// Debug diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/LexException.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/LexException.java deleted file mode 100644 index 714dd2acc4..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/LexException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1998 - 2010. University Corporation for Atmospheric Research/Unidata - * Portions of this software were developed by the Unidata Program at the - * University Corporation for Atmospheric Research. - * - * Access and use of this software shall impose the following obligations - * and understandings on the user. The user is granted the right, without - * any fee or cost, to use, copy, modify, alter, enhance and distribute - * this software, and any derivative works thereof, and its supporting - * documentation for any purpose whatsoever, provided that this entire - * notice appears in all copies of the software, derivative works and - * supporting documentation. Further, UCAR requests that the user credit - * UCAR/Unidata in any publications that result from the use of this - * software or in any product that includes this software. The names UCAR - * and/or Unidata, however, may not be used in any advertising or publicity - * to endorse or promote any products or commercial entity unless specific - * written permission is obtained from UCAR/Unidata. The user also - * understands that UCAR/Unidata is not obligated to provide the user with - * any support, consulting, training or assistance of any kind with regard - * to the use, operation and performance of this software nor to provide - * the user with any updates, revisions, new versions or "bug fixes." - * - * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -////////////////////////////////////////////////// - -package dap4.core.dmr.parser.bison; - -public class LexException extends java.lang.Exception { - public LexException(String msg) { - super(msg); - } - - public LexException(Throwable e) { - super(e); - } - - public LexException(String msg, Throwable e) { - super(msg, e); - } -} diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Lexeme.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Lexeme.java deleted file mode 100644 index 985b99dbc1..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/Lexeme.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -public class Lexeme { - public String name; // element or attribute name - public int open; // Bison token for element open - public int close; // Bison token for element close - public int atoken; // Bison token if this is an attribute - public String[] legalAttributes; /* not currently used */ - - public Lexeme(String name, int atoken) { - this(name, 0, 0, atoken, null); - } - - public Lexeme(String name, int open, int close) { - this(name, open, close, 0, null); - } - - public Lexeme(String name, int open, int close, String[] alist) { - this(name, open, close, 0, alist); - } - - public Lexeme(String name, int open, int close, int atoken, String[] alist) { - this.name = name; - this.open = open; - this.close = close; - this.atoken = atoken; - legalAttributes = alist; - } - - public void attribute(String[] alist) { - legalAttributes = alist; - // check for duplicates - for (int i = 0; i < legalAttributes.length; i++) { - for (int j = i + 1; j < legalAttributes.length; j++) - assert (!legalAttributes[i].equals(legalAttributes[j])); - } - } - - public String toString() { - StringBuilder text = new StringBuilder(); - text.append(String.format("%s open=%d close=%d a=%d", name, open, close, atoken)); - if (legalAttributes != null && legalAttributes.length > 0) { - text.append(" attributes="); - for (String s : legalAttributes) { - text.append(" "); - text.append(s); - } - } - return text.toString(); - } -} // class Lexeme diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEvent.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEvent.java deleted file mode 100644 index 3d5e139a21..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import org.xml.sax.Locator; - -/** - * Define a class to hold information provided to each kind of eventtype - */ -public class SaxEvent { - public SaxEventType eventtype = null; - public String name = null; - public String fullname = null; - public String namespace = null; - - public String value = null; // for attributes - public String text = null; // for text - - // public String publicid = null; - // public String systemid = null; - - // Coverity[FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD] - public Locator locator = null; - - public SaxEvent() {} - - public SaxEvent(SaxEventType eventtype, Locator locator) { - this.eventtype = eventtype; - this.locator = locator; - } - - public SaxEvent(SaxEventType eventtype, Locator locator, String name) { - this(eventtype, locator); - this.name = name; - } - - public SaxEvent(SaxEventType eventtype, Locator locator, String name, String fullname, String uri) { - this(eventtype, locator, name); - this.fullname = fullname; - this.namespace = uri; - } - - public String toString() { - StringBuilder text = new StringBuilder(); - if (eventtype == null) - text.append("notype"); - else - text.append(eventtype.toString()); - text.append(" "); - if (fullname != null) - text.append(fullname); - else if (name != null) - text.append(name); - else - text.append("noname"); - if (value != null) { - text.append(" = "); - text.append(value); - } - if (this.text != null) { - text.append(" = "); - text.append(this.text); - } - return text.toString(); - } - -} // class SaxEvent - diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventHandler.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventHandler.java deleted file mode 100644 index 418837c52c..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventHandler.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -import javax.xml.XMLConstants; -import org.xml.sax.*; -import org.xml.sax.helpers.DefaultHandler; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; - -public abstract class SaxEventHandler extends DefaultHandler { - ////////////////////////////////////////////////// - // Constants - - static boolean TRACE = false; - - static Charset UTF8 = Charset.forName("UTF-8"); - - static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; - - ////////////////////////////////////////////////// - // static types - - ////////////////////////////////////////////////// - // static fields - - ////////////////////////////////////////////////// - // Instance variables - - protected String document = null; - - // Sax parser state - protected Locator locator = null; - protected SAXParserFactory spf = null; - protected SAXParser saxparser = null; - protected ByteArrayInputStream input = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public SaxEventHandler() { - - } - - ////////////////////////////////////////////////// - // Abstract method(s) - - // Send the lexeme to the the subclass to process - public abstract void yyevent(SaxEvent token) throws SAXException; - - ////////////////////////////////////////////////// - // Get/Set - public Locator getLocator() { - return this.locator; - } - ////////////////////////////////////////////////// - // Public API - - public boolean parse(String document) throws SAXException { - // Trim and strip any leading - StringBuilder doc = new StringBuilder(document.trim()); - int index = doc.indexOf(""); - if (index < 0) - throw new SAXException("Document has malformed prefix"); - doc.delete(0, index + 2); - // remove any leading crlf - while (doc.length() > 0 && "\r\n".indexOf(doc.charAt(0)) >= 0) - doc.deleteCharAt(0); - document = doc.toString(); - } - this.document = document; - // Create the sax parser that will drive us with events - try { - spf = SAXParserFactory.newInstance(); - spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - spf.setValidating(false); - spf.setNamespaceAware(true); - spf.setFeature(LOAD_EXTERNAL_DTD, false); - saxparser = spf.newSAXParser(); - // Set up for the parse - input = new ByteArrayInputStream(document.getBytes(UTF8)); - saxparser.parse(input, this); // 'this' is link to subclass parser - return true; - } catch (Exception e) { - throw new SAXException(e); - } - } - - ////////////////////////////////////////////////// - // DefaultHandler Overrides - - // We feed only a subset of the possible events into - // the subclass handler. This can be changed by - // overriding the suppressing eventtype handlers below. - - @Override - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - @Override - public void startDocument() throws SAXException { - SaxEvent token = new SaxEvent(SaxEventType.STARTDOCUMENT, locator); - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - } - - @Override - public void endDocument() throws SAXException { - SaxEvent token = new SaxEvent(SaxEventType.ENDDOCUMENT, locator); - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - } - - @Override - public void startElement(String nsuri, String name, String qualname, Attributes attributes) throws SAXException { - SaxEvent token = new SaxEvent(SaxEventType.STARTELEMENT, locator, name, qualname, nsuri); - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - // Now pass the attributes as tokens - int nattr = attributes.getLength(); - for (int i = 0; i < nattr; i++) { - String aname = attributes.getLocalName(i); - if ("".equals(aname)) - aname = attributes.getQName(i); - String value = attributes.getValue(i); - token = new SaxEvent(SaxEventType.ATTRIBUTE, locator, aname); - token.value = value; - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - } - } - - @Override - public void endElement(String nsuri, String name, String qualname) throws SAXException { - SaxEvent token = new SaxEvent(SaxEventType.ENDELEMENT, locator, name, qualname, nsuri); - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - SaxEvent token = new SaxEvent(SaxEventType.CHARACTERS, locator); - token.text = new String(ch, start, length); - if (TRACE) - trace("eventtype.%s: %s%n", token.eventtype.name(), token.toString()); - locatedEvent(token); - } - - // Following events are suppressed - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - // should never see this since not validating - return; - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - return; - } - - @Override - public void notationDecl(String name, String publicId, String systemId) throws SAXException { - return; - } - - @Override - public void processingInstruction(String target, String data) throws SAXException { - return; - } - - @Override - public void skippedEntity(String name) throws SAXException { - return; - } - - @Override - public void startPrefixMapping(String prefix, String uri) throws SAXException { - return; - } - - @Override - public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) - throws SAXException { - return; - } - - ////////////////////////////////////////////////// - // Entity resolution (Ignored) - - @Override - public InputSource resolveEntity(String publicId, String systemId) { - if (TRACE) - trace("eventtype.RESOLVEENTITY: %s.%s%n", publicId, systemId); - return null; - } - - ////////////////////////////////////////////////// - // Error handling Events - - @Override - public void fatalError(SAXParseException e) throws SAXException { - throw new SAXParseException(String.format("Sax fatal error: %s; %s%n", e, report(this.locator)), this.locator); - } - - @Override - public void error(SAXParseException e) throws SAXException { - System.err.printf("Sax error: %s; %s%n", e, report(this.locator)); - } - - @Override - public void warning(SAXParseException e) throws SAXException { - System.err.printf("Sax warning: %s; %s%n", e, report(this.locator)); - } - - protected String report(Locator locator) { - int lineno = locator.getLineNumber(); - int colno = locator.getColumnNumber(); - String text = this.document; - String[] lines = text.split("[\n]"); - for (int i = lines.length; i <= lineno + 1; i++) { - // Coverity[FB.SBSC_USE_STRINGBUFFER_CONCATENATION] - text = text + " \n"; - } - lines = text.split("[\n]"); - String msg; - try { - msg = lines[lineno]; - while (msg.length() <= colno) { - msg = msg + ' '; - } - msg = msg.substring(0, colno) + '^' + msg.substring(colno, msg.length()); - msg = locator.toString() + '|' + msg + '|'; - } catch (ArrayIndexOutOfBoundsException t) { - msg = locator.toString(); - } - return msg; - } - - - ////////////////////////////////////////////////// - // Location printing - - protected void locatedEvent(SaxEvent token) throws SAXException { - try { - yyevent(token); - } catch (SAXException se) { - throw new SAXException(locatedError(se.getMessage())); - } - } - - - protected String locatedError(String msg) { - String locmsg = - msg + String.format("; near %d::%d%n", this.locator.getLineNumber(), this.locator.getColumnNumber()); - return locmsg; - } - - - protected void trace(String msg, Object... args) { - if (TRACE) - System.err.printf(locatedError(String.format(msg, args))); - } - -} // class SaxEventHandler diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventType.java b/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventType.java deleted file mode 100644 index 8d4eb953d1..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/bison/SaxEventType.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.dmr.parser.bison; - -/** - * Provide an enumeration to mark all the possible Sax Parser - * generated events (except error events) - */ - -/** - * This should be essentially 1-1 for all the handler callbacks. - * Exceptions: TBD - */ - -public enum SaxEventType { - CHARACTERS, ENDDOCUMENT, ENDELEMENT, ENDPREFIXMAPPING, IGNORABLEWHITESPACE, NOTATIONDECL, PROCESSINGINSTRUCTION, SETDOCUMENTLOCATOR, SKIPPEDENTITY, STARTDOCUMENT, STARTELEMENT, STARTPREFIXMAPPING, UNPARSEDENTITYDECL, - // Following is added to support each attribute as an eventtype - ATTRIBUTE; -}; // enum SaxEventType diff --git a/dap4/d4core/src/main/java/dap4/core/util/Index.java b/dap4/d4core/src/main/java/dap4/core/util/Index.java deleted file mode 100644 index 9a1049e527..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/util/Index.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.util; - -import java.util.Arrays; - -public class Index { - public static final Index SCALAR = new Index(0); - - public int rank; - public long[] indices; // allow direct access - public long[] dimsizes; // allow direct access - - ////////////////////////////////////////////////// - // Constructor(s) - - public Index(int rank) { - this.rank = rank; - this.dimsizes = new long[rank]; - indices = new long[rank]; - if (this.rank > 0) { - Arrays.fill(indices, 0); - Arrays.fill(dimsizes, 0); - } - } - - public Index(Index index) { - this(index.getRank()); - if (this.rank > 0) { - System.arraycopy(index.indices, 0, this.indices, 0, this.rank); - System.arraycopy(index.dimsizes, 0, this.dimsizes, 0, this.rank); - } - } - - public Index(long[] indices, long[] dimsizes) { - this(dimsizes.length); - if (this.rank > 0) { - System.arraycopy(indices, 0, this.indices, 0, this.rank); - System.arraycopy(dimsizes, 0, this.dimsizes, 0, this.rank); - } - } - - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append('['); - for (int i = 0; i < this.rank; i++) { - if (i > 0) - buf.append(','); - buf.append(indices[i]); - buf.append('/'); - buf.append(dimsizes[i]); - } - buf.append("]("); - buf.append(this.index()); - buf.append(")"); - return buf.toString(); - } - - - /** - * Compute the linear index - * from the current odometer indices. - */ - public long index() { - long offset = 0; - for (int i = 0; i < this.indices.length; i++) { - offset *= this.dimsizes[i]; - offset += this.indices[i]; - } - return offset; - } - - public int getRank() { - return this.rank; - } - - public long get(int i) { - if (i < 0 || i >= this.rank) - throw new IllegalArgumentException(); - return this.indices[i]; - } - - public long getSize(int i) { - if (i < 0 || i >= this.rank) - throw new IllegalArgumentException(); - return this.dimsizes[i]; - } - - public boolean isScalar() { - return (rank == 0 && indices.length == 1 && index() == 1); - } - - -} diff --git a/dap4/d4core/src/main/java/dap4/core/util/MultiOdometer.java b/dap4/d4core/src/main/java/dap4/core/util/MultiOdometer.java deleted file mode 100644 index 99c82ada73..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/util/MultiOdometer.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.util; - -import dap4.core.dmr.DapDimension; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * An odometer capable of dealing with a Multi-slices. - */ - -public class MultiOdometer extends Odometer { - - protected static boolean DEBUG = false; - - ////////////////////////////////////////////////// - // Instance variables - - protected int current; // pointers into multslice list - protected long[] sizes; // # of subslices in each slice - protected List> slicesets; // Set of all combinations of slices - protected List odomset; // Odometers created from slicesets - - ////////////////////////////////////////////////// - // Constructor(s) - - public MultiOdometer() {} - - public MultiOdometer(List set) throws DapException { - this(set, null); - } - - public MultiOdometer(List set, List dimset) throws DapException { - super(set, dimset); - super.ismulti = true; - this.sizes = new long[this.rank]; - this.odomset = new ArrayList<>(); - for (int i = 0; i < this.rank; i++) { - Slice sl = set.get(i); - List subslices = sl.getSubSlices(); - this.sizes[i] = subslices.size(); - } - int truerank = this.rank; - if (truerank == 0) { - this.slicesets = null; - this.odomset = null; - } else { - PowerSet ps = new PowerSet(this.sizes); - long pssize = ps.getTotalSize(); - long[][] setindices = ps.getPowerSet(); - assert setindices.length == pssize; - this.slicesets = new ArrayList<>(); - if (DEBUG) { - System.err.printf("Multi: |slicesets| = %d%n", setindices.length); - System.err.println(ps.toString()); - } - // Create set of slicsets comprising this MultiOdometer - for (int i = 0; i < pssize; i++) { - long[] indexset = setindices[i]; - assert indexset.length == truerank; - // Pick out the desired set of slices - List subset = new ArrayList<>(); - for (int j = 0; j < this.rank; j++) { - Slice s0 = set.get(j); - Slice ss = s0.getSubSlice((int) indexset[j]); - subset.add(ss); - } - this.slicesets.add(subset); - } - assert this.slicesets.size() == pssize; - // Create set of odometers comprising this MultiOdometer - for (int i = 0; i < pssize; i++) { - Odometer sslodom = Odometer.factory(this.slicesets.get(i), dimset); - this.odomset.add(sslodom); - } - } - this.current = 0; - } - - ////////////////////////////////////////////////// - - @Override - public String toString() { - StringBuilder buf = new StringBuilder(); - for (int i = 0; i < rank; i++) { - Slice s = slice(i); - if (i == current) - buf.append("*"); - buf.append(s.toString()); - buf.append(String.format("(%d)", s.getCount())); - } - return buf.toString(); - } - - ////////////////////////////////////////////////// - // Iterator API Overrides - - @Override - public boolean hasNext() { - if (this.current >= odomset.size()) - return false; - Odometer ocurrent = odomset.get(this.current); - if (ocurrent.hasNext()) - return true; - // Try to move to next odometer - this.current++; - return hasNext(); - } - - @Override - public Index next() { - if (this.current >= odomset.size()) - throw new NoSuchElementException(); - Odometer ocurrent = odomset.get(this.current); - assert ocurrent.hasNext(); - return ocurrent.next(); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * Compute the total number of elements. - */ - @Override - public long totalSize() { - long size = 1; - for (int i = 0; i < this.rank; i++) { - size *= slice(i).getCount(); - } - return size; - } - - @Override - public List getSubOdometers() { - return this.odomset; - } - -} diff --git a/dap4/d4core/src/main/java/dap4/core/util/Odometer.java b/dap4/d4core/src/main/java/dap4/core/util/Odometer.java deleted file mode 100644 index bccd69e1f5..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/util/Odometer.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.util; - -import dap4.core.dmr.DapDimension; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * A classic implementation of an odometer - * taken from the netcdf-c code. - * Extended to provide iterator interface - */ - -public class Odometer implements Iterator { - - ////////////////////////////////////////////////// - // Constants - - // Mnemonic - - protected static enum STATE { - INITIAL, STARTED, DONE; - } - - ////////////////////////////////////////////////// - // factories - - public static Odometer factoryScalar() { - return new ScalarOdometer(); - } - - public static Odometer factory(List slices) throws DapException { - return factory(slices, null); - } - - public static Odometer factory(List slices, List dimset) throws DapException { - // check for scalar case - if (dimset != null && dimset.size() == 0) { - if (!DapUtil.isScalarSlices(slices)) - throw new DapException("Cannot build scalar odometer with non-scalar slices"); - return factoryScalar(); - } - boolean multi = false; - if (slices != null) { - for (int i = 0; i < slices.size(); i++) { - if (slices.get(i).getSort() == Slice.Sort.Multi) { - multi = true; - break; - } - } - } - if (slices == null || slices.size() == 0) - return factoryScalar(); - else if (multi) - return new MultiOdometer(slices, dimset); - else - return new Odometer(slices, dimset); - } - - ////////////////////////////////////////////////// - // Instance variables - - protected STATE state = STATE.INITIAL; - - protected boolean ismulti = false; - - protected int rank = 0; - protected List slices = null; - protected List dimset = null; - - // The current odometer indices - protected Index index; - - // precompute this.slices[i].getLast() - this.slices[i].getStride() - protected long[] endpoint; - - ////////////////////////////////////////////////// - // Constructor(s) - - public Odometer() {} - - public Odometer(List set) throws DapException { - this(set, null); - } - - public Odometer(List set, List dimset) throws DapException { - if (set == null) - throw new DapException("Null slice list"); - if (dimset != null && set.size() != dimset.size()) - throw new DapException("Rank mismatch"); - this.rank = set.size(); - if (this.rank == 0) - throw new DapException("Rank == 0; use Scalar Odometer"); - this.slices = new ArrayList<>(); - this.slices.addAll(set); - if (dimset != null) { - this.dimset = new ArrayList<>(); - this.dimset.addAll(dimset); - } - this.endpoint = new long[this.rank]; - this.index = new Index(rank); - for (int i = 0; i < this.rank; i++) { - this.index.dimsizes[i] = slices.get(i).getMax(); - } - reset(); - } - - protected void reset() { - for (int i = 0; i < this.rank; i++) { - try { - slices.get(i).finish(); - this.index.indices[i] = this.slices.get(i).getFirst(); - this.endpoint[i] = this.slices.get(i).getLast() - this.slices.get(i).getStride(); - } catch (DapException de) { - throw new IllegalArgumentException(de); - } - } - } - - public String toString() { - StringBuilder buf = new StringBuilder(); - for (int i = 0; i < rank; i++) { - if (i > 0) - buf.append(","); - if (dimset != null) - buf.append(dimset.get(i) != null ? dimset.get(i).getShortName() : "null"); - buf.append(this.slices.get(i).toString()); - buf.append(String.format("(%d)", this.slices.get(i).getCount())); - if (this.index != null) - buf.append(String.format("@%d", this.index.indices[i])); - } - return buf.toString(); - } - - ////////////////////////////////////////////////// - // Odometer API - - /** - * Return odometer rank - */ - public int rank() { - return this.rank; - } - - /** - * Return ith slice - */ - public Slice slice(int i) { - if (i < 0 || i >= this.rank) - throw new IllegalArgumentException(); - return this.slices.get(i); - } - - - public List getSlices() { - return this.slices; - } - - /** - * Compute the linear index - * from the current odometer indices. - */ - public long index() { - return index.index(); - } - - /** - * Return current set of indices - */ - public Index indices() { - return this.index; - } - - /** - * Compute the total number of elements. - */ - public long totalSize() { - long size = 1; - for (int i = 0; i < this.rank; i++) { - size *= this.slices.get(i).getCount(); - } - return size; - } - - ////////////////////////////////////////////////// - // Iterator API - - @Override - public boolean hasNext() { - int stop = this.rank; - switch (this.state) { - case INITIAL: - return true; - case STARTED: - int i; - for (i = stop - 1; i >= 0; i--) { // walk backwards - if (this.index.indices[i] <= this.endpoint[i]) - return true; - } - this.state = STATE.DONE; - break; - case DONE: - } - return false; - } - - @Override - public Index next() { - int i; - int lastpos = this.rank; - int firstpos = 0; - switch (this.state) { - case INITIAL: - this.state = STATE.STARTED; - break; - case STARTED: - i = step(firstpos, lastpos); - if (i < 0) - this.state = STATE.DONE; - break; - case DONE: - break; - } - if (this.state == STATE.DONE) - throw new NoSuchElementException(); - return indices(); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - ////////////////////////////////////////////////// - - // on entry: indices are the last index set - // on exit, the indices are the next value - // return index of place where we have room to step; - // return -1 if we have completed. - public int step(int firstpos, int lastpos) { - for (int i = lastpos - 1; i >= firstpos; i--) { // walk backwards - if (this.index.indices[i] > this.endpoint[i]) - this.index.indices[i] = this.slices.get(i).getFirst(); // reset this position - else { - this.index.indices[i] += this.slices.get(i).getStride(); // move to next indices - return i; - } - } - return -1; - } - - public List getSubOdometers() { - List list = new ArrayList<>(); - list.add(this); - return list; - } - - public boolean isMulti() { - return this.ismulti; - } - - -} diff --git a/dap4/d4core/src/main/java/dap4/core/util/ScalarOdometer.java b/dap4/d4core/src/main/java/dap4/core/util/ScalarOdometer.java deleted file mode 100644 index bafc9a5436..0000000000 --- a/dap4/d4core/src/main/java/dap4/core/util/ScalarOdometer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.core.util; - -import java.util.NoSuchElementException; - -/** - * A implementation of an odometer for scalar variables. - */ - -public class ScalarOdometer extends Odometer { - ////////////////////////////////////////////////// - // Constants - - public ScalarOdometer() { - this.state = STATE.INITIAL; - this.index = new Index(0); - this.slices = Slice.SCALARSLICES; - } - - public long index() { - return 0; - } - - public long totalSize() { - return 1; - } - - public boolean hasNext() { - return this.state != STATE.DONE; - } - - public Index next() { - if (this.state == STATE.DONE) - throw new NoSuchElementException(); - this.state = STATE.DONE; - return Index.SCALAR; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - -} diff --git a/dap4/d4lib/build.gradle b/dap4/d4lib/build.gradle deleted file mode 100644 index 0c84380c55..0000000000 --- a/dap4/d4lib/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -apply from: "$rootDir/gradle/any/dependencies.gradle" -apply from: "$rootDir/gradle/any/java-library.gradle" - -dependencies { - api enforcedPlatform(project(':netcdf-java-platform')) - - compile project(':dap4:d4core') - compile project(':httpservices') - compile project(':netcdf4') - - compile 'org.apache.httpcomponents:httpclient' - compile 'org.apache.httpcomponents:httpcore' - compile 'net.java.dev.jna:jna' - compile 'com.beust:jcommander' - compile 'org.slf4j:slf4j-api' -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractCursor.java b/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractCursor.java deleted file mode 100644 index c98c51c763..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractCursor.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DapNode; -import dap4.core.dmr.DapStructure; -import dap4.core.dmr.DapType; -import dap4.core.dmr.DapVariable; -import dap4.core.util.DapException; -import dap4.core.util.DapSort; -import dap4.core.util.Index; -import dap4.core.util.Slice; -import java.util.List; - -public abstract class AbstractCursor implements DataCursor { - ////////////////////////////////////////////////// - // Constants - - ////////////////////////////////////////////////// - // Instance Variables - - protected Scheme scheme; - - protected DSP dsp; - protected DapNode template; - - protected Index arrayindex = null; - protected long recordindex = -1; // scheme == record - - protected AbstractCursor container = null; - - protected long recordcount = -1; - - ////////////////////////////////////////////////// - // Constructor(s) - - public AbstractCursor(Scheme scheme, DSP dsp, DapNode template, AbstractCursor container) { - setScheme(scheme); - setDSP(dsp); - setTemplate(template); - setContainer(container); - } - - public AbstractCursor(AbstractCursor orig) { - this(orig.getScheme(), orig.getDSP(), orig.getTemplate(), (AbstractCursor) orig.getContainer()); - } - - - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append(getScheme().toString()); - if (getScheme() == Scheme.STRUCTARRAY || getScheme() == Scheme.SEQARRAY) - buf.append("[]"); - buf.append(":"); - buf.append(getTemplate().toString()); - if (this.arrayindex != null) { - buf.append("::"); - buf.append(this.arrayindex.toString()); - } - if (this.recordindex >= 0) { - buf.append("*"); - buf.append(this.recordindex); - } - return buf.toString(); - } - - ////////////////////////////////////////////////// - // Unimplemented DataCursor API methods - - @Override - public abstract Object read(List slices) throws DapException; - - @Override - public abstract Object read(Index index) throws DapException; - - @Override - public abstract AbstractCursor readRecord(long i) throws DapException; - - @Override - public abstract AbstractCursor readField(int fieldindex) throws DapException; - - ////////////////////////////////////////////////// - // Selected DataCursor API overrides - - @Override - public int fieldIndex(String name) throws DapException { - DapStructure ds; - if (getTemplate().getSort().isCompound()) - ds = (DapStructure) getTemplate(); - else if (getTemplate().getSort().isVar() && (((DapVariable) getTemplate()).getBaseType().getSort().isCompound())) - ds = (DapStructure) ((DapVariable) getTemplate()).getBaseType(); - else - throw new DapException("Attempt to get field name on non-compound object"); - int i = ds.indexByName(name); - if (i < 0) - throw new DapException("Unknown field name: " + name); - return i; - } - - @Override - public Scheme getScheme() { - return this.scheme; - } - - @Override - public DSP getDSP() { - return this.dsp; - } - - @Override - public DapNode getTemplate() { - return this.template; - } - - @Override - public Index getIndex() throws DapException { - if (this.scheme != Scheme.STRUCTURE && this.scheme != Scheme.SEQUENCE) - throw new DapException("Not a Sequence|Structure instance"); - return this.arrayindex; - } - - @Override - public long getRecordIndex() throws DapException { - if (this.scheme != Scheme.RECORD) - throw new DapException("Not a Record instance"); - return this.recordindex; - } - - @Override - public long getRecordCount() throws DapException { - if (this.scheme != Scheme.SEQUENCE) - throw new DapException("Not a SEQUENCE instance"); - return this.recordcount; - } - - - @Override - public AbstractCursor getContainer() { - return this.container; - } - - @Override - public boolean isScalar() { - if (getTemplate().getSort().isVar()) { - return ((DapVariable) getTemplate()).getRank() == 0; - } else - return false; - } - - public boolean isField() { - return getTemplate().getContainer() != null; - } - - public boolean isAtomic() { - boolean is = this.scheme == Scheme.ATOMIC; - assert !is || getTemplate().getSort() == DapSort.ATOMICTYPE || (getTemplate().getSort() == DapSort.VARIABLE - && ((DapVariable) getTemplate()).getBaseType().getTypeSort().isAtomic()); - return is; - } - - public boolean isCompound() { - boolean is = (this.scheme == Scheme.SEQUENCE || this.scheme == Scheme.STRUCTURE); - assert !is || getTemplate().getSort() == DapSort.SEQUENCE || getTemplate().getSort() == DapSort.STRUCTURE - || (getTemplate().getSort() == DapSort.VARIABLE - && ((DapVariable) getTemplate()).getBaseType().getTypeSort().isCompoundType()); - return is; - } - - public boolean isCompoundArray() { - boolean is = (this.scheme == Scheme.SEQARRAY || this.scheme == Scheme.STRUCTARRAY); - assert !is || getTemplate().getSort() == DapSort.SEQUENCE || getTemplate().getSort() == DapSort.STRUCTURE - || (getTemplate().getSort() == DapSort.VARIABLE - && ((DapVariable) getTemplate()).getBaseType().getTypeSort().isCompoundType()); - return is; - } - - ////////////////////////////////////////////////// - // AbstractCursor extensions - - public AbstractCursor setIndex(Index index) { - this.arrayindex = index; - return this; - } - - public AbstractCursor setRecordIndex(long index) { - this.recordindex = index; - return this; - } - - public AbstractCursor setRecordCount(long count) { - this.recordcount = count; - return this; - } - - public AbstractCursor setContainer(AbstractCursor container) { - this.container = container; - return this; - } - - public AbstractCursor setScheme(Scheme scheme) { - this.scheme = scheme; - return this; - } - - - public AbstractCursor setDSP(DSP dsp) { - this.dsp = dsp; - return this; - } - - public AbstractCursor setTemplate(DapNode template) { - this.template = template; - return this; - } - - - ////////////////////////////////////////////////// - // Utilities - - public static Scheme schemeFor(DapVariable field) { - DapType ftype = field.getBaseType(); - Scheme scheme = null; - boolean isscalar = field.getRank() == 0; - if (ftype.getTypeSort().isAtomic()) - scheme = Scheme.ATOMIC; - else { - if (ftype.getTypeSort().isStructType()) - scheme = Scheme.STRUCTARRAY; - else if (ftype.getTypeSort().isSeqType()) - scheme = Scheme.SEQARRAY; - } - return scheme; - } -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractDSP.java b/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractDSP.java deleted file mode 100644 index ce17c50a3d..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/AbstractDSP.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.data.ChecksumMode; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DapAttribute; -import dap4.core.dmr.DapDataset; -import dap4.core.dmr.DapNode; -import dap4.core.dmr.DapVariable; -import dap4.core.dmr.parser.DOM4Parser; -import dap4.core.dmr.parser.Dap4Parser; -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import org.xml.sax.SAXException; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Provide a superclass for DSPs. - */ - -public abstract class AbstractDSP implements DSP { - public static boolean TESTING = false; /* Turned on by test programs */ - - ////////////////////////////////////////////////// - // constants - - protected static final boolean DEBUG = false; - protected static final boolean PARSEDEBUG = false; - - public static final boolean USEDOM = false; - - protected static final String DAPVERSION = "4.0"; - protected static final String DMRVERSION = "1.0"; - protected static final String DMRNS = "http://xml.opendap.org/ns/DAP/4.0#"; - - // Define reserved attributes - public static final String UCARTAGVLEN = "_edu.ucar.isvlen"; - public static final String UCARTAGOPAQUE = "_edu.ucar.opaque.size"; - public static final String UCARTAGORIGTYPE = "_edu.ucar.orig.type"; - public static final String UCARTAGUNLIMITED = "_edu.ucar.isunlimited"; - - - protected DapContext context = null; - protected DapDataset dmr = null; - protected String location = null; - private ByteOrder order = null; - private ChecksumMode checksummode = ChecksumMode.DAP; - - protected Map variables = new HashMap<>(); - protected DataCursor rootcursor = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public AbstractDSP() /* must have a parameterless constructor */ - {} - - ////////////////////////////////////////////////// - // DSP Interface - - // Subclass defined - - /** - * "open" a reference to a data source and return the DSP wrapper. - * - * @param location - Object that defines the data source - * @return = wrapping dsp - * @throws DapException - */ - @Override - public abstract AbstractDSP open(String location) throws DapException; - - /** - * @throws IOException - */ - public abstract void close() throws IOException; - - ////////////////////////////////////////////////// - // Implemented - - @Override - public DataCursor getVariableData(DapVariable var) throws DapException { - return this.variables.get(var); - } - - @Override - public DapContext getContext() { - return this.context; - } - - @Override - public String getLocation() { - return this.location; - } - - @Override - public AbstractDSP setLocation(String loc) { - this.location = loc; - return this; - } - - @Override - public DapDataset getDMR() { - return this.dmr; - } - - // DSP Extensions - - @Override - public void setContext(DapContext context) { - this.context = context; - // Extract some things from the context - Object o = this.context.get(Dap4Util.DAP4ENDIANTAG); - if (o != null) - setOrder((ByteOrder) o); - o = this.context.get(Dap4Util.DAP4CSUMTAG); - if (o != null) - setChecksumMode(ChecksumMode.modeFor(o.toString())); - } - - public void setDMR(DapDataset dmr) { - this.dmr = dmr; - if (getDMR() != null) { - // Add some canonical attributes to the - getDMR().setDataset(getDMR()); - getDMR().setDapVersion(DAPVERSION); - getDMR().setDMRVersion(DMRVERSION); - getDMR().setNS(DMRNS); - } - } - - protected void setDataset(DapDataset dataset) throws DapException { - this.dmr = dataset; - } - - public ByteOrder getOrder() { - return this.order; - } - - public AbstractDSP setOrder(ByteOrder order) { - this.order = order; - return this; - } - - public ChecksumMode getChecksumMode() { - return this.checksummode; - } - - public AbstractDSP setChecksumMode(ChecksumMode mode) { - if (mode != null) - this.checksummode = mode; - return this; - } - - public void addVariableData(DapVariable var, DataCursor cursor) { - this.variables.put(var, cursor); - } - - ////////////////////////////////////////////////// - // Utilities - - /** - * It is common to want to parse a DMR text to a DapDataset, - * so provide this utility. - * - * @param document the dmr to parse - * @return the parsed dmr - * @throws DapException on parse errors - */ - - protected DapDataset parseDMR(String document) throws DapException { - // Parse the dmr - Dap4Parser parser; - // if(USEDOM) - parser = new DOM4Parser(null); - // else - // parser = new DOM4Parser(new DefaultDMRFactory()); - if (PARSEDEBUG) - parser.setDebugLevel(1); - try { - if (!parser.parse(document)) - throw new DapException("DMR Parse failed"); - } catch (SAXException se) { - throw new DapException(se); - } - if (parser.getErrorResponse() != null) - throw new DapException("Error Response Document not supported"); - DapDataset result = parser.getDMR(); - processAttributes(result); - return result; - } - - /** - * Walk the dataset tree and remove selected attributes - * such as _Unsigned - * - * @param dataset - */ - protected void processAttributes(DapDataset dataset) throws DapException { - List nodes = dataset.getNodeList(); - for (DapNode node : nodes) { - switch (node.getSort()) { - case GROUP: - case DATASET: - case VARIABLE: - Map attrs = node.getAttributes(); - if (attrs.size() > 0) { - List suppressed = new ArrayList<>(); - for (DapAttribute dattr : attrs.values()) { - if (suppress(dattr.getShortName())) - suppressed.add(dattr); - } - for (DapAttribute dattr : suppressed) { - node.removeAttribute(dattr); - } - } - break; - default: - break; /* ignore */ - } - } - // Try to extract the byte order - getEndianAttribute(dataset); - } - - /** - * Some attributes that are added by the NetcdfDataset - * need to be kept out of the DMR. This function - * defines that set. - * - * @param attrname A non-escaped attribute name to be tested for suppression - * @return true if the attribute should be suppressed, false otherwise. - */ - - protected boolean suppress(String attrname) { - if (attrname.startsWith("_Coord")) - return true; - if (attrname.equals("_Unsigned")) - return true; - return false; - } - - void getEndianAttribute(DapDataset dataset) { - DapAttribute a = dataset.findAttribute(DapUtil.LITTLEENDIANATTRNAME); - if (a == null) - this.order = (ByteOrder.LITTLE_ENDIAN); - else { - Object v = a.getValues(); - int len = java.lang.reflect.Array.getLength(v); - if (len == 0) - this.order = (ByteOrder.nativeOrder()); - else { - String onezero = java.lang.reflect.Array.get(v, 0).toString(); - int islittle = 1; - try { - islittle = Integer.parseInt(onezero); - } catch (NumberFormatException e) { - islittle = 1; - } - if (islittle == 0) - this.order = (ByteOrder.BIG_ENDIAN); - else - this.order = (ByteOrder.LITTLE_ENDIAN); - } - } - } - - public static String printDMR(DapDataset dmr) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DMRPrinter printer = new DMRPrinter(dmr, pw); - try { - printer.print(); - pw.close(); - sw.close(); - } catch (IOException e) { - } - return sw.toString(); - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/ChunkInputStream.java b/dap4/d4lib/src/main/java/dap4/dap4lib/ChunkInputStream.java deleted file mode 100644 index bb03247809..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/ChunkInputStream.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -/** - * This class wraps a chunked source of databuffer - * as an InputStream. It is mostly pass-thru - * in the sense that reads on this class are - * turned into a series of reads of the underlying stream. - */ - -public class ChunkInputStream extends InputStream { - ////////////////////////////////////////////////// - // Constants - - static final int DFALTCHUNKSIZE = 0x00FFFFFF; - - static final byte CR8 = DapUtil.extract(DapUtil.UTF8.encode("\r"))[0]; - static final byte LF8 = DapUtil.extract(DapUtil.UTF8.encode("\n"))[0]; - - ////////////////////////////////////////////////// - // Type Decls - - ////////////////////////////////////////////////// - // static variables - - ////////////////////////////////////////////////// - // static methods - - ////////////////////////////////////////////////// - // Type declarations - - enum State { - ERROR, // after error chunk - END, // after last databuffer chunk - DATA, // when at start of a databuffer chunk - INDATA, // when reading a databuffer chunk - INITIAL; // before anything is written - } - - ////////////////////////////////////////////////// - // Instance variable - - protected InputStream input = null; - protected State state = State.INITIAL; - protected RequestMode requestmode = null; - - protected ByteOrder localorder = null; - protected ByteOrder remoteorder = null; - protected boolean nochecksum = false; - - // State info for current chunk - protected int flags = 0; - protected int chunksize = 0; - protected int avail = 0; - - - ////////////////////////////////////////////////// - // Constructor(s) - - public ChunkInputStream(InputStream input, RequestMode requestmode) { - this(input, requestmode, ByteOrder.nativeOrder()); - } - - public ChunkInputStream(InputStream input, RequestMode requestmode, ByteOrder order) { - this.input = input; - this.requestmode = requestmode; - this.localorder = order; - } - - ////////////////////////////////////////////////// - // Accessors - - public ByteOrder getHostByteOrder() { - return this.localorder; - } - - public ByteOrder getRemoteByteOrder() { - return this.remoteorder; - } - - public boolean getNoChecksum() { - return this.nochecksum; - } - - ////////////////////////////////////////////////// - - /** - * Read the DMR, trimmed. - * - * @return the DMR as a Java String - */ - - public String readDMR() throws DapException { - try { - if (state != State.INITIAL) - throw new DapException("Attempt to read DMR twice"); - - byte[] dmr8 = null; - - if (requestmode == RequestMode.DMR) { - // The whole buffer is the dmr; - // but we do not know the length - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int c; - while ((c = input.read()) >= 0) { - baos.write(c); - } - baos.close(); - dmr8 = baos.toByteArray(); - } else if (requestmode == RequestMode.DAP) { - // Pull in the DMR chunk header - if (!readHeader(input)) - throw new DapException("Malformed chunk count"); - // Read the DMR databuffer - dmr8 = new byte[this.chunksize]; - int red = read(dmr8, 0, this.chunksize); - if (red < this.chunksize) - throw new DapException("Short chunk"); - } else - assert false : "Internal error"; - - // Convert DMR to a string - String dmr = new String(dmr8, DapUtil.UTF8); - // Clean it up - dmr = dmr.trim(); - // Make sure it has trailing \r\n" - if (dmr.endsWith("\r\n")) { - // do nothing - } else if (dmr.endsWith("\n")) - dmr = dmr.substring(0, dmr.length() - 2) + "\r\n"; - else - dmr = dmr + "\r\n"; - - // Figure out the endian-ness of the response - this.remoteorder = (flags & DapUtil.CHUNK_LITTLE_ENDIAN) == 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; - this.nochecksum = (flags & DapUtil.CHUNK_NOCHECKSUM) != 0; - - // Set the state - if ((flags & DapUtil.CHUNK_ERROR) != 0) - state = State.ERROR; - else if ((flags & DapUtil.CHUNK_END) != 0) - state = State.END; - else - state = State.DATA; - return dmr; // return the DMR - - } catch (IOException ioe) { - throw new DapException(ioe.getMessage()); - } - } - - /** - * Convert an error chunk to an exception - * - * @param document XML representation of the error - * @throws DapException containing the contents of the error chunk - */ - public void throwError(String document) throws ErrorException { - throw new ErrorException("Error chunk encountered").setDocument(document); - } - - /** - * Read an error chunk - * - * @return the error document as a string - */ - public String readError() throws IOException { - state = State.ERROR; - // Read the error body databuffer - byte[] bytes = new byte[this.chunksize]; - try { - if (read(bytes, 0, this.chunksize) < this.chunksize) - throw new ErrorException("Short chunk"); - } catch (IOException ioe) { - throw new ErrorException(ioe); - } - String document = new String(bytes, DapUtil.UTF8); - return document; - } - - ////////////////////////////////////////////////// - // InputStream abstract methods - - /** - * Reads the next byte of databuffer from the input stream. The value byte is - * returned as an int in the range 0 to - * 255. If no byte is available because the end of the stream - * has been reached, the value -1 is returned. This method - * blocks until input databuffer is available, the end of the stream is detected, - * or an exception is thrown. - *

- * Operates by loading chunk by chunk. If an error chunk is detected, - * then return ErrorException (which is a subclass of IOException). - * - * @return the next byte of databuffer, or -1 if the end of the - * stream is reached. - * @throws IOException if an I/O error occurs. - */ - public int read() throws IOException { - if (requestmode == RequestMode.DMR) - throw new UnsupportedOperationException("Attempt to read databuffer when DMR only"); // Runtime - if (avail <= 0) { - if ((flags & DapUtil.CHUNK_END) != 0) - return -1; // Treat as EOF - if (!readHeader(input)) - return -1; // EOF - // See if we have an error chunk, - // and if so, turn it into an exception - if ((flags & DapUtil.CHUNK_ERROR) != 0) { - String document = readError(); - throwError(document); - } - } - avail--; - return input.read(); - } - - ////////////////////////////////////////////////// - // InputStream method overrides - - /** - * Reads up to len databuffer of databuffer from the input stream into an - * array of databuffer. An attempt is made to read as many as len - * databuffer, but a smaller number may be read. The number of databuffer - * actually read is returned as an integer. - * - * @param buf the byte array into which databuffer is read - * @param off the offset in the byte array at which to write - * @param len the amount to read - * @return the actual number of databuffer read - * @throws IOException - */ - - public int read(byte[] buf, int off, int len) throws IOException { - // Sanity check - if (off < 0 || len < 0) - throw new IndexOutOfBoundsException();// Runtime - if (off >= buf.length || buf.length < (off + len)) - throw new IndexOutOfBoundsException(); // Runtime - if (requestmode == RequestMode.DMR) - throw new UnsupportedOperationException("Attempt to read databuffer when DMR only"); // Runtime - - // Attempt to read len bytes out of a sequence of chunks - int count = len; - int pos = off; - while (count > 0) { - if (avail <= 0) { - if ((flags & DapUtil.CHUNK_END) != 0 || !readHeader(input)) - return (len - count); // return # databuffer read - // See if we have an error chunk, - // and if so, turn it into an exception - if ((flags & DapUtil.CHUNK_ERROR) != 0) { - String document = readError(); - throwError(document); - } - } else { - int actual = (this.avail < count ? this.avail : count); - int red = input.read(buf, pos, actual); - if (red < 0) - throw new IOException("Unexpected EOF"); - pos += red; - count -= red; - this.avail -= red; - } - } - return len; - } - - /** - * Returns an estimate of the number of databuffer that can be read - * (or skipped over) from this input stream without - * blocking by the next invocation of a method for this - * input stream. - *

- * Repurposed here to do equivalent of peek(). - * - * @return 0 if at eof, some number > 0 otherwise. - */ - - public int available() { - if (this.avail > 0) - return this.avail; - if ((flags & DapUtil.CHUNK_END) != 0) - return 0; - return 1; // should be some unknown amount left. - } - - /** - * Closes this output stream and releases any system resources - * associated with this stream. The underlying servlet stream is - * not closed; that is left to the level above. - */ - - public void close() throws IOException { - state = State.END; - } - - ////////////////////////////////////////////////// - // Utilities - - /** - * Read the size+flags header from the input stream and use it to - * initialize the chunk state - * - * @param input The input streamfrom which to read - * @return true if header read false if immediate eof encountered - */ - - boolean readHeader(InputStream input) throws IOException { - byte[] bytehdr = new byte[4]; - int red = input.read(bytehdr); - if (red == -1) - return false; - if (red < 4) - throw new IOException("Short binary chunk count"); - this.flags = ((int) bytehdr[0]) & 0xFF; // Keep unsigned - bytehdr[0] = 0; - ByteBuffer buf = ByteBuffer.wrap(bytehdr).order(ByteOrder.BIG_ENDIAN); - this.chunksize = buf.getInt(); - this.avail = this.chunksize; - return true; - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DSPPrinter.java b/dap4/d4lib/src/main/java/dap4/dap4lib/DSPPrinter.java deleted file mode 100644 index daa41e15a8..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/DSPPrinter.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ -package dap4.dap4lib; - -import dap4.core.ce.CEConstraint; -import dap4.core.data.DSP; -import dap4.core.data.DataCursor; -import dap4.core.dmr.*; -import dap4.core.util.*; -import java.io.PrintWriter; -import java.io.Writer; -import java.lang.reflect.Array; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.util.EnumSet; -import java.util.List; - -/** - * DAP DSP Printer. - * Given a constraint and a DSP print the constrained - * subset of the data in text form. - */ - -public class DSPPrinter { - ////////////////////////////////////////////////// - // Printer Control flags - - public enum Flags { - CONTROLCHAR; - } - - ////////////////////////////////////////////////// - // Constants - - protected static final int COLUMNS = 8; - - protected static final char LPAREN = '('; - protected static final char RPAREN = ')'; - protected static final char LBRACE = '{'; - protected static final char RBRACE = '}'; - protected static final char LBRACKET = '['; - protected static final char RBRACKET = ']'; - - // Could use enumset, but it is so ugly, - // so use good old OR'able flags - protected static final int NILFLAGS = 0; - protected static final int PERLINE = 1; // print xml attributes 1 per line - protected static final int NONAME = 2; // do not print name xml attribute - protected static final int NONNIL = 4; // print empty xml attributes - - ////////////////////////////////////////////////// - // Instance variables - - protected PrintWriter writer = null; - protected IndentWriter printer = null; - - protected DSP dsp = null; - protected CEConstraint ce = null; - - protected EnumSet flags = EnumSet.noneOf(Flags.class); - - ////////////////////////////////////////////////// - // Constructor(s) - - protected DSPPrinter() {} - - public DSPPrinter(DSP dsp, Writer writer) { - this(dsp, null, writer); - } - - public DSPPrinter(DSP dsp, CEConstraint ce, Writer writer) { - this.dsp = dsp; - this.ce = ce; - this.writer = new PrintWriter(writer); - this.printer = new IndentWriter(this.writer); - } - - ////////////////////////////////////////////////// - // External API - - public DSPPrinter flag(Flags flag) { - this.flags.add(flag); - return this; - } - - public DSPPrinter flush() { - this.printer.flush(); - return this; - } - - public DSPPrinter close() { - this.flush(); - return this; - } - - /** - * Print data from a DSP - * - optionally constrained - * - * @throws DapException - */ - - public DSPPrinter print() throws DapException { - DapDataset dmr = this.dsp.getDMR(); - if (this.ce == null) - this.ce = CEConstraint.getUniversal(dmr); - this.printer.setIndent(0); - List topvars = dmr.getTopVariables(); - for (int i = 0; i < topvars.size(); i++) { - DapVariable top = topvars.get(i); - List slices = this.ce.getConstrainedSlices(top); - if (this.ce.references(top)) { - DataCursor data = dsp.getVariableData(top); - printVariable(data, slices); - } - } - printer.eol(); - return this; - } - - ////////////////////////////////////////////////// - - /** - * Print an arbitrary DataVariable using a constraint. - *

- * Handling newlines is a bit tricky - * so the rule is that the - * last newline is elided and left - * for the caller to print. - * Exceptions: ? - * - * @param data - the cursor to print - * @throws DapException Note that the PrintWriter and CEConstraint are global. - */ - - protected void printVariable(DataCursor data, List slices) throws DapException { - DapVariable dapv = (DapVariable) data.getTemplate(); - if (data.isScalar()) { - assert slices == Slice.SCALARSLICES; - printScalar(data); - } else {// not scalar - printArray(data, slices); - } - } - - protected void printScalar(DataCursor data) throws DapException { - DapVariable dapv = (DapVariable) data.getTemplate(); - printer.marginPrint(dapv.getFQN() + " = "); - switch (data.getScheme()) { - case ATOMIC: - printAtomicInstance(data, Index.SCALAR); - break; - case STRUCTARRAY: - case SEQARRAY: // remember that scalars are treated as 1-element arrays - DataCursor[] scalar = (DataCursor[]) data.read(Index.SCALAR); - assert scalar.length == 1; - data = scalar[0]; // fall thru - case STRUCTURE: - case SEQUENCE: - case RECORD: - printer.marginPrint("{"); - printer.eol(); - printer.indent(); - printCompoundInstance(data); - printer.outdent(); - printer.marginPrint("}"); - printer.eol(); - break; - default: - throw new DapException("Unexpected data cursor type: " + data.getScheme()); - } - } - - protected void printArray(DataCursor data, List slices) throws DapException { - DapVariable dapv = (DapVariable) data.getTemplate(); - Odometer odom = Odometer.factory(slices); - switch (data.getScheme()) { - case ATOMIC: - if (DapUtil.isContiguous(slices)) - printAtomicVector(data, slices, odom); - else { - while (odom.hasNext()) { - Index pos = odom.next(); - String s = indicesToString(pos); - printer.marginPrint(dapv.getFQN() + s + " = "); - printAtomicInstance(data, pos); - } - } - break; - case STRUCTARRAY: - case SEQARRAY: - DapStructure ds = (DapStructure) ((DapVariable) data.getTemplate()).getBaseType(); - DataCursor[] instances = (DataCursor[]) data.read(slices); - while (odom.hasNext()) { - Index pos = odom.next(); - String s = indicesToString(pos); - printer.marginPrint(ds.getFQN() + s + " = {"); - printer.eol(); - printer.indent(); - printCompoundInstance(instances[(int) pos.index()]); - printer.outdent(); - printer.marginPrint("}"); - printer.eol(); - } - break; - default: - throw new DapException("Unexpected data cursor type: " + data.getScheme()); - } - } - - protected void printAtomicVector(DataCursor data, List slices, Odometer odom) throws DapException { - assert data.getScheme() == DataCursor.Scheme.ATOMIC; - Object values = data.read(slices); - DapVariable atom = (DapVariable) data.getTemplate(); - String name = atom.getFQN(); - if (Array.getLength(values) == 0) {// zero length case - printer.marginPrint(name + " = "); - printer.eol(); - } else - for (int i = 0; odom.hasNext(); i++) { - Index index = odom.next(); - String prefix = (odom.rank() == 0 ? name : name + indicesToString(index)); - printer.marginPrint(prefix + " = "); - printer.print(valueString(values, i, atom.getBaseType())); - printer.eol(); - } - } - - protected void printAtomicInstance(DataCursor datav, Index pos) throws DapException { - assert datav.getScheme() == DataCursor.Scheme.ATOMIC; - Object value = datav.read(pos); - DapVariable av = (DapVariable) datav.getTemplate(); - printer.print(valueString(value, 0, av.getBaseType())); - printer.eol(); - } - - /** - * Print a single structure or sequence or record instance - * - * @param datav - * @throws DapException - */ - protected void printCompoundInstance(DataCursor datav) throws DapException { - // Index index = datav.getIndex(); - DapStructure dstruct = (DapStructure) ((DapVariable) datav.getTemplate()).getBaseType(); - switch (datav.getScheme()) { - case STRUCTURE: - case RECORD: - List dfields = dstruct.getFields(); - for (int f = 0; f < dfields.size(); f++) { - DapVariable field = dfields.get(f); - List fieldslices = this.ce.getConstrainedSlices(field); - DataCursor fdata = datav.readField(f); - printVariable(fdata, fieldslices); - } - break; - - case SEQUENCE: - DapSequence dseq = (DapSequence) dstruct; - long count = datav.getRecordCount(); - for (long r = 0; r < count; r++) { - DataCursor dr = datav.readRecord(r); - printer.marginPrint("["); - printer.eol(); - printer.indent(); - printCompoundInstance(dr); - printer.outdent(); - printer.marginPrint("]"); - } - break; - default: - throw new DapException("Unexpected data cursor scheme:" + datav.getScheme()); - } - } - - protected String indicesToString(Index indices) throws DapException { - StringBuilder buf = new StringBuilder(); - if (indices != null && indices.getRank() > 0) { - for (int i = 0; i < indices.getRank(); i++) { - buf.append(i == 0 ? LBRACKET : ","); - buf.append(String.format("%d", indices.get(i))); - } - buf.append(RBRACKET); - } - return buf.toString(); - } - - protected String valueString(Object vector, long pos, DapType basetype) throws DapException { - if (vector == null) - return "null"; - TypeSort atype = basetype.getTypeSort(); - boolean unsigned = atype.isUnsigned(); - int ipos = (int) pos; - switch (atype) { - case Int8: - case UInt8: - long lvalue = ((byte[]) vector)[ipos]; - if (unsigned) - lvalue &= 0xFFL; - return String.format("%d", lvalue); - case Int16: - case UInt16: - lvalue = ((short[]) vector)[ipos]; - if (unsigned) - lvalue &= 0xFFFFL; - return String.format("%d", lvalue); - case Int32: - case UInt32: - lvalue = ((int[]) vector)[ipos]; - if (unsigned) - lvalue &= 0xFFFFFFFFL; - return String.format("%d", lvalue); - case Int64: - case UInt64: - lvalue = ((long[]) vector)[ipos]; - if (unsigned) { - BigInteger b = BigInteger.valueOf(lvalue); - b = b.and(DapUtil.BIG_UMASK64); - return b.toString(); - } else - return String.format("%d", lvalue); - case Float32: - return String.format("%f", ((float[]) vector)[ipos]); - case Float64: - return String.format("%f", ((double[]) vector)[ipos]); - case Char: - return String.format("'%c'", ((char[]) vector)[ipos]); - case String: - case URL: - String s = (((String[]) vector)[ipos]); - if (flags.contains(Flags.CONTROLCHAR)) { - s = s.replace("\r", "\\r"); - s = s.replace("\n", "\\n"); - s = s.replace("\t", "\\t"); - } - return "\"" + s + "\""; - case Opaque: - ByteBuffer opaque = ((ByteBuffer[]) vector)[ipos]; - StringBuilder buf = new StringBuilder(); - buf.append("0x"); - for (int i = 0; i < opaque.limit(); i++) { - byte b = opaque.get(i); - char c = hexchar((b >> 4) & 0xF); - buf.append(c); - c = hexchar((b) & 0xF); - buf.append(c); - } - return buf.toString(); - case Enum: - DapEnumeration de = (DapEnumeration) basetype; - Object newvec = CoreTypeFcns.createVector(de.getBaseType().getTypeSort(), 1); - Object v = java.lang.reflect.Array.get(vector, ipos); - java.lang.reflect.Array.set(newvec, 0, v); - long[] lv = (long[]) Convert.convert(DapType.INT64, de, newvec); - DapEnumConst dec = de.lookup(lv[0]); - return dec.getShortName(); - default: - break; - } - throw new DapException("Unknown type: " + basetype); - } - - - ////////////////////////////////////////////////// - // Misc. Utilities - - protected static char hexchar(int i) { - return "0123456789ABCDEF".charAt((i & 0xF)); - } - - - protected static String getPrintValue(Object value) { - if (value instanceof String) { - return Escape.entityEscape((String) value, null); - } else - return value.toString(); - } - -} - diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/Dap4Util.java b/dap4/d4lib/src/main/java/dap4/dap4lib/Dap4Util.java deleted file mode 100644 index 557a1ba76b..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/Dap4Util.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -/** - * Constants and utilities - * either top-level or for a member. - */ - -public abstract class Dap4Util { - ///////////////////////////////////////////////////// - // Constants - - public static final String DAP4ENDIANTAG = "ucar.littleendian"; // value = 1 | 0 - public static final String DAP4CSUMTAG = "ucar.checksummode"; // value = NONE|DAP|DMR|ALL - public static final String DAP4TESTTAG = "ucar.testing"; // value = NONE|DAP|DMR|ALL - - ////////////////////////////////////////////////// - // Static utility methods - - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DapProtocol.java b/dap4/d4lib/src/main/java/dap4/dap4lib/DapProtocol.java deleted file mode 100644 index 8436fa464d..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/DapProtocol.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.util.DapException; -import dap4.core.util.ResponseFormat; -import java.util.HashMap; -import java.util.Map; - -/** - * Store protocol related constants - */ - -public abstract class DapProtocol implements DapCodes { - public static final String X_DAP_SERVER = "TDS-4"; - public static final String X_DAP_VERSION = "4.0"; - - public static final String CONSTRAINTTAG = "dap4.ce"; - - public static Map contenttypes; - - static { - contenttypes = new HashMap(); - contenttypes.put(RequestMode.DMR, new ContentType(RequestMode.DMR, - "application/vnd.opendap.dap4.dataset-metadata+xml", "text/xml", "text/plain", "text/html")); - contenttypes.put(RequestMode.DAP, - new ContentType(RequestMode.DAP, "application/vnd.opendap.dap4.data", "text/xml", "text/plain", "text/html")); - contenttypes.put(RequestMode.DSR, new ContentType(RequestMode.DSR, - "application/vnd.opendap.dap4.dataset-services+xml", "text/xml", "text/plain", "text/html")); - contenttypes.put(RequestMode.CAPABILITIES, - new ContentType(RequestMode.CAPABILITIES, "text/xml", "text/xml", "text/plain", "text/html")); - contenttypes.put(RequestMode.ERROR, new ContentType(RequestMode.ERROR, "application/vnd.opendap.dap4.error+xml", - "text/xml", "text/plain", "text/html")); - } - - ////////////////////////////////////////////////// - - public static class ContentType { - public RequestMode mode; - public String contenttype; - public String xmltype; - public String texttype; - public String htmltype; - - public ContentType(RequestMode mode, String contenttype, String xmltype, String texttype, String htmltype) { - this.mode = mode; - this.contenttype = contenttype; - this.xmltype = xmltype; - this.texttype = texttype; - this.htmltype = htmltype; - } - - public String getFormat(ResponseFormat format) throws DapException { - if (format == null) - format = ResponseFormat.NONE; - switch (format) { - case XML: - return xmltype; - case TEXT: - return texttype; - case HTML: - return htmltype; - case NONE: - return contenttype; - } - throw new DapException(String.format("Unsupported format request: %s for Mode %s", format, this.mode)) - .setCode(org.apache.http.HttpStatus.SC_BAD_REQUEST); - } - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/FileDSP.java b/dap4/d4lib/src/main/java/dap4/dap4lib/FileDSP.java deleted file mode 100644 index 26f0bf061b..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/FileDSP.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.dap4lib.serial.D4DSP; -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URISyntaxException; - -/** - * Provide a DSP interface to raw data - */ - -public class FileDSP extends D4DSP { - ////////////////////////////////////////////////// - // Constants - - protected static final String[] EXTENSIONS = new String[] {".dap", ".raw"}; - - ////////////////////////////////////////////////// - // Instance variables - - // Coverity[FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD] - protected byte[] raw = null; // Complete serialized binary databuffer - - ////////////////////////////////////////////////// - // Constructor(s) - - public FileDSP() { - super(); - } - - ////////////////////////////////////////////////// - // DSP API - - /** - * A path is file if it has no base protocol or is file: - * - * @param location file:/ or possibly an absolute path - * @param context Any parameters that may help to decide. - * @return true if this path appears to be processible by this DSP - */ - public boolean dspMatch(String location, DapContext context) { - try { - XURI xuri = new XURI(location); - if (xuri.isFile()) { - String path = xuri.getPath(); - for (String ext : EXTENSIONS) { - if (path.endsWith(ext)) - return true; - } - } - } catch (URISyntaxException use) { - return false; - } - return false; - } - - @Override - public void close() {} - - @Override - public FileDSP open(String filepath) throws DapException { - try { - if (filepath.startsWith("file:")) - try { - XURI xuri = new XURI(filepath); - filepath = xuri.getPath(); - } catch (URISyntaxException use) { - throw new DapException("Malformed filepath: " + filepath).setCode(DapCodes.SC_NOT_FOUND); - } - try (FileInputStream stream = new FileInputStream(filepath)) { - this.raw = DapUtil.readbinaryfile(stream); - } - try (FileInputStream stream = new FileInputStream(filepath)) { // == rewind - ChunkInputStream rdr = new ChunkInputStream(stream, RequestMode.DAP); - String document = rdr.readDMR(); - byte[] serialdata = DapUtil.readbinaryfile(rdr); - super.build(document, serialdata, rdr.getRemoteByteOrder()); - } - return this; - } catch (IOException ioe) { - throw new DapException(ioe).setCode(DapCodes.SC_INTERNAL_SERVER_ERROR); - } - } - - ////////////////////////////////////////////////// - // Extension to access a raw byte stream - - public FileDSP open(byte[] rawdata) throws DapException { - try { - this.raw = rawdata; - ByteArrayInputStream stream = new ByteArrayInputStream(this.raw); - ChunkInputStream rdr = new ChunkInputStream(stream, RequestMode.DAP); - String document = rdr.readDMR(); - byte[] serialdata = DapUtil.readbinaryfile(rdr); - super.build(document, serialdata, rdr.getRemoteByteOrder()); - return this; - } catch (IOException ioe) { - throw new DapException(ioe).setCode(DapCodes.SC_INTERNAL_SERVER_ERROR); - } - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/HttpDSP.java b/dap4/d4lib/src/main/java/dap4/dap4lib/HttpDSP.java deleted file mode 100644 index 1d27ca8e86..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/HttpDSP.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.dmr.DapDataset; -import dap4.core.util.DapContext; -import dap4.core.util.DapDump; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.dap4lib.serial.D4DSP; -import org.apache.http.HttpStatus; -import ucar.httpservices.HTTPException; -import ucar.httpservices.HTTPFactory; -import ucar.httpservices.HTTPMethod; -import ucar.httpservices.HTTPUtil; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * Make a request to a server and convert the reply - * to a DapDataset from the returned bytes. - */ - -public class HttpDSP extends D4DSP { - - ////////////////////////////////////////////////// - // Constants - - protected static final boolean DEBUG = false; - - protected static final String DAPVERSION = "4.0"; - protected static final String DMRVERSION = "1.0"; - - protected static final String DAP4PROTO = "dap4"; - protected static final String FILEPROTO = "file"; - - protected static final String DMRSUFFIX = "dmr"; - protected static final String DATASUFFIX = "dap"; - protected static final String DSRSUFFIX = "dsr"; - - protected static final String QUERYSTART = "?"; - protected static final String CONSTRAINTTAG = "dap4.ce"; - protected static final String PROTOTAG = "protocol"; - - protected static final int DFALTPRELOADSIZE = 50000; // databuffer - - protected static final String[] DAPEXTENSIONS = new String[] {"dmr", "dap", "dds", "das", "ddx", "dods"}; - - protected static final String[] DAP4EXTENSIONS = new String[] {"dmr", "dap"}; - - protected static final String[][] DAP4QUERYMARKERS = new String[][] {{"proto", "dap4"}, {"dap4.ce", null},}; - protected static final String[][] DAP4FRAGMARKERS = new String[][] {{"protocol", "dap4"}, {"dap4", null},}; - - protected static final String[] DAP4SCHEMES = {"dap4", "http", "https"}; - - ////////////////////////////////////////////////// - // Instance variables - - protected boolean allowCompression = true; - protected String basece = null; // the constraint(s) from the original url - - protected int status = HttpStatus.SC_OK; // response - protected XURI xuri = null; - - protected Object context = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public HttpDSP() { - super(); - } - - ////////////////////////////////////////////////// - // DSP API - - /** - * A path is a DAP4 path if at least one of the following is true. - * 1. it has "dap4:" as its leading protocol - * 2. it has #protocol=dap4 in its fragment - * - * @param url - * @param context Any parameters that may help to decide. - * @return true if this url appears to be processible by this DSP - */ - public boolean dspMatch(String url, DapContext context) { - try { - XURI xuri = new XURI(url); - if (true) { - boolean found = false; - for (String scheme : DAP4SCHEMES) { - if (scheme.equalsIgnoreCase(xuri.getBaseProtocol()) || scheme.equalsIgnoreCase(xuri.getFormatProtocol())) { - found = true; - break; - } - } - if (!found) - return false; - // Might still be a non-dap4 url - String formatproto = xuri.getFormatProtocol(); - if (DAP4PROTO.equalsIgnoreCase(formatproto)) - return true; - for (String[] pair : DAP4QUERYMARKERS) { - String tag = xuri.getQueryFields().get(pair[0]); - if (tag != null && (pair[1] == null || pair[1].equalsIgnoreCase(tag))) - return true; - } - for (String[] pair : DAP4FRAGMARKERS) { - String tag = xuri.getFragFields().get(pair[0]); - if (tag != null && (pair[1] == null || pair[1].equalsIgnoreCase(tag))) - return true; - } - } else - return true; - } catch (URISyntaxException use) { - return false; - } - return false; - } - - @Override - public HttpDSP open(String url) throws DapException { - setLocation(url); - parseURL(url); - - /* - * Take from the incoming data - * String s = xuri.getFragFields().get(Dap4Util.DAP4CSUMTAG); - * ChecksumMode mode = ChecksumMode.modeFor(s); - * if(mode == null) - * throw new DapException(String.format("Illegal %s: %s",Dap4Util.DAP4CSUMTAG,s)); - * setChecksumMode(mode); - * s = xuri.getFragFields().get(Dap4Util.DAP4ENDIANTAG); - * Integer oz = DapUtil.stringToInteger(s); - * if(oz == null) - * throw new DapException(String.format("Illegal %s: %s",Dap4Util.DAP4ENDIANTAG,s)); - * ByteOrder order = (oz != 0 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); - * setOrder(order); - */ - - // See if this is a local vs remote request - this.basece = this.xuri.getQueryFields().get(CONSTRAINTTAG); - build(); - return this; - } - - @Override - public void close() {} - - ///////////////////////////////////////// - // AbstractDSP extensions - - /* - * @Override - * public String getPath() - * { - * return this.originalurl; - * } - */ - - ////////////////////////////////////////////////// - // Request/Response methods - - /** - * Open a connection and make a request for the (possibly constrained) DMR. - * - * @throws DapException - */ - - protected void build() throws DapException { - String methodurl = buildURL(this.xuri.assemble(XURI.URLONLY), DATASUFFIX, this.dmr, this.basece); - - InputStream stream; - // Make the request and return an input stream for accessing the databuffer - // Should fill in bigendian and stream fields - stream = callServer(methodurl); - - try { - ChunkInputStream reader; - if (DEBUG) { - byte[] raw = DapUtil.readbinaryfile(stream); - ByteArrayInputStream bis = new ByteArrayInputStream(raw); - DapDump.dumpbytestream(raw, getOrder(), "httpdsp.build"); - reader = new ChunkInputStream(bis, RequestMode.DAP, getOrder()); - } else { - // Wrap the input stream as a ChunkInputStream - reader = new ChunkInputStream(stream, RequestMode.DAP, getOrder()); - } - - // Extract and "compile" the server response - String document = reader.readDMR(); - // Extract all the remaining bytes - byte[] bytes = DapUtil.readbinaryfile(reader); - // use super.build to compile - super.build(document, bytes, getOrder()); - } catch (Throwable t) { - t.printStackTrace(); - throw new DapException(t); - } finally { - try { - stream.close(); - } catch (IOException ioe) { - /* ignore */} - } - } - - protected InputStream callServer(String methodurl) throws DapException { - URI uri; - - try { - uri = HTTPUtil.parseToURI(methodurl); - } catch (URISyntaxException mue) { - throw new DapException("Malformed url: " + methodurl); - } - - long start = System.currentTimeMillis(); - long stop = 0; - this.status = 0; - if (false) { - HTTPMethod method = null; // Implicitly passed out to caller via stream - try { // Note that we cannot use try with resources because we export the method stream, so method - // must not be closed. - method = HTTPFactory.Get(methodurl); - if (allowCompression) - method.setCompression("deflate,gzip"); - this.status = method.execute(); - if (this.status != HttpStatus.SC_OK) { - String msg = method.getResponseAsString(); - throw new DapException("Request failure: " + status + ": " + methodurl).setCode(status); - } - // Get the response body stream => do not close the method - return method.getResponseAsStream(); - } catch (HTTPException e) { - if (method != null) - method.close(); - throw new DapException(e); - } - } else {// read whole input - try { - try (HTTPMethod method = HTTPFactory.Get(methodurl)) { - if (allowCompression) - method.setCompression("deflate,gzip"); - this.status = method.execute(); - if (this.status != HttpStatus.SC_OK) { - String msg = method.getResponseAsString(); - throw new DapException("Request failure: " + status + ": " + methodurl).setCode(status); - } - byte[] body = method.getResponseAsBytes(); - return new ByteArrayInputStream(body); - } - } catch (HTTPException e) { - throw new DapException(e); - } - } - } - - /** - * Provide a method for getting the capabilities document. - * - * @param url for accessing the document - * @throws DapException - */ - - public String getCapabilities(String url) throws IOException { - // Save the original url - String saveurl = this.xuri.getOriginal(); - parseURL(url); - String fdsurl = buildURL(this.xuri.assemble(XURI.URLALL), DSRSUFFIX, null, null); - try { - // Make the request and return an input stream for accessing the databuffer - // Should fill in context bigendian and stream fields - InputStream stream = callServer(fdsurl); - // read the result, convert to string and return. - byte[] bytes = DapUtil.readbinaryfile(stream); - String document = new String(bytes, DapUtil.UTF8); - return document; - } finally { - parseURL(saveurl); - } - } - - ////////////////////////////////////////////////// - // Utilities - - protected static String buildURL(String baseurl, String suffix, DapDataset template, String ce) { - StringBuilder methodurl = new StringBuilder(); - methodurl.append(baseurl); - if (suffix != null) { - methodurl.append('.'); - methodurl.append(suffix); - } - if (ce != null && ce.length() > 0) { - methodurl.append(QUERYSTART); - methodurl.append(CONSTRAINTTAG); - methodurl.append('='); - methodurl.append(ce); - } - return methodurl.toString(); - } - - protected void parseURL(String url) throws DapException { - try { - this.xuri = new XURI(url); - } catch (URISyntaxException use) { - throw new DapException(use); - } - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/XURI.java b/dap4/d4lib/src/main/java/dap4/dap4lib/XURI.java deleted file mode 100644 index 1fce4061d2..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/XURI.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib; - -import dap4.core.util.DapUtil; -import dap4.core.util.Escape; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Provide an extended form of URI parser that can handle - * multiple protocols and can parse the query and fragment parts. - */ - -public class XURI { - - ////////////////////////////////////////////////// - // Constants - static final String QUERYSEP = "&"; - static final String FRAGMENTSEP = "&"; - - // Define assembly flags - - public static enum Parts { - FORMAT, // format protocol - BASE, // base protocol - PWD, // including user - HOST, // including port - PATH, QUERY, FRAG; - } - - // Mnemonics - public static final EnumSet URLONLY = EnumSet.of(Parts.BASE, Parts.PWD, Parts.HOST, Parts.PATH); - public static final EnumSet URLALL = - EnumSet.of(Parts.FORMAT, Parts.BASE, Parts.PWD, Parts.HOST, Parts.PATH, Parts.QUERY, Parts.FRAG); - public static final EnumSet URLBASE = - EnumSet.of(Parts.BASE, Parts.PWD, Parts.HOST, Parts.PATH, Parts.QUERY, Parts.FRAG); - public static final EnumSet URLPATH = EnumSet.of(Parts.PATH, Parts.QUERY, Parts.FRAG); - - ////////////////////////////////////////////////// - // Instance variables - - protected String originaluri = null; - protected boolean isfile = false; - - protected String baseprotocol = null; // rightmost protocol - protected String formatprotocol = null; // leftmost protocol - protected String userinfo = null; - protected String host = null; - protected String path = null; - protected String query = null; - protected String frag = null; - - // Following are url decoded - protected Map queryfields // decomposed query - = new HashMap(); - protected Map fragfields // decomposed fragment - = new HashMap(); - - ////////////////////////////////////////////////// - // Constructor - - public XURI(String xurl) throws URISyntaxException { - if (xurl == null) - throw new URISyntaxException(xurl, "Null URI"); - // save the original uri - this.originaluri = xurl; - // The uri may be multi-protocol: e.g. dap4:file:... - // Additionally, this may be a windows path, so it - // will look like it has a single character protocol - // that is really the drive letter. - - int[] breakpoint = new int[1]; - List protocols = DapUtil.getProtocols(xurl, breakpoint); // should handle drive letters also - String remainder = xurl.substring(breakpoint[0], xurl.length()); - switch (protocols.size()) { - case 0: // pretend it is a file - this.formatprotocol = "file"; - this.baseprotocol = "file"; - break; - case 1: - this.formatprotocol = protocols.get(0); - if ("file".equalsIgnoreCase(this.formatprotocol)) - this.baseprotocol = "file"; // default conversion - else - this.baseprotocol = "http"; // default conversion - break; - case 2: - this.baseprotocol = protocols.get(0); - this.formatprotocol = protocols.get(1); - break; - default: - throw new URISyntaxException(xurl, "Too many protocols: at most 2 allowed"); - } - this.isfile = "file".equals(this.baseprotocol); - // The standard URI parser does not handle 'file:' very well, - // so handle specially - URI uri; - if (this.isfile) - parsefile(remainder); - else - parsenonfile(remainder); // not a file: url - if (this.query != null) - parseQuery(this.query); - if (this.frag != null) - parseFragment(this.frag); - } - - protected void parsenonfile(String remainder) throws URISyntaxException { - // Construct a usable url and parse it - URI uri = new URI(baseprotocol + ":" + remainder); - // Extract the parts of the uri so they can - // be modified and later reassembled - this.userinfo = canonical(uri.getUserInfo()); - this.host = canonical(uri.getHost()); - if (uri.getPort() > 0) - this.host += (":" + uri.getPort()); - this.path = canonical(uri.getPath()); - // Parse the raw query (before decoding) - this.query = uri.getRawQuery(); - // Parse the raw fragment (before decoding) - this.frag = canonical(uri.getFragment()); - } - - protected void parsefile(String remainder) { - // Pull off the query and fragment parts, if any. - String query = null; - String fragment = null; - int qindex = remainder.indexOf("?"); - int findex = remainder.lastIndexOf("#"); - if (qindex >= 0) { // query and maybe fragment - if (findex >= 0 && findex > qindex) {// both - fragment = remainder.substring(findex + 1, remainder.length()); - remainder = remainder.substring(0, findex); - } - query = remainder.substring(qindex + 1, remainder.length()); - remainder = remainder.substring(0, qindex); - } else if (findex >= 0) { // fragment, no query - fragment = remainder.substring(findex + 1, remainder.length()); - remainder = remainder.substring(0, findex); - } - - // Standardize path part to be absolute - // => single leading '/' or windows drive letter - StringBuilder buf = new StringBuilder(remainder); - for (int i = 0; i < remainder.length(); i++) { // remove all leading '/' - if (buf.charAt(i) != '/') - break; - buf.deleteCharAt(i); - } - // check for drive letter - if (DapUtil.DRIVELETTERS.indexOf(buf.charAt(0)) < 0 || buf.charAt(1) != ':') { // no drive letter, prepend '/' - buf.insert(0, '/'); - } - - remainder = buf.toString(); - this.path = remainder; - this.frag = fragment; - this.query = query; - } - - ////////////////////////////////////////////////// - // Accessors - - public String getOriginal() { - return originaluri; - } - - public String getBaseProtocol() { - return baseprotocol; - } - - public String getFormatProtocol() { - return this.formatprotocol; - } - - public void setBaseProtocol(String base) { - this.baseprotocol = base; - } - - public boolean isFile() { - return this.isfile; - } - - public String getUserinfo() { - return this.userinfo; - } - - public String getHost() { - return this.host; - } - - public String getPath() { - return this.path; - } - - public String getQuery() { - return this.query; - } - - public String getFrag() { - return this.frag; - } - - public Map getQueryFields() { - return this.queryfields; - } - - public Map getFragFields() { - return this.fragfields; - } - - public XURI parseQuery(String q) { - if (q == null || q.length() == 0) - return this; - String[] params = q.split(QUERYSEP); - this.query = q; - for (String param : params) { - String[] pair = param.split("[=]"); - String name = Escape.urlDecode(pair[0]); - name = name.toLowerCase(); // for consistent lookup - String value = ""; - if (pair.length > 1) { - value = Escape.urlDecode(pair[1]); - this.queryfields.put(name, value); - } - } - return this; - } - - public XURI parseFragment(String f) { - if (f == null || f.length() == 0) - return this; - String[] params = f.split(FRAGMENTSEP); - if (params != null && params.length > 0) { - this.frag = f; - for (String param : params) { - String[] pair = param.split("="); - String name = Escape.urlDecode(pair[0]); - name = name.toLowerCase(); // for consistent lookup - String value = (pair.length == 2 ? Escape.urlDecode(pair[1]) : ""); - this.fragfields.put(name, value); - } - } - return this; - } - - ////////////////////////////////////////////////// - // API - - /** - * Reassemble the url using the specified parts - * - * @param parts to include - * @return the assembled uri - */ - - public String assemble(EnumSet parts) { - StringBuilder uri = new StringBuilder(); - // Note that format and base may be same, so case it out - int useformat = (parts.contains(Parts.FORMAT) ? 1 : 0); - int usebase = (parts.contains(Parts.BASE) ? 2 : 0); - switch (useformat + usebase) { - case 0 + 0: // neither - break; - case 1 + 0: // FORMAT only - uri.append(this.formatprotocol + ":"); - break; - case 2 + 0: // BASE only - uri.append(this.baseprotocol + ":"); - break; - case 2 + 1: // both - uri.append(this.formatprotocol + ":"); - if (!this.baseprotocol.equals(this.formatprotocol)) - uri.append(this.formatprotocol + ":"); - break; - } - uri.append(this.baseprotocol.equals("file") ? "/" : "//"); - - if (userinfo != null && parts.contains(Parts.PWD)) - uri.append(this.userinfo + ":"); - if (this.host != null && parts.contains(Parts.HOST)) - uri.append(this.host); - if (this.path != null && parts.contains(Parts.PATH)) - uri.append(this.path); - if (this.query != null && parts.contains(Parts.QUERY)) - uri.append("?" + this.query); - if (this.frag != null && parts.contains(Parts.FRAG)) - uri.append("#" + this.frag); - return uri.toString(); - } - - - /** - * Canonicalize a part of a URL - * - * @param s part of the url - */ - public static String canonical(String s) { - if (s != null) { - s = s.trim(); - if (s.length() == 0) - s = null; - } - return s; - } - - public String toString() { - return originaluri; - } -} - diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/keep.jar b/dap4/d4lib/src/main/java/dap4/dap4lib/keep.jar deleted file mode 100644 index deb03e6d00..0000000000 Binary files a/dap4/d4lib/src/main/java/dap4/dap4lib/keep.jar and /dev/null differ diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java b/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java deleted file mode 100644 index ef41bbb618..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.netcdf; - -import com.sun.jna.Native; -import dap4.core.data.DataCursor; -import dap4.core.dmr.*; -import dap4.core.util.*; -import dap4.dap4lib.AbstractCursor; -import dap4.dap4lib.LibTypeFcns; -import ucar.nc2.jni.netcdf.Nc4prototypes; -import ucar.nc2.jni.netcdf.SizeT; -import java.lang.reflect.Array; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import static dap4.dap4lib.netcdf.Nc4DSP.Nc4Pointer; -import static dap4.dap4lib.netcdf.Nc4Notes.*; - - -public class Nc4Cursor extends AbstractCursor { - - ////////////////////////////////////////////////// - - public static boolean DEBUG = false; - - // if the default charset being used by java isn't UTF-8, then we will - // need to transcode any string read into netCDf-Java via netCDF-C - private static final boolean transcodeStrings = Charset.defaultCharset() != StandardCharsets.UTF_8; - - ////////////////////////////////////////////////// - // Instance variables - - protected Nc4Pointer memory = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public Nc4Cursor(Scheme scheme, Nc4DSP dsp, DapVariable template, Nc4Cursor container) throws DapException { - super(scheme, dsp, template, container); - if (DEBUG) - debug(); - } - - public Nc4Cursor(Nc4Cursor c) { - super(c); - assert false; - this.memory = c.getMemory(); - } - - ////////////////////////////////////////////////// - // AbstractCursor Interface API Implementations - - @Override - public Object read(Index index) throws DapException { - return read(DapUtil.indexToSlices(index)); - } - - @Override - public Object read(List slices) throws DapException { - switch (this.scheme) { - case ATOMIC: - return readAtomic(slices); - case STRUCTURE: - case SEQUENCE: - if (((DapVariable) this.getTemplate()).getRank() > 0 || DapUtil.isScalarSlices(slices)) - throw new DapException("Cannot slice a scalar variable"); - return this; - case STRUCTARRAY: - Odometer odom = Odometer.factory(slices); - DataCursor[] instances = new DataCursor[(int) odom.totalSize()]; - for (int i = 0; odom.hasNext(); i++) { - instances[i] = readStructure(odom.next()); - } - return instances; - case SEQARRAY: - odom = Odometer.factory(slices); - instances = new DataCursor[(int) odom.totalSize()]; - for (int i = 0; odom.hasNext(); i++) { - instances[i] = readSequence(odom.next()); - } - return instances; - default: - throw new DapException("Attempt to slice a scalar object"); - } - } - - @Override - public Nc4Cursor readField(int findex) throws DapException { - // Preliminaries - DapVariable template = (DapVariable) getTemplate(); - DapStructure struct = (DapStructure) template.getBaseType(); - if (findex < 0 || findex >= struct.getFields().size()) - throw new DapException("Field index out of range: " + findex); - DapVariable field = struct.getField(findex); - // Get VarNotes and TypeNotes - VarNotes fi = (VarNotes) ((Nc4DSP) getDSP()).find(field); - TypeNotes ti = fi.getBaseType(); - Nc4Cursor cursor = new Nc4Cursor(schemeFor(field), (Nc4DSP) this.dsp, field, this); - Nc4Pointer mem = getMemory(); - // Handle records and structures somewhat differently - if (this.scheme == scheme.STRUCTURE) { - // do nothing - } else if (this.getScheme() == Scheme.RECORD) { - if (findex != 0) // need to use the first field of the sequence - throw new DapException("Field index out of range: " + findex); - // For fields, the record memory and the field memory are the same - // because the record contains only 1 rank-0 field. - } else // Error - throw new DapException("readfield expected STRUCTURE or RECORD cursor"); - cursor.setMemory(mem); - return cursor; - } - - @Override - public long getRecordCount() { - assert (this.scheme == scheme.SEQUENCE); - if (this.recordcount < 0) - throw new IllegalStateException("Sequence has no record count"); - return this.recordcount; - } - - @Override - public Nc4Cursor readRecord(long recno) throws DapException { - assert (this.scheme == scheme.SEQUENCE); - DapVariable template = (DapVariable) getTemplate(); - if (recno < 0 || recno >= getRecordCount()) - throw new ArrayIndexOutOfBoundsException("Illegal record id: " + recno); - VarNotes vn = (VarNotes) ((Nc4DSP) getDSP()).find(template); - TypeNotes ti = vn.getBaseType(); - assert (ti.isVlen()); - DapStructure ds = (DapStructure) template.getBaseType(); - DapVariable field = ds.getField(0); - DapType ftype = field.getBaseType(); - TypeNotes fnotes = (TypeNotes) ((Nc4DSP) getDSP()).find(ftype); - // The memory is a vector of objects, where the object type - // is the type of the first field of the sequence - // We need to extract the recno'th object from our memory - Nc4Pointer record = getMemory(); // should be the vector of records - long recsize = getElementSize(fnotes); - // point to the recno element in the vector - record = record.share(recno * recsize, recsize); - Nc4Cursor rec = new Nc4Cursor(Scheme.RECORD, (Nc4DSP) getDSP(), (DapVariable) getTemplate(), this); - /* - * Nc4Pointer seqvlen = getMemory(); - * long vlensize = Nc4prototypes.Vlen_t.VLENSIZE; - * Nc4Pointer recnovlen = seqvlen.share(vlensize*recno,vlensize); // recno'th vlen - * Nc4prototypes.Vlen_t vleninstance = new Nc4prototypes.Vlen_t(recnovlen.p); - * vleninstance.read(); // get the actual vlen contents for this sequence - * Pointer vlenmem = vleninstance.p; - * int vlencount = vleninstance.len; - * TypeNotes fvtype = getVlenType(field); - * long elemsize = fvtype.getSize(); // vlen.p is vector of objects of this size - * Nc4Pointer objectvec = new Nc4Pointer(vlenmem, elemsize * vlencount); - * // Now, we want the recno'th object in the vector - * Nc4Pointer record = objectvec.share(elemsize * recno, elemsize); - */ - rec.setMemory(record).setRecordIndex(recno); - return rec; - } - - - @Override - public Index getIndex() throws DapException { - if (this.scheme != Scheme.STRUCTURE && this.scheme != Scheme.SEQUENCE) - throw new DapException("Not a Sequence|Structure instance"); - return this.arrayindex; - } - - ////////////////////////////////////////////////// - // Support Methods - - protected Object readAtomic(List slices) throws DapException { - if (slices == null) - throw new DapException("DataCursor.read: null set of slices"); - assert (this.scheme == scheme.ATOMIC); - DapVariable atomvar = (DapVariable) getTemplate(); - int rank = atomvar.getRank(); - assert slices != null && ((rank == 0 && slices.size() == 1) || (slices.size() == rank)); - // Get VarNotes and TypeNotes - Notes n = ((Nc4DSP) this.dsp).find(this.template); - Object result = null; - long count = DapUtil.sliceProduct(slices); - VarNotes vn = (VarNotes) n; - TypeNotes ti = vn.getBaseType(); - if (getContainer() == null) { - if (rank == 0) { // scalar - result = readAtomicScalar(vn, ti); - } else { - result = readAtomicVector(vn, ti, count, slices); - } - } else {// field of a structure instance or record - long elemsize = ((DapType) ti.get()).getSize(); - assert (this.container != null); - long trueoffset = computeTrueOffset(this); - Nc4Pointer varmem = getMemory(); - Nc4Pointer mem = varmem.share(trueoffset, count * elemsize); - result = getatomicdata(ti.getType(), count, elemsize, mem); - } - return result; - } - - /** - * Read a top-level scalar atomic variable - * - * @param vi - * @param ti - * @return Object scalar - * @throws DapException - */ - protected Object readAtomicScalar(VarNotes vi, TypeNotes ti) throws DapException { - DapVariable atomvar = (DapVariable) getTemplate(); - // Get into memory - Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI(); - int ret; - DapType basetype = ti.getType(); - Object result = null; - if (basetype.isFixedSize()) { - long memsize = ((DapType) ti.get()).getSize(); - Nc4Pointer mem = Nc4Pointer.allocate(memsize); - readcheck(nc4, ret = nc4.nc_get_var(vi.gid, vi.id, mem.p)); - setMemory(mem); - result = getatomicdata(ti.getType(), 1, mem.size, mem); - } else if (basetype.isStringType()) { - String[] s = new String[1]; - readcheck(nc4, ret = nc4.nc_get_var_string(vi.gid, vi.id, s)); - if (transcodeStrings) { - s = transcodeString(s); - } - result = s; - } else if (basetype.isOpaqueType()) { - Nc4Pointer mem = Nc4Pointer.allocate(ti.getSize()); - readcheck(nc4, ret = nc4.nc_get_var(vi.gid, vi.id, mem.p)); - setMemory(mem); - ByteBuffer[] buf = new ByteBuffer[1]; - buf[0] = mem.p.getByteBuffer(0, ti.getSize()); - result = buf; - } else - throw new DapException("Unexpected atomic type: " + basetype); - return result; - } - - protected Object readAtomicVector(VarNotes vi, TypeNotes ti, long count, List slices) throws DapException { - DapVariable atomvar = (DapVariable) getTemplate(); - DapType basetype = ti.getType(); - if (atomvar.getCount() == 0) - return LibTypeFcns.newVector(basetype, 0); - // Convert slices to (start,count,stride); - int rank = atomvar.getRank(); - List dimset = atomvar.getDimensions(); - Odometer odom = Odometer.factory(slices, dimset); - List subodoms = odom.getSubOdometers(); - // Compute the total size of returned objects - long totalsize = 0; - for (int i = 0; i < subodoms.size(); i++) { - Odometer ithodom = subodoms.get(i); - totalsize += ithodom.totalSize(); - } - Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI(); - SizeT[] startp = new SizeT[rank]; - SizeT[] countp = new SizeT[rank]; - SizeT[] stridep = new SizeT[rank]; - int ret; - long edgecount; - Odometer ithodom; - Object partialresult; - Object result = LibTypeFcns.newVector(basetype, totalsize); - int pos = 0; - for (int i = 0; i < subodoms.size(); i++) { - ithodom = subodoms.get(i); - edgecount = odomToEdges(ithodom, startp, countp, stridep); - if (basetype.isFixedSize()) { - long elemsize = ti.getSize(); - long memsize = edgecount * elemsize; - Nc4Pointer mem = Nc4Pointer.allocate(memsize); - readcheck(nc4, ret = nc4.nc_get_vars(vi.gid, vi.id, startp, countp, stridep, mem.p)); - partialresult = getatomicdata(ti.getType(), edgecount, elemsize, mem); - } else if (basetype.isStringType()) { - String[] ss = new String[(int) edgecount]; - readcheck(nc4, ret = nc4.nc_get_vars_string(vi.gid, vi.id, startp, countp, stridep, ss)); - if (transcodeStrings) { - ss = transcodeString(ss); - } - partialresult = ss; - } else if (basetype.isOpaqueType()) { - long elemsize = ti.getSize(); - edgecount = odomToEdges(ithodom, startp, countp, stridep); - long memsize = edgecount * elemsize; - Nc4Pointer mem = Nc4Pointer.allocate(memsize); - readcheck(nc4, ret = nc4.nc_get_vars(vi.gid, vi.id, startp, countp, stridep, mem.p)); - partialresult = new ByteBuffer[(int) edgecount]; - for (int ec = 0; ec < edgecount; ec++) { - byte[] buf = mem.p.getByteArray(ec * ti.getSize(), (int) ti.getSize()); - ((ByteBuffer[]) partialresult)[ec] = ByteBuffer.wrap(buf); - } - } else - throw new DapException("Unexpected atomic type: " + basetype); - int len = Array.getLength(partialresult); - System.arraycopy(partialresult, 0, result, pos, len); - pos += len; - } - return result; - } - - protected Nc4Cursor readStructure(Index index) throws DapException { - assert (index != null); - assert this.scheme == Scheme.STRUCTARRAY; - DapVariable template = (DapVariable) getTemplate(); - VarNotes vi = (VarNotes) ((Nc4DSP) this.dsp).find(template); - TypeNotes ti = vi.basetype; - Nc4Pointer mem; - Nc4Cursor cursor = null; - if (template.isTopLevel()) { - int ret; - mem = Nc4Pointer.allocate(ti.getSize()); - Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI(); - if (index.getRank() == 0) { - readcheck(nc4, ret = nc4.nc_get_var(vi.gid, vi.id, mem.p)); - } else { - SizeT[] sizes = indexToSizes(index); - readcheck(nc4, ret = nc4.nc_get_var1(vi.gid, vi.id, sizes, mem.p)); - } - cursor = new Nc4Cursor(Scheme.STRUCTURE, (Nc4DSP) this.dsp, template, this); - } else {// field of a structure instance or record - long pos = index.index(); - if (pos < 0 || pos >= template.getCount()) - throw new IndexOutOfBoundsException("read: " + index); - cursor = new Nc4Cursor(Scheme.STRUCTURE, (Nc4DSP) this.dsp, template, this); - // Ok, we need to operate relative to the parent's memory - // move to the appropriate offset - mem = ((Nc4Cursor) getContainer()).getMemory().share(pos * ti.getSize(), ti.getSize()); - } - cursor.setIndex(index); - cursor.setMemory(mem); - return cursor; - } - - protected Nc4Cursor readSequence(Index index) throws DapException { - assert (index != null); - assert this.scheme == Scheme.SEQARRAY; - DapVariable template = (DapVariable) getTemplate(); - VarNotes vi = (VarNotes) ((Nc4DSP) this.dsp).find(template); - TypeNotes ti = vi.basetype; - Nc4Pointer mem; - Nc4Cursor cursor = null; - Nc4prototypes.Vlen_t[] vlen = new Nc4prototypes.Vlen_t[1]; - // Given a seq var e.g v(d1,d2), where we have an index argument, - // get that object, which will be a vlen - if (template.isTopLevel()) { - int ret; - Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI(); - SizeT[] extents = indexToSizes(index); - // read te index't vlen - readcheck(nc4, ret = nc4.nc_get_var1(vi.gid, vi.id, extents, vlen)); - } else {// field of a structure instance or record - long pos = index.index(); - if (pos < 0 || pos >= template.getCount()) - throw new IndexOutOfBoundsException("read: " + index); - // The memory for a sequence field is the vector of vlen objects. - // We need to extract the index'th vlen for this field - Nc4Pointer pp = getMemory(); // should be the vector - int vlensize = Nc4prototypes.Vlen_t.VLENSIZE; - // point to the index'th element in the vector - pp = pp.share(pos * vlensize, vlensize); - // convert to a Vlen_T object - vlen[0] = new Nc4prototypes.Vlen_t(pp.p); - vlen[0].read(); - } - // At this point, vlen[0] is the index'th vlen - // Construct a sequence cursor whose memory is the memory of the vlen - // (which is the vector of records) - cursor = new Nc4Cursor(Scheme.SEQUENCE, (Nc4DSP) this.dsp, template, this); - cursor.setRecordCount(vlen[0].len); - long memsize = ti.getSize() * cursor.getRecordCount(); - mem = new Nc4Pointer(vlen[0].p, memsize); - cursor.setMemory(mem); - cursor.setIndex(index); - return cursor; - } - - ////////////////////////////////////////////////// - // Nc4Cursor Extensions - - public long getOffset() { - DapVariable dv = (DapVariable) getTemplate(); - Notes n = ((Nc4DSP) this.dsp).find(dv); - return n.getOffset(); - } - - public long getElementSize() { - DapVariable dv = (DapVariable) getTemplate(); - Notes n = ((Nc4DSP) this.dsp).find(dv); - return n.getSize(); - } - - public Nc4Pointer getMemory() { - return this.memory; - } - - public Nc4Cursor setMemory(Nc4Pointer p) { - this.memory = p; - return this; - } - - ////////////////////////////////////////////////// - // Utilities - - protected long getElementSize(TypeNotes ti) { - DapType type = ti.getType(); - switch (type.getTypeSort()) { - case Structure: - case Sequence: - return ti.getSize(); - case String: - case URL: - // 8/16/2019 jlcaron upgrade to jna 5.4.0 - // com.sun.jna.Pointer#SIZE is removed. Its use is replaced by - // com.sun.jna.Native#POINTER_SIZE to prevent a class loading deadlock, when JNA is initialized from multiple - // threads - return Native.POINTER_SIZE; - case Enum: - return getElementSize((TypeNotes) ((Nc4DSP) getDSP()).find(ti.enumbase, NoteSort.TYPE)); - case Opaque: - return ti.getSize(); - default: - return type.getSize(); - } - } - - protected Object getatomicdata(DapType basetype, long lcount, long elemsize, Nc4Pointer mem) { - Object result = null; - TypeSort sort = basetype.getTypeSort(); - int icount = (int) lcount; - switch (sort) { - case Char: - // need to extract and convert utf8(really ascii) -> utf16 - byte[] bresult = mem.p.getByteArray(0, icount); - char[] cresult = new char[bresult.length]; - for (int i = 0; i < icount; i++) { - int ascii = bresult[i]; - ascii = ascii & 0x7F; - cresult[i] = (char) ascii; - } - result = cresult; - break; - case UInt8: - case Int8: - result = mem.p.getByteArray(0, icount); - break; - case Int16: - case UInt16: - result = mem.p.getShortArray(0, icount); - break; - case Int32: - case UInt32: - result = mem.p.getIntArray(0, icount); - break; - case Int64: - case UInt64: - result = mem.p.getLongArray(0, icount); - break; - case Float32: - result = mem.p.getFloatArray(0, icount); - break; - case Float64: - result = mem.p.getDoubleArray(0, icount); - break; - case String: - case URL: - // TODO: properly free underlying strings - result = mem.p.getStringArray(0, icount); - break; - case Opaque: - ByteBuffer[] ops = new ByteBuffer[icount]; - result = ops; - for (int i = 0; i < icount; i++) { - ops[i] = mem.p.getByteBuffer(i * elemsize, elemsize); - } - break; - case Enum: - DapEnumeration de = (DapEnumeration) basetype; - result = getatomicdata((DapType) de.getBaseType(), lcount, elemsize, mem); - break; - } - return result; - } - - static long odomToEdges(Odometer odom, SizeT[] startp, SizeT[] countp, SizeT[] stridep) { - assert !odom.isMulti(); - int rank = odom.rank(); - List slices = odom.getSlices(); - for (int i = 0; i < rank; i++) { - Slice slice = slices.get(i); - startp[i] = new SizeT(slice.getFirst()); - countp[i] = new SizeT(slice.getCount()); - stridep[i] = new SizeT(slice.getStride()); - } - return DapUtil.sliceProduct(slices); - } - - public static void errcheck(Nc4prototypes nc4, int ret) throws DapException { - if (ret != 0) { - String msg = String.format("Netcdf: errno=%d; %s", ret, nc4.nc_strerror(ret)); - throw new DapException(msg); - } - } - - public static void readcheck(Nc4prototypes nc4, int ret) throws DapException { - try { - errcheck(nc4, ret); - } catch (DapException de) { - throw new DapException(de); - } - } - - static SizeT[] indexToSizes(Index index) { - SizeT[] sizes = new SizeT[index.getRank()]; - for (int i = 0; i < sizes.length; i++) { - sizes[i] = new SizeT(index.get(i)); - } - return sizes; - } - - /** - * Given a field ref, compute the true offset with respect to - * it top-level containing structure/record - * - * @param f field cursor - * @return - * @throws DapException - */ - long computeTrueOffset(Nc4Cursor f) throws DapException { - List path = getCursorPath(f); - long totaloffset = 0; - Nc4Cursor current; - - // First element is presumed to be a structure ore record variable, - // and that its memory covers only it's instance. - // Walk intermediate nodes - for (int i = 1; i < (path.size() - 1); i++) { - current = path.get(i); - DapVariable template = (DapVariable) current.getTemplate(); - VarNotes vi = (VarNotes) ((Nc4DSP) getDSP()).find(template); - - long size = vi.getSize(); - long offset = current.getOffset(); - long pos = 0; - switch (current.getScheme()) { - case SEQUENCE: - case STRUCTURE: - pos = current.getIndex().index(); - break; - case RECORD: - // readrecord will have set our memory to the start of the record - pos = 0; - break; - default: - throw new DapException("Illegal cursor type: " + current.getScheme()); - } - long delta = size * pos + offset; - totaloffset += delta; - } - assert path.get(path.size() - 1) == f; - totaloffset += f.getOffset(); - return totaloffset; - } - - /** - * Given a cursor, get a list of "containing" cursors - * with the following constraints. - * 1. the first element in the path is a top-level variable. - * 2. the remaining elements are the enclosing compound variables - * 3. the last element is the incoming cursor. - * - * @param cursor - * @return - */ - static List getCursorPath(Nc4Cursor cursor) { - List path = new ArrayList<>(); - for (;;) { - if (!cursor.getScheme().isCompoundArray()) // suppress - path.add(0, cursor); - if (cursor.getScheme() == Scheme.SEQUENCE) { - // Stop here because the sequence has the vlen mem as its mem - break; - } - Nc4Cursor next = (Nc4Cursor) cursor.getContainer(); - if (next == null) { - assert cursor.getTemplate().isTopLevel(); - break; - } - assert next.getTemplate().getSort() == DapSort.VARIABLE; - cursor = next; - } - return path; - } - - - static Nc4Pointer getVarMemory(Nc4Cursor cursor) { - while (cursor.getContainer() != null) { - cursor = (Nc4Cursor) cursor.getContainer(); - } - return cursor.getMemory(); - } - - /** - * If the basetype is sequence (=> isVlen()), - * then return the type of the first field of this sequence. - * Otherwise return null. - * - * @return the type of the first field - */ - public TypeNotes getVlenType(DapVariable v) { - DapType t = v.getBaseType(); - if (t.getSort() != DapSort.SEQUENCE || ((DapSequence) t).getFields().size() != 1) - throw new IllegalArgumentException(t.getFQN()); - DapSequence ds = (DapSequence) t; - DapVariable f0 = ds.getField(0); - DapType f0type = f0.getBaseType(); - return (TypeNotes) ((Nc4DSP) this.dsp).find(f0type); - } - - /** - * By default, JNA assumes strings coming into java from the C side are using - * the system encoding. However, netCDF-C encodes using UTF-8. Because of this, - * if we are on a platform where java is not using UTF-8 as the default encoding, - * we will need to transcode the incoming strings fix the incorrect assumption - * made by JNA. - * - * Note, we could set the system property jna.encode=UTF-8, but would impact the - * behavior of other libraries that use JNA, and would not be very nice of us to - * set globally (and often times isn't the right thing to set anyways, since the - * default in C to use the system encoding). - * - * @param systemStrings String array encoded using the default charset - * @return String array encoded using the UTF-8 charset - */ - private String[] transcodeString(String[] systemStrings) { - return Arrays.stream(systemStrings).map(systemString -> { - byte[] byteArray = systemString.getBytes(Charset.defaultCharset()); - return new String(byteArray, StandardCharsets.UTF_8); - }).toArray(String[]::new); - } - - protected void debug() { - System.err.printf("CURSOR: %s%n", this.toString()); - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMR.java b/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMR.java deleted file mode 100644 index 3534f35845..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMR.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.netcdf; - -import dap4.core.dmr.*; - -public abstract class Nc4DMR { - ////////////////////////////////////////////////// - - public static class Nc4Attribute extends DapAttribute { - public Nc4Attribute(String name, DapType basetype) { - super(name, basetype); - } - } - - public static class Nc4AttributeSet extends DapAttributeSet { - public Nc4AttributeSet(String name) { - super(name); - } - } - - public static class Nc4Dimension extends DapDimension { - public Nc4Dimension(String name, long size) { - super(name, size); - } - } - - public static class Nc4Map extends DapMap { - public Nc4Map(DapVariable target) { - super(target); - } - } - - public static class Nc4Variable extends DapVariable { - public Nc4Variable(String name, DapType t) { - super(name, t); - } - } - - public static class Nc4Group extends DapGroup { - public Nc4Group(String name) { - super(name); - } - } - - public static class Nc4Dataset extends DapDataset { - public Nc4Dataset(String name) { - super(name); - } - } - - public static class Nc4Enumeration extends DapEnumeration { - public Nc4Enumeration(String name, DapType basetype) { - super(name, basetype); - } - } - - public static class Nc4EnumConst extends DapEnumConst { - public Nc4EnumConst(String name, long value) { - super(name, value); - } - } - - public static class Nc4Structure extends DapStructure { - public Nc4Structure(String name) { - super(name); - } - } - - public static class Nc4Sequence extends DapSequence { - public Nc4Sequence(String name) { - super(name); - } - } - - public static class Nc4OtherXML extends DapOtherXML { - public Nc4OtherXML(String name) { - super(name); - } - } -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMRCompiler.java b/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMRCompiler.java deleted file mode 100644 index cb8a546e59..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMRCompiler.java +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.netcdf; - -import com.sun.jna.Native; -import com.sun.jna.ptr.IntByReference; -import dap4.core.dmr.*; -import dap4.core.util.Convert; -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import ucar.nc2.ffi.netcdf.NetcdfClibrary; -import ucar.nc2.jni.netcdf.Nc4prototypes; -import ucar.nc2.jni.netcdf.SizeTByReference; -import static ucar.nc2.jni.netcdf.Nc4prototypes.*; -import static dap4.dap4lib.netcdf.Nc4DSP.*; -import static dap4.dap4lib.netcdf.Nc4Notes.*; - - -/** - * Compile netcdf file info into DMR - */ -public class Nc4DMRCompiler { - ////////////////////////////////////////////////// - // Constants - - public static final boolean DEBUG = false; - - // Define reserved attributes - public static final String UCARTAGVLEN = Nc4DSP.UCARTAGVLEN; - public static final String UCARTAGOPAQUE = Nc4DSP.UCARTAGOPAQUE; - - static final int NC_FALSE = 0; - static final int NC_TRUE = 1; - // "null" id(s) - public static final int NC_GRPNULL = 0; - public static final int NC_IDNULL = -1; - public static final int NC_NOERR = 0; - - static int NC_INT_BYTES = (java.lang.Integer.SIZE / java.lang.Byte.SIZE); - static int NC_LONG_BYTES = (Native.LONG_SIZE); - static int NC_POINTER_BYTES = (Native.POINTER_SIZE); - static int NC_SIZET_BYTES = (Native.SIZE_T_SIZE); - - protected static Nc4prototypes nc4 = NetcdfClibrary.getForeignFunctionInterface(); - - ////////////////////////////////////////////////// - // Static methods - - /** - * A path is file if it has no base protocol or is file: - * - * @param path - * @param context Any parameters that may help to decide. - * @return true if this path appears to be processible by this DSP - */ - public static boolean dspMatch(String path, DapContext context) { - for (String s : EXTENSIONS) { - if (path.endsWith(s)) - return true; - } - return false; - } - - ////////////////////////////////////////////////// - // Instance Variables - - protected boolean trace = false; - protected boolean closed = false; - - protected int ncid = -1; // file id - protected int format = 0; // from nc_inq_format - protected int mode = 0; - protected String path = null; - - protected String pathprefix = null; - - protected DMRFactory factory = null; - protected Nc4DSP dsp = null; - protected DapDataset dmr = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public Nc4DMRCompiler(Nc4DSP dsp, int ncid, DMRFactory factory) throws DapException { - this.dsp = dsp; - this.path = dsp.getLocation(); - this.ncid = ncid; - this.factory = factory; - } - - - ////////////////////////////////////////////////// - // Main entry point - - public DapDataset compile() throws DapException { - // create and fill the root group - buildrootgroup(this.ncid); - if (this.dmr != null) - dmr.finish(); - return this.dmr; - } - - ////////////////////////////////////////////////// - - protected void buildrootgroup(int ncid) throws DapException { - int ret; - byte[] namep = new byte[NC_MAX_NAME + 1]; - errcheck(ret = nc4.nc_inq_grpname(ncid, namep)); - String[] pieces = DapUtil.canonicalpath(this.path).split("[/]"); - DapDataset g = factory.newDataset(pieces[pieces.length - 1]); - GroupNotes gi = (GroupNotes) Nc4Notes.factory(NoteSort.GROUP, ncid, ncid, this.dsp); - gi.set(g); - this.dsp.note(gi); - this.dmr = g; - fillgroup(ncid); - } - - protected void fillgroup(int gid) throws DapException { - int ret, mode; - int[] dims = getDimensions(gid); - int[] udims = getUnlimitedDimensions(gid); - for (int dimid : dims) { - builddim(gid, dimid, udims); - } - int[] typeids = getUserTypes(gid); - for (int i = 0; i < typeids.length; i++) { - for (int j = 0; j < i; j++) { - if (typeids[i] == typeids[j]) - assert false; - } - } - - for (int typeid : typeids) { - buildusertype(gid, typeid); - } - int[] varids = getVars(gid); - for (int varid : varids) { - buildvar(gid, varid); - } - // globalattributes - String[] gattnames = getAttributes(gid, NC_GLOBAL); - for (String ga : gattnames) { - buildattr(gid, NC_GLOBAL, ga); - } - int[] groupids = getGroups(gid); - for (int groupid : groupids) { - buildgroup(gid, groupid); - } - } - - protected void buildgroup(int parent, int gid) throws DapException { - int ret; - byte[] namep = new byte[NC_MAX_NAME + 1]; - errcheck(ret = nc4.nc_inq_grpname(gid, namep)); - DapGroup g = factory.newGroup(Nc4DSP.makeString(namep)); - GroupNotes gi = (GroupNotes) Nc4Notes.factory(NoteSort.GROUP, parent, gid, this.dsp); - gi.set(g); - this.dsp.note(gi); - GroupNotes gp = (GroupNotes) this.dsp.find(parent, NoteSort.GROUP); - gp.get().addDecl(g); - fillgroup(gid); - } - - protected void builddim(int gid, int did, int[] udims) throws DapException { - int ret = NC_NOERR; - byte[] namep = new byte[NC_MAX_NAME + 1]; - SizeTByReference lenp = new SizeTByReference(); - errcheck(ret = nc4.nc_inq_dim(gid, did, namep, lenp)); - String name = Nc4DSP.makeString(namep); - int len = lenp.intValue(); - boolean isunlimited = contains(udims, did); - DapDimension dim = factory.newDimension(name, lenp.longValue()); - dim.setUnlimited(isunlimited); - DimNotes di = (DimNotes) Nc4Notes.factory(NoteSort.DIM, gid, did, this.dsp); - di.set(dim); - this.dsp.note(di); - GroupNotes gp = (GroupNotes) this.dsp.find(gid, NoteSort.GROUP); - gp.get().addDecl(dim); - if (trace) - System.out.printf("Nc4DSP: dimension: %s size=%d%n", name, dim.getSize()); - } - - protected void buildusertype(int gid, int tid) throws DapException { - int ret = NC_NOERR; - byte[] namep = new byte[NC_MAX_NAME + 1]; - SizeTByReference lenp = new SizeTByReference(); - IntByReference basetypep = new IntByReference(); - IntByReference classp = new IntByReference(); - SizeTByReference nfieldsp = new SizeTByReference(); - errcheck(ret = nc4.nc_inq_user_type(gid, tid, namep, lenp, basetypep, nfieldsp, classp)); - String name = Nc4DSP.makeString(namep); - int basetype = basetypep.getValue(); - long len = lenp.longValue(); - long nfields = nfieldsp.longValue(); - TypeNotes ti = (TypeNotes) Nc4Notes.factory(NoteSort.TYPE, gid, tid, this.dsp); - switch (classp.getValue()) { - case NC_OPAQUE: - buildopaquetype(ti, name, len); - break; - case NC_ENUM: - buildenumtype(ti, name, basetype); - break; - case NC_COMPOUND: - buildcompoundtype(ti, name, nfields, len); - break; - case NC_VLEN: - buildvlentype(ti, name, basetype, len); - break; - default: - throw new DapException("Unknown class: " + classp.getValue()); - } - } - - protected void buildopaquetype(TypeNotes ti, String name, long len) throws DapException { - int ret; - ti.setOpaque(len); - DapType dt = DapType.lookup(TypeSort.Opaque); - ti.set(dt); - this.dsp.note(ti); - } - - protected void buildenumtype(TypeNotes ti, String name, int basetype) throws DapException { - int ret; - SizeTByReference nmembersp = new SizeTByReference(); - SizeTByReference sizep = new SizeTByReference(); - byte[] namep = new byte[NC_MAX_NAME + 1]; - IntByReference basetypep = new IntByReference(); - IntByReference valuep = new IntByReference(); - TypeNotes base = (TypeNotes) this.dsp.find(basetype, NoteSort.TYPE); - if (!isintegertype(base)) - throw new DapException("Enum base type must be integer type"); - errcheck(ret = nc4.nc_inq_enum(ti.gid, ti.id, namep, basetypep, sizep, nmembersp)); - DapEnumeration de = factory.newEnumeration(name, DapType.lookup(base.getType().getTypeSort())); - ti.set(de); - this.dsp.note(ti); - ti.setEnumBaseType(basetype); - ti.group().addDecl(de); - // build list of enum consts - int nconsts = nmembersp.intValue(); - for (int i = 0; i < nconsts; i++) { - // Get info about the ith const - errcheck(ret = nc4.nc_inq_enum_member(ti.gid, ti.id, i, namep, valuep)); - String ecname = Nc4DSP.makeString(namep); - long ecval = (long) valuep.getValue(); - DapEnumConst dec = factory.newEnumConst(ecname, ecval); - de.addEnumConst(dec); - } - } - - protected void buildcompoundtype(TypeNotes ti, String name, long nfields, long len) throws DapException { - DapStructure ds = factory.newStructure(name); - ti.set(ds); - this.dsp.note(ti); - ti.group().addDecl(ds); - for (int i = 0; i < nfields; i++) { - buildfield(ti, i, ds); - } - // Finally, extract the size of the structure - int ret; - SizeTByReference sizep = new SizeTByReference(); - SizeTByReference nfieldsp = new SizeTByReference(); - byte[] namep = new byte[NC_MAX_NAME + 1]; - errcheck(ret = nc4.nc_inq_compound(ti.gid, ti.id, namep, sizep, nfieldsp)); - ti.setSize(sizep.longValue()); - assert len == sizep.longValue(); - assert name.equals(Nc4DSP.makeString(namep)); - // Add the netcdf4 name as an xml attribute. - ds.addXMLAttribute(UCARTAGORIGTYPE, name); - } - - protected void buildfield(TypeNotes ti, int fid, DapStructure container) throws DapException { - int ret; - byte[] namep = new byte[NC_MAX_NAME + 1]; - SizeTByReference offsetp = new SizeTByReference(); - IntByReference fieldtypep = new IntByReference(); - IntByReference ndimsp = new IntByReference(); - - // Get everything but actual dims - errcheck(ret = nc4.nc_inq_compound_field(ti.gid, ti.id, fid, namep, offsetp, fieldtypep, ndimsp, null)); - int fieldtype = fieldtypep.getValue(); - TypeNotes baset = (TypeNotes) this.dsp.find(fieldtype, NoteSort.TYPE); - if (baset == null) - throw new DapException("Undefined field base type: " + fieldtype); - int[] dimsizes = getFieldDimsizes(ti.gid, ti.id, fid, ndimsp.getValue()); - VarNotes fieldnotes = makeField(ti, fid, Nc4DSP.makeString(namep), baset, offsetp.intValue(), dimsizes); - assert baset.getSize() > 0; - } - - protected VarNotes makeField(TypeNotes container, int fieldid, String name, TypeNotes baset, int offset, - int[] dimsizes) throws DapException { - DapVariable field; - DapStructure ds = (DapStructure) container.getType(); - field = factory.newVariable(name, baset.getType()); - field.setParent(ds); - field.setFieldIndex(fieldid); - VarNotes notes = (VarNotes) Nc4Notes.factory(NoteSort.VAR, container.gid, container.id, this.dsp); - notes.setOffset(offset).setBaseType(baset).setContainer(container); - notes.set(field); - this.dsp.note(notes); - // set dimsizes - if (dimsizes.length > 0) { - for (int i = 0; i < dimsizes.length; i++) { - DapDimension dim = factory.newDimension(null, dimsizes[i]); - field.addDimension(dim); - } - } - ds.addField(field); - return notes; - } - - protected DapVariable buildvar(int gid, int vid) throws DapException { - int ret; - byte[] namep = new byte[NC_MAX_NAME + 1]; - IntByReference ndimsp = new IntByReference(); - IntByReference xtypep = new IntByReference(); - IntByReference nattsp = new IntByReference(); - errcheck(ret = nc4.nc_inq_var(gid, vid, namep, xtypep, ndimsp, null, nattsp)); - String name = Nc4DSP.makeString(namep); - TypeNotes xtype = (TypeNotes) this.dsp.find(xtypep.getValue(), NoteSort.TYPE); - if (DEBUG) { - System.err.printf("NC4: inqvar: name=%s gid=%d vid=%d xtype=%d ndims=%d natts=%d%n", name, gid, vid, xtype.id, - ndimsp.getValue(), nattsp.getValue()); - } - if (xtype == null) - throw new DapException("Unknown type id: " + xtype.id); - DapVariable var; - switch (((DapType) xtype.node).getTypeSort()) { - default: /* atomic */ - var = factory.newVariable(name, xtype.getType()); - break; - case Enum: - var = factory.newVariable(name, xtype.getType()); - break; - case Structure: - DapStructure st = (DapStructure) xtype.get(); - var = factory.newVariable(name, xtype.getType()); - break; - case Sequence: - DapSequence seq = (DapSequence) xtype.get(); - var = factory.newVariable(name, xtype.getType()); - break; - } - VarNotes vi = (VarNotes) Nc4Notes.factory(NoteSort.VAR, gid, vid, this.dsp); - vi.set(var); - this.dsp.note(vi); - vi.setBaseType(xtype); - vi.group().addDecl(var); - int[] dimids = getVardims(gid, vid, ndimsp.getValue()); - for (int i = 0; i < dimids.length; i++) { - DimNotes di = (DimNotes) this.dsp.find(dimids[i], NoteSort.DIM); - if (di == null) - throw new DapException("Undefined variable dimension id: " + dimids[i]); - var.addDimension(di.get()); - } - // Now, if this is of type opaque, tag it with the size - if (xtype.isOpaque()) { - var.addXMLAttribute(UCARTAGOPAQUE, Long.toString(xtype.getSize())); - } - // fill in any attributes - String[] attnames = getAttributes(gid, vid); - for (String a : attnames) { - buildattr(gid, vid, a); - } - return var; - } - - protected void buildvlentype(TypeNotes ti, String vname, int basetypeid, long len) throws DapException { - int ref; - // We map vlen to a sequence with a single field of the - // basetype of the vlen. Field name is same as the vlen type. - // So we need to build two things: - // 1. a Sequence object - // 2. a Field - DapSequence ds = factory.newSequence(vname); - ti.set(ds); - this.dsp.note(ti); - ti.group().addDecl(ds); - ti.markVlen(); - TypeNotes fieldtype = (TypeNotes) this.dsp.find(basetypeid, NoteSort.TYPE); - if (fieldtype == null) - throw new DapException("Undefined vlen basetype: " + basetypeid); - VarNotes fieldnotes = makeField(ti, 0, vname, fieldtype, 0, new int[0]); - // Annotate to indicate that this came from a vlen - ds.addXMLAttribute(UCARTAGVLEN, "1"); - - // Annotate to indicate that the original type name - ds.addXMLAttribute(UCARTAGORIGTYPE, ds.getFQN()); - - // Finally, extract the size of the structure, which is the same - // as the size of the singleton field - ti.setRecordSize(fieldtype.getSize()); - ti.setSize(Nc4prototypes.Vlen_t.VLENSIZE); - } - - protected void buildattr(int gid, int vid, String name) throws DapException { - int ret; - boolean isglobal = (vid == NC_GLOBAL); - IntByReference basetypep = new IntByReference(); - errcheck(ret = nc4.nc_inq_atttype(gid, vid, name, basetypep)); - int basetype = basetypep.getValue(); - TypeNotes base = (TypeNotes) this.dsp.find(basetype, NoteSort.TYPE); - if (!islegalattrtype(base)) - throw new DapException("Non-atomic attribute types not supported: " + name); - SizeTByReference countp = new SizeTByReference(); - errcheck(ret = nc4.nc_inq_attlen(gid, vid, name, countp)); - // Get the values of the attribute - String[] values = getAttributeValues(gid, vid, name, base, countp.intValue()); - DapAttribute da = factory.newAttribute(name, (DapType) base.getType()); - da.setValues(values); - if (isglobal) { - GroupNotes gi = (GroupNotes) this.dsp.find(gid, NoteSort.GROUP); - gi.get().addAttribute(da); - } else { - VarNotes vi = this.dsp.findVar(gid, vid); - vi.get().addAttribute(da); - } - } - - ////////////////////////////////////////////////// - - int[] getGroups(int gid) throws DapException { - int ret, n; - IntByReference ip = new IntByReference(); - errcheck(ret = nc4.nc_inq_grps(gid, ip, null)); - n = ip.getValue(); - int[] grpids = null; - if (n > 0) { - grpids = new int[n]; - errcheck(ret = nc4.nc_inq_grps(gid, ip, grpids)); - } else - grpids = new int[0]; - return grpids; - } - - int[] getDimensions(int gid) throws DapException { - int ret, n; - IntByReference ip = new IntByReference(); - errcheck(ret = nc4.nc_inq_ndims(gid, ip)); - n = ip.getValue(); - int[] dimids = new int[n]; - if (n > 0) - errcheck(ret = nc4.nc_inq_dimids(gid, ip, dimids, NC_FALSE)); - return dimids; - } - - int[] getUnlimitedDimensions(int gid) throws DapException { - int ret, n; - IntByReference ip = new IntByReference(); - errcheck(ret = nc4.nc_inq_unlimdims(gid, ip, null)); - n = ip.getValue(); - int[] dimids = new int[n]; - if (n > 0) - errcheck(ret = nc4.nc_inq_unlimdims(gid, ip, dimids)); - return dimids; - } - - int[] getUserTypes(int gid) throws DapException { - int ret, n; - IntByReference ip = new IntByReference(); - errcheck(ret = nc4.nc_inq_typeids(gid, ip, null)); - n = ip.getValue(); - int[] typeids = new int[n]; - if (n > 0) - errcheck(ret = nc4.nc_inq_typeids(gid, ip, typeids)); - return typeids; - } - - int[] getVars(int gid) throws DapException { - int ret, n; - IntByReference ip = new IntByReference(); - errcheck(ret = nc4.nc_inq_nvars(gid, ip)); - n = ip.getValue(); - int[] ids = new int[n]; - if (n > 0) - errcheck(ret = nc4.nc_inq_varids(gid, ip, ids)); - return ids; - } - - int[] getVardims(int gid, int vid, int ndims) throws DapException { - int ret; - int[] dimids = new int[ndims]; - - if (ndims > 0) { - byte[] namep = new byte[NC_MAX_NAME + 1]; - IntByReference ndimsp = new IntByReference(); - errcheck(ret = nc4.nc_inq_var(gid, vid, null, null, ndimsp, dimids, null)); - } - return dimids; - } - - int[] getFieldDimsizes(int gid, int tid, int fid, int ndims) throws DapException { - int ret; - int[] dimsizes = new int[ndims]; - if (ndims > 0) { - IntByReference ndimsp = new IntByReference(); - errcheck(ret = nc4.nc_inq_compound_field(gid, tid, fid, null, null, null, ndimsp, dimsizes)); - } - return dimsizes; - } - - String[] getAttributes(int gid, int vid) throws DapException { - int ret, n; - boolean isglobal = (vid == NC_GLOBAL); - IntByReference nattsp = new IntByReference(); - byte[] namep = new byte[NC_MAX_NAME + 1]; - IntByReference ndimsp = new IntByReference(); - IntByReference xtypep = new IntByReference(); - if (isglobal) - errcheck(ret = nc4.nc_inq_natts(gid, nattsp)); - else { - errcheck(ret = nc4.nc_inq_var(gid, vid, namep, xtypep, ndimsp, null, nattsp)); - } - n = nattsp.getValue(); - String[] names = new String[n]; - for (int i = 0; i < n; i++) { - errcheck(ret = nc4.nc_inq_attname(gid, vid, i, namep)); - names[i] = Nc4DSP.makeString(namep); - } - return names; - } - - String[] getAttributeValues(int gid, int vid, String name, TypeNotes tn, int count) throws DapException { - int ret; - // Currently certain types only are allowed. - if (!islegalattrtype(tn)) - throw new DapException("Unsupported attribute type: " + tn.getType().getShortName()); - if (isenumtype(tn)) - tn = enumbasetype(tn); - Object vector = getRawAttributeValues(tn, count, gid, vid, name); - DapType basetype = tn.getType(); - // basetype == Char requires special pre-conversion - // since the nc file data is coming back as utf-8, not utf-16. - if (basetype.isCharType()) { - byte[] data = (byte[]) vector; // raw utf-8 - String sdata = new String(data, DapUtil.UTF8); - char[] cdata = sdata.toCharArray(); - count = cdata.length; - vector = cdata; - } - String[] values = (String[]) Convert.convert(DapType.STRING, basetype, vector); - return values; - } - - Object getRawAttributeValues(TypeNotes base, int count, int gid, int vid, String name) throws DapException { - int nativetypesize = base.getType().getSize(); - if (isstringtype(base)) - nativetypesize = NC_POINTER_BYTES; - else if (nativetypesize == 0) - throw new DapException("Illegal Type Sort:" + base.get().getShortName()); - Object values = null; - if (count > 0) { - int ret; - long totalsize = nativetypesize * count; - Nc4Pointer mem = Nc4Pointer.allocate(totalsize); - errcheck(ret = nc4.nc_get_att(gid, vid, name, mem.p)); - switch (base.getType().getTypeSort()) { - case Char: - values = mem.p.getByteArray(0, count); - break; - case Int8: - values = mem.p.getByteArray(0, count); - break; - case UInt8: - values = mem.p.getByteArray(0, count); - break; - case Int16: - values = mem.p.getShortArray(0, count); - break; - case UInt16: - values = mem.p.getShortArray(0, count); - break; - case Int32: - values = mem.p.getIntArray(0, count); - break; - case UInt32: - values = mem.p.getIntArray(0, count); - break; - case Int64: - values = mem.p.getLongArray(0, count); - break; - case UInt64: - values = mem.p.getLongArray(0, count); - break; - case Float32: - values = mem.p.getFloatArray(0, count); - break; - case Float64: - values = mem.p.getDoubleArray(0, count); - break; - case String: - values = mem.p.getStringArray(0, count); - break; - case Opaque: - values = mem.p.getByteArray(0, (int) totalsize); - break; - case Enum: - break; - default: - throw new IllegalArgumentException("Unexpected sort: " + base.getType().getShortName()); - } - } - return values; - } - - /* - * Object[] - * convert(int count, Object src, TypeNotes basetype) - * throws DapException - * { - * boolean isenum = isenumtype(basetype); - * boolean isopaque = basetype.isOpaque(); - * TypeNotes truetype = basetype; - * if(isenum) - * truetype = enumbasetype(basetype); - * - * Object[] dst; - * if(ischartype(basetype)) - * dst = new Character[count]; - * else - * dst = new Object[count]; - * try { - * for(int i = 0; i < dst.length; i++) { - * switch (basetype.getType().getTypeSort()) { - * case Char: - * if(src instanceof char[]) - * dst[i] = ((char[]) src)[i]; - * else - * dst[i] = (char) (((byte[]) src)[i]); - * break; - * case Int8: - * case UInt8: - * dst[i] = ((byte[]) src)[i]; - * break; - * case Int16: - * case UInt16: - * dst[i] = ((short[]) src)[i]; - * break; - * case Int32: - * case UInt32: - * dst[i] = ((int[]) src)[i]; - * break; - * case Int64: - * case UInt64: - * dst[i] = ((long[]) src)[i]; - * break; - * case Float32: - * dst[i] = ((float[]) src)[i]; - * break; - * case Float64: - * dst[i] = ((double[]) src)[i]; - * break; - * case String: - * dst[i] = ((String[]) src)[i]; - * break; - * case Opaque: - * byte[] alldata = (byte[]) src; - * int oplen = alldata.length / count; - * for(i = 0; i < count; i++) { - * dst[i] = new byte[oplen]; - * System.arraycopy(alldata, oplen * i, dst[i], 0, oplen); - * } - * break; - * case Enum: - * dst = convert(count, src, truetype); - * break; - * default: - * throw new IllegalArgumentException("Unexpected sort: " + basetype.getType().getShortName()); - * } - * } - * return dst; - * } catch (IllegalArgumentException | - * ArrayIndexOutOfBoundsException e - * ) { - * throw new DapException(e); - * } - * } - */ - - protected void errcheck(int ret) throws DapException { - if (ret != 0) { - String msg = String.format("TestNetcdf: errno=%d; %s", ret, nc4.nc_strerror(ret)); - if (DEBUG) - System.err.println(msg); - throw new DapException(msg); - } - } - - boolean contains(int[] list, int value) { - for (int i = 0; i < list.length; i++) { - if (list[i] == value) - return true; - } - return false; - } - - boolean islegalattrtype(TypeNotes nctype) { - return isatomictype(nctype) || isenumtype(nctype) || nctype.isOpaque(); - } - - boolean isatomictype(TypeNotes t) { - return (t.id <= NC_MAX_ATOMIC_TYPE); - } - - boolean isstringtype(TypeNotes nctype) { - return (nctype.id == NC_STRING); - } - - boolean ischartype(TypeNotes t) { - return (t.id == NC_CHAR); - } - - boolean isintegertype(TypeNotes t) { - return (t.id <= NC_UINT64 && t.id != NC_CHAR); - } - - boolean isenumtype(TypeNotes nctype) { - return (nctype == null ? false : nctype.getType().isEnumType()); - } - - TypeNotes enumbasetype(TypeNotes etype) { - if (etype == null || !etype.getType().isEnumType()) - return null; - DapType dt = ((DapEnumeration) etype.getType()).getBaseType(); - return (TypeNotes) this.dsp.find(dt); - } - - protected String Nc4FQN(TypeNotes t) throws DapException { - int ret = 0; - // get enclosing ncid fqn - SizeTByReference lenp = new SizeTByReference(); - errcheck(ret = nc4.nc_inq_grpname_len(t.gid, lenp)); - byte[] namep = new byte[lenp.intValue() + 1]; - errcheck(ret = nc4.nc_inq_grpname_full(t.gid, lenp, namep)); - return Nc4DSP.makeString(namep); - } -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DSP.java b/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DSP.java deleted file mode 100644 index 6c05c40251..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DSP.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -/* - * TODO: - * 1. make sure all nodes areproperly annotated - */ - - -package dap4.dap4lib.netcdf; - -import com.sun.jna.Memory; -import com.sun.jna.Native; -import com.sun.jna.Pointer; -import com.sun.jna.ptr.IntByReference; -import dap4.core.data.DataCursor; -import dap4.core.dmr.DMRFactory; -import dap4.core.dmr.DapNode; -import dap4.core.dmr.DapType; -import dap4.core.dmr.DapVariable; -import dap4.core.util.DapContext; -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import dap4.dap4lib.AbstractDSP; -import dap4.dap4lib.DapCodes; -import dap4.dap4lib.XURI; -import ucar.nc2.ffi.netcdf.NetcdfClibrary; -import ucar.nc2.jni.netcdf.Nc4prototypes; -import ucar.nc2.jni.netcdf.SizeTByReference; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Map; -import static dap4.dap4lib.netcdf.Nc4Notes.*; -import static ucar.nc2.jni.netcdf.Nc4prototypes.*; - -/** - * DSP for reading netcdf files through jni interface to netcdf4 library - */ -public class Nc4DSP extends AbstractDSP { - ////////////////////////////////////////////////// - // Constants - - public static final boolean DEBUG = false; - public static final boolean DUMPDMR = false; - - static String PATHSUFFIX = "/src/data"; - - public static String[] EXTENSIONS = new String[] {".nc", ".hdf5"}; - - static final Pointer NC_NULL = Pointer.NULL; - static final int NC_FALSE = 0; - static final int NC_TRUE = 1; - // "null" id(s) - public static final int NC_GRPNULL = 0; - public static final int NC_IDNULL = -1; - public static final int NC_NOERR = 0; - - static int NC_INT_BYTES = (java.lang.Integer.SIZE / java.lang.Byte.SIZE); - static int NC_LONG_BYTES = (Native.LONG_SIZE); - static int NC_POINTER_BYTES = (Native.POINTER_SIZE); - static int NC_SIZET_BYTES = (Native.SIZE_T_SIZE); - - protected static Nc4prototypes nc4 = NetcdfClibrary.getForeignFunctionInterface(); - - ////////////////////////////////////////////////// - // com.sun.jna.Memory control - - /** - * Provide a wrapper for pointers that tracks the size. - * Also allows for allocation. - */ - public static class Nc4Pointer { - public static Nc4Pointer allocate(long size) { - if (size == 0) - throw new IllegalArgumentException("Attempt to allocate zero bytes"); - Memory m = new Memory(size); - return new Nc4Pointer(m, size); - } - - public Pointer p; // alow direct access - public long size; // allow direct access - - public Nc4Pointer(Pointer p, long size) { - this.p = p; - this.size = size; - } - - public Nc4Pointer share(long offset, long size) { - try { - Pointer ps = p.share(offset, size); - Nc4Pointer newp = new Nc4Pointer(ps, size); - return newp; - } catch (IndexOutOfBoundsException e) { - return null; - } - } - - public String toString() { - return String.format("0x%016x/%d", Pointer.nativeValue(this.p), this.size); - } - - public static boolean validate(Nc4Pointer mem, long require) { - if (mem == null || mem.p == null || mem.size == 0) - return false; - return (mem.size > require); - } - } - - ////////////////////////////////////////////////// - // DSP Match API - - /** - * A path is file if it has no base protocol or is file: - * - * @param path - * @param context Any parameters that may help to decide. - * @return true if this path appears to be processible by this DSP - */ - public boolean dspMatch(String path, DapContext context) { - for (String s : EXTENSIONS) { - if (path.endsWith(s)) - return true; - } - return false; - } - - ////////////////////////////////////////////////// - // Notes Management - - protected Map> allnotes = null; - - /* package */ void note(Notes note) { - assert (this.allnotes != null); - int gid = note.gid; - int id = note.id; - NoteSort sort = note.getSort(); - Map sortnotes = this.allnotes.get(sort); - assert sortnotes != null; - switch (sort) { - case TYPE: - case GROUP: - case DIM: - assert sortnotes.get(id) == null; - sortnotes.put((long) id, note); - break; - case VAR: - long gv = Nc4Notes.getVarId((VarNotes) note); - assert sortnotes.get(gv) == null; - sortnotes.put(gv, note); - break; - } - } - - /* package */ VarNotes findVar(int gid, int varid) { - long gv = Nc4Notes.getVarId(gid, varid, -1); - return (VarNotes) find(gv, NoteSort.VAR); - } - - /* package */ VarNotes findField(int gid, int varid, int fid) { - long gv = Nc4Notes.getVarId(gid, varid, fid); - return (VarNotes) find(gv, NoteSort.VAR); - } - - public Notes find(long id, NoteSort sort) { - assert (this.allnotes != null); - Map sortnotes = this.allnotes.get(sort); - assert sortnotes != null; - return sortnotes.get((long) id); - } - - /* package */Notes find(DapNode node) { - NoteSort sort = noteSortFor(node); - assert (this.allnotes != null); - Map sortnotes = this.allnotes.get(sort); - assert sortnotes != null; - for (Map.Entry entries : sortnotes.entrySet()) { - Notes note = entries.getValue(); - if (note.get() == node) - return note; - } - return null; - } - - protected NoteSort noteSortFor(DapNode node) { - switch (node.getSort()) { - case ATOMICTYPE: - case STRUCTURE: - case SEQUENCE: - return NoteSort.TYPE; - case VARIABLE: - return NoteSort.VAR; - case GROUP: - case DATASET: - return NoteSort.GROUP; - case DIMENSION: - return NoteSort.DIM; - default: - break; - } - return null; - } - - protected void allnotesInit() { - this.allnotes = new HashMap<>(); - for (NoteSort s : NoteSort.values()) { - this.allnotes.put(s, new HashMap()); - } - Notes n; - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_BYTE, this); - n.set(DapType.INT8); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_CHAR, this); - n.set(DapType.CHAR); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_SHORT, this); - n.set(DapType.INT16); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_INT, this); - n.set(DapType.INT32); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_FLOAT, this); - n.set(DapType.FLOAT32); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_DOUBLE, this); - n.set(DapType.FLOAT64); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_UBYTE, this); - n.set(DapType.UINT8); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_USHORT, this); - n.set(DapType.UINT16); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_UINT, this); - n.set(DapType.UINT32); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_INT64, this); - n.set(DapType.INT64); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_UINT64, this); - n.set(DapType.UINT64); - this.note(n); - n = Nc4Notes.factory(NoteSort.TYPE, 0, NC_STRING, this); - n.set(DapType.STRING); - this.note(n); - - for (int i = NC_BYTE; i <= NC_MAX_ATOMIC_TYPE; i++) { - Nc4Notes.TypeNotes tn = (Nc4Notes.TypeNotes) find(i, NoteSort.TYPE); - assert tn != null; - int ret = 0; - byte[] namep = new byte[NC_MAX_NAME + 1]; - if (i == NC_STRING) { - // There is a bug in some versions of netcdf that does not - // handle NC_STRING correctly when the gid is invalid. - // Handle specially ; this is a temporary hack - // - // 8/16/2019 jlcaron upgrade to jna 5.4.0 - // com.sun.jna.Pointer#SIZE is removed. Its use is replaced by - // com.sun.jna.Native#POINTER_SIZE to prevent a class loading deadlock, when JNA is initialized from multiple - // threads - tn.setSize(Native.POINTER_SIZE); - } else { - SizeTByReference sizep = new SizeTByReference(); - try { - Nc4Cursor.errcheck(getJNI(), ret = nc4.nc_inq_type(0, i, namep, sizep)); - } catch (DapException e) { - e.printStackTrace(); - assert false; // should never happen - } - tn.setSize(sizep.intValue()); - } - } - } - - ////////////////////////////////////////////////// - // Instance Variables - - protected boolean trace = false; - protected boolean closed = false; - - protected int ncid = -1; // file id ; also set as DSP.source - protected int format = 0; // from nc_inq_format - protected int mode = 0; - protected String filepath = null; // real path to the dataset - - protected DMRFactory dmrfactory = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public Nc4DSP() throws DapException { - super(); - if (nc4 == null) { - throw new DapException("Could not load libnetcdf"); - } - dmrfactory = new DMRFactory(); - allnotesInit(); - } - - ////////////////////////////////////////////////// - // DSP API - - @Override - public Nc4DSP open(String filepath) throws DapException { - if (filepath.startsWith("file:")) - try { - XURI xuri = new XURI(filepath); - filepath = xuri.getPath(); - } catch (URISyntaxException use) { - throw new DapException("Malformed filepath: " + filepath).setCode(DapCodes.SC_NOT_FOUND); - } - int ret, mode; - IntByReference ncidp = new IntByReference(); - this.filepath = filepath; - try { - mode = NC_NOWRITE; - Nc4Cursor.errcheck(nc4, ret = nc4.nc_open(this.filepath, mode, ncidp)); - this.ncid = ncidp.getValue(); - // Figure out what kind of file - IntByReference formatp = new IntByReference(); - Nc4Cursor.errcheck(nc4, ret = nc4.nc_inq_format(ncid, formatp)); - this.format = formatp.getValue(); - if (DEBUG) - System.out.printf("TestNetcdf: open: %s; ncid=%d; format=%d%n", this.filepath, ncid, this.format); - // Compile the DMR - Nc4DMRCompiler dmrcompiler = new Nc4DMRCompiler(this, ncid, dmrfactory); - setDMR(dmrcompiler.compile()); - if (DEBUG || DUMPDMR) { - System.err.println("+++++++++++++++++++++"); - System.err.println(printDMR(getDMR())); - System.err.println("+++++++++++++++++++++"); - } - return this; - } catch (Exception t) { - t.printStackTrace(); - } - return null; - } - - @Override - public void close() throws DapException { - if (this.closed) - return; - if (this.ncid < 0) - return; - int ret = nc4.nc_close(ncid); - Nc4Cursor.errcheck(nc4, ret); - closed = true; - if (trace) - System.out.printf("Nc4DSP: closed: %s%n", this.filepath); - } - - @Override - public Nc4Cursor getVariableData(DapVariable var) throws DapException { - assert (var.isTopLevel()); - DapType type = var.getBaseType(); - Nc4Cursor vardata = (Nc4Cursor) super.getVariableData(var); - if (vardata == null) { - switch (type.getTypeSort()) { - case Structure: - vardata = new Nc4Cursor(DataCursor.Scheme.STRUCTARRAY, this, var, null); - break; - case Sequence: - vardata = new Nc4Cursor(DataCursor.Scheme.SEQARRAY, this, var, null); - break; - default: - if (!type.isAtomic()) - throw new DapException("Unexpected cursor type: " + type); - vardata = new Nc4Cursor(DataCursor.Scheme.ATOMIC, this, var, null); - break; - } - super.addVariableData(var, vardata); - } - assert var.isTopLevel(); - return vardata; - } - - ////////////////////////////////////////////////// - // Accessors - - - public Nc4prototypes getJNI() { - return nc4; - } - - @Override - public String getLocation() { - return this.filepath; - } - - ////////////////////////////////////////////////// - // Utilities - - public static String makeString(byte[] b) { - // null terminates - int count; - for (count = 0; (count < b.length && b[count] != 0); count++) { - ; - } - return new String(b, 0, count, DapUtil.UTF8); - } - - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Notes.java b/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Notes.java deleted file mode 100644 index a2f571a07a..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Notes.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.netcdf; - -import dap4.core.dmr.*; -import dap4.core.util.DapSort; -import dap4.core.util.DapUtil; - -/** - * Note that ideally, this info should be part of the - * Nc4DMR classes, but that would require multiple inheritance. - * Hence, we isolate that info here and add it to the instances - * via annotation - */ - -public abstract class Nc4Notes { - ////////////////////////////////////////////////// - // Constants - - // Mnemonics - public static final int NOGROUP = -1; - public static final int NOID = -1; - public static final int NOFIELDID = -1; - - ////////////////////////////////////////////////// - // Use a factory so we can debug constructor calls - - static Notes factory(NoteSort ns, int g, int id, Nc4DSP dsp) { - Notes note = null; - switch (ns) { - case TYPE: - note = new TypeNotes(g, id, dsp); - break; - case VAR: - note = new VarNotes(g, id, dsp); - break; - case DIM: - note = new DimNotes(g, id, dsp); - break; - case GROUP: - note = new GroupNotes(g, id, dsp); - break; - } - return note; - } - - ////////////////////////////////////////////////// - // Manage the compound id for variables - - public static long getVarId(VarNotes note) { - return getVarId(note.gid, note.id, note.getFieldIndex()); - } - - public static long getVarId(int gid, int varid, int ifid) { - long gv = ((long) gid) << 32; - assert varid < 0x100000; - gv = gv | ((long) varid) << 20; - long fid = (long) ifid; - if (fid >= 0) - gv |= fid; - return gv; - } - - ////////////////////////////////////////////////// - // Type Decls - - public static enum NoteSort { - TYPE, VAR, GROUP, DIM; - } - - public static class Notes implements Cloneable { - Nc4DSP dsp; // Need a place to store global state - NoteSort sort; - int gid; - int id; - DapNode node = null; - protected String name = null; - protected Notes parent = null; - protected TypeNotes basetype = null; - protected long offset = 0; - // For most types, there is only one size, - // but for vlen/sequence, there are two sizes: - // (1) the record size and (2) the instance size (= |vlen_t|); - protected long size = 0; - protected long recordsize = 0; - - protected Notes(NoteSort sort, int gid, int id, Nc4DSP dsp) { - this.sort = sort; - this.dsp = dsp; - this.gid = gid; - this.id = id; - } - - public NoteSort getSort() { - return this.sort; - } - - public Notes setName(String name) { - this.name = name; - return this; - } - - public Notes set(DapNode node) { - this.node = node; - if (this.name == null) - setName(node.getShortName()); - return this; - } - - public DapNode get() { - return this.node; - } - - public Notes setContainer(Notes parent) { - this.parent = parent; - return this; - } - - public Notes getContainer() { - return this.parent; - } - - public long getOffset() { - return this.offset; - } - - public Notes setOffset(long offset) { - this.offset = offset; - return this; - } - - public long getSize() { - return this.size; - } - - public Notes setSize(long size) { - this.size = size; - return this; - } - - public long getRecordSize() { - return this.recordsize; - } - - public Notes setRecordSize(long size) { - this.recordsize = size; - return this; - } - - public Notes setBaseType(TypeNotes t) { - this.basetype = t; - return this; - } - - public TypeNotes getBaseType() { - return this.basetype; - } - - DapGroup group() { - GroupNotes g = (GroupNotes) dsp.find(gid, NoteSort.GROUP); - return (g == null ? null : g.get()); - } - - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append(this.getClass().getName()); - buf.append("{"); - if (name != null) { - buf.append("name="); - buf.append(name); - } - buf.append(" node="); - buf.append(this.node != null ? this.node.getShortName() : "null"); - if (this.basetype != null) { - buf.append(" type="); - buf.append(this.node.getShortName()); - } - buf.append("}"); - return buf.toString(); - } - } - - public static class GroupNotes extends Notes { - protected GroupNotes(int p, int g, Nc4DSP dsp) { - super(NoteSort.GROUP, p, g, dsp); - } - - public DapGroup get() { - return (DapGroup) super.get(); - } - - public GroupNotes set(DapNode node) { - return (GroupNotes) super.set(node); - } - - } - - public static class DimNotes extends Notes { - protected DimNotes(int g, int id, Nc4DSP dsp) { - super(NoteSort.DIM, g, id, dsp); - } - - public DapDimension get() { - return (DapDimension) super.get(); - } - - public DimNotes set(DapNode node) { - return (DimNotes) super.set(node); - } - - } - - public static class TypeNotes extends Notes { - public int enumbase = -1; - public boolean isvlen = false; - - protected TypeNotes(int g, int id, Nc4DSP dsp) { - super(NoteSort.TYPE, g, id, dsp); - } - - public DapType getType() { - DapSort sort = this.node.getSort(); - switch (sort) { - case ATOMICTYPE: - case STRUCTURE: - case SEQUENCE: - return (DapType) super.get(); - case ENUMERATION: - return (DapEnumeration) super.get(); - case VARIABLE: - return ((DapVariable) super.get()).getBaseType(); - default: - break; - } - return null; - } - - public TypeNotes setOpaque(long len) { - super.setSize(len); - return this; - } - - public TypeNotes setEnumBaseType(int bt) { - this.enumbase = bt; - TypeNotes btt = (TypeNotes) this.dsp.find(bt, NoteSort.TYPE); - setSize(btt.getSize()); - return this; - } - - public boolean isOpaque() { - return getType().getTypeSort().isOpaqueType(); - } - - public boolean isEnum() { - return getType().getTypeSort().isEnumType(); - } - - public boolean isSeq() { - return getType().getTypeSort().isSeqType(); - } - - public boolean isCompound() { - return getType().getTypeSort().isCompoundType(); - } - - public boolean isVlen() { - return this.isvlen; - } - - public TypeNotes markVlen() { - this.isvlen = true; - return this; - } - - public DapType get() { - return (DapType) super.get(); - } - - public TypeNotes set(DapNode node) { - return (TypeNotes) super.set(node); - } - - } - - public static class VarNotes extends Notes { - protected VarNotes(int g, int v, Nc4DSP dsp) { - super(NoteSort.VAR, g, v, dsp); - } - - public VarNotes setBaseType(TypeNotes ti) { - return (VarNotes) super.setBaseType(ti); - } - - public DapVariable get() { - return (DapVariable) super.get(); - } - - public VarNotes set(DapNode node) { - return (VarNotes) super.set(node); - } - - public int getFieldIndex() { - assert this.get() != null; - return this.get().getFieldIndex(); - } - - @Override - public long getSize() { - return this.getBaseType().getSize() * DapUtil.dimProduct(get().getDimensions()); - } - - } -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4Cursor.java b/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4Cursor.java deleted file mode 100644 index 82979ab524..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4Cursor.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.serial; - -import dap4.core.dmr.*; -import dap4.core.util.*; -import dap4.dap4lib.AbstractCursor; -import dap4.dap4lib.LibTypeFcns; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; - - -public class D4Cursor extends AbstractCursor { - ////////////////////////////////////////////////// - // Mnemonics - static final long NULLOFFSET = -1; - - static final int D4LENSIZE = 8; - - ////////////////////////////////////////////////// - // Instance Variables - - protected long offset = NULLOFFSET; - - protected long[] bytestrings = null; - - // For debugging purposes, we keep these separate, - // but some merging could be done . - - // Track the array elements for a structure array - protected D4Cursor[] elements = null; // scheme == STRUCTARRAY|SEQARRAY - - // Track the fields of a structure instance - protected D4Cursor[] fieldcursors = null; // scheme == STRUCTURE|SEQUENCE - - // Track the records of a sequence instance - protected List records = null; // scheme == SEQUENCE - - ////////////////////////////////////////////////// - // Constructor(s) - - public D4Cursor(Scheme scheme, D4DSP dsp, DapNode template, D4Cursor container) { - super(scheme, dsp, template, container); - } - - /** - * Effectively a clone of c - * - * @param c cursor to clone - */ - public D4Cursor(D4Cursor c) { - super(c); - assert false; - this.offset = c.offset; - this.bytestrings = c.bytestrings; - this.fieldcursors = new D4Cursor[c.fieldcursors.length]; - for (int i = 0; i < c.fieldcursors.length; i++) { - D4Cursor dc = c.fieldcursors[i]; - this.fieldcursors[i] = new D4Cursor(dc); - this.fieldcursors[i].setContainer(this); // Change the parent in the clone - } - this.elements = new D4Cursor[c.elements.length]; - for (int i = 0; i < c.elements.length; i++) { - D4Cursor dc = c.elements[i]; - this.elements[i] = new D4Cursor(dc); - this.elements[i].setContainer(this); // Change the parent in the clone - } - this.records = new ArrayList<>(); - for (int i = 0; i < c.records.size(); i++) { - D4Cursor dc = c.records.get(i); - this.records.add(new D4Cursor(dc)); - this.records.get(i).setContainer(this); // Change the parent in the clone - } - } - - ////////////////////////////////////////////////// - // DataCursor API (Except as Implemented in AbstractCursor) - - - @Override - public Object read(Index index) throws DapException { - return read(DapUtil.indexToSlices(index)); - } - - @Override - public Object read(List slices) throws DapException { - switch (this.scheme) { - case ATOMIC: - return readAtomic(slices); - case STRUCTURE: - case SEQUENCE: - if (((DapVariable) this.getTemplate()).getRank() == 0 || DapUtil.isScalarSlices(slices)) - throw new DapException("Cannot slice a scalar variable"); - return new D4Cursor(this); - case STRUCTARRAY: - // Read the structures specified by slices - Odometer odom = Odometer.factory(slices); - D4Cursor[] instances = new D4Cursor[(int) odom.totalSize()]; - for (int i = 0; odom.hasNext(); i++) { - instances[i] = readStructure(odom.next()); - } - return instances; - case SEQARRAY: - odom = Odometer.factory(slices); - instances = new D4Cursor[(int) odom.totalSize()]; - for (int i = 0; odom.hasNext(); i++) { - instances[i] = readSequence(odom.next()); - } - return instances; - default: - throw new DapException("Attempt to slice a scalar object"); - } - } - - @Override - public D4Cursor readField(int findex) throws DapException { - assert (this.scheme == scheme.RECORD || this.scheme == scheme.STRUCTURE); - DapStructure basetype = (DapStructure) ((DapVariable) getTemplate()).getBaseType(); - if (findex < 0 || findex >= basetype.getFields().size()) - throw new DapException("Field index out of range: " + findex); - D4Cursor field = this.fieldcursors[findex]; - return field; - } - - @Override - public D4Cursor readRecord(long i) { - assert (this.scheme == Scheme.SEQUENCE); - if (this.records == null || i < 0 || i > this.records.size()) - throw new IndexOutOfBoundsException("No such record: " + i); - return this.records.get((int) i); - } - - @Override - public long getRecordCount() { - assert (this.scheme == Scheme.SEQUENCE); - return this.records == null ? 0 : this.records.size(); - } - - ////////////////////////////////////////////////// - // Support methods - - protected Object readAtomic(List slices) throws DapException { - if (slices == null) - throw new DapException("DataCursor.read: null set of slices"); - assert this.scheme == Scheme.ATOMIC; - DapVariable atomvar = (DapVariable) getTemplate(); - int rank = atomvar.getRank(); - assert slices != null && ((rank == 0 && slices.size() == 1) || (slices.size() == rank)); - DapType basetype = atomvar.getBaseType(); - return readAs(atomvar, basetype, slices); - } - - /** - * Allow specification of basetype to use; used for enumerations - * - * @param atomvar - * @param basetype - * @param slices - * @return Object of basetype - * @throws DapException - */ - protected Object readAs(DapVariable atomvar, DapType basetype, List slices) throws DapException { - if (basetype.getTypeSort() == TypeSort.Enum) {// short circuit this case - basetype = ((DapEnumeration) basetype).getBaseType(); - return readAs(atomvar, basetype, slices); - } - long count = DapUtil.sliceProduct(slices); - Object result = LibTypeFcns.newVector(basetype, count); - Odometer odom = Odometer.factory(slices); - if (DapUtil.isContiguous(slices) && basetype.isFixedSize()) - readContig(slices, basetype, count, odom, result); - else - readOdom(slices, basetype, odom, result); - return result; - } - - protected void readContig(List slices, DapType basetype, long count, Odometer odom, Object result) - throws DapException { - ByteBuffer alldata = ((D4DSP) this.dsp).getBuffer(); - long off = this.offset; - long ix = odom.indices().index(); - int elemsize = basetype.getSize(); - alldata.position((int) (off + (ix * elemsize))); - int icount = (int) count; - long totalsize = count * basetype.getSize(); - switch (basetype.getTypeSort()) { - case Int8: - case UInt8: - alldata.get((byte[]) result); - break; - case Char: // remember, we are reading 7-bit ascii, not utf-8 or utf-16 - byte[] ascii = new byte[icount]; - alldata.get(ascii); - for (int i = 0; i < icount; i++) { - ((char[]) result)[i] = (char) (ascii[i] & 0x7f); - } - break; - case Int16: - case UInt16: - alldata.asShortBuffer().get((short[]) result); - skip(totalsize, alldata); - break; - case Int32: - case UInt32: - alldata.asIntBuffer().get((int[]) result); - skip(totalsize, alldata); - break; - case Int64: - case UInt64: - alldata.asLongBuffer().get((long[]) result); - skip(totalsize, alldata); - break; - case Float32: - alldata.asFloatBuffer().get((float[]) result); - skip(totalsize, alldata); - break; - case Float64: - alldata.asDoubleBuffer().get((double[]) result); - skip(totalsize, alldata); - break; - default: - throw new DapException("Contiguous read not supported for type: " + basetype.getTypeSort()); - } - } - - protected Object readOdom(List slices, DapType basetype, Odometer odom, Object result) throws DapException { - ByteBuffer alldata = ((D4DSP) this.dsp).getBuffer(); - alldata.position((int) this.offset); - ByteBuffer slice = alldata.slice(); - slice.order(alldata.order()); - for (int i = 0; odom.hasNext(); i++) { - Index index = odom.next(); - int ipos = (int) index.index(); - switch (basetype.getTypeSort()) { - case Int8: - case UInt8: - ((byte[]) result)[i] = slice.get(ipos); - break; - case Char: // remember, we are reading 7-bit ascii, not utf-8 or utf-16 - byte ascii = slice.get(ipos); - ((char[]) result)[i] = (char) ascii; - break; - case Int16: - case UInt16: - ((short[]) result)[i] = slice.getShort(ipos); - break; - case Int32: - case UInt32: - ((int[]) result)[i] = slice.getInt(ipos); - break; - case Int64: - case UInt64: - ((long[]) result)[i] = slice.getLong(ipos); - break; - case Float32: - ((float[]) result)[i] = slice.getFloat(ipos); - break; - case Float64: - ((double[]) result)[i] = slice.getDouble(ipos); - break; - case String: - case URL: - int savepos = alldata.position(); - long pos = bytestrings[i]; - alldata.position((int) pos); // bytestring offsets are absolute - long n = getLength(alldata); - byte[] data = new byte[(int) n]; - alldata.get(data); - ((String[]) result)[i] = new String(data, DapUtil.UTF8); - alldata.position(savepos); - break; - case Opaque: - savepos = alldata.position(); - pos = bytestrings[i]; - alldata.position((int) pos); // bytestring offsets are absolute - n = getLength(alldata); - data = new byte[(int) n]; - alldata.get(data); - ByteBuffer buf = ByteBuffer.wrap(data); - ((ByteBuffer[]) result)[i] = buf; - alldata.position(savepos); - break; - default: - throw new DapException("Attempt to read non-atomic value of type: " + basetype.getTypeSort()); - } - } - return result; - } - - protected D4Cursor readStructure(Index index) throws DapException { - assert (this.scheme == Scheme.STRUCTARRAY); - long pos = index.index(); - long avail = (this.elements == null ? 0 : this.elements.length); - if (pos < 0 || pos > avail) - throw new IndexOutOfBoundsException("read: " + index); - return this.elements[(int) pos]; - } - - public D4Cursor readSequence(Index index) throws DapException { - assert (this.scheme == Scheme.SEQARRAY); - long pos = index.index(); - long avail = (this.elements == null ? 0 : this.elements.length); - if (pos < 0 || pos > avail) - throw new IndexOutOfBoundsException("read: " + index); - return this.elements[(int) pos]; - } - - ////////////////////////////////////////////////// - // D4Cursor Extensions - - public D4Cursor setElements(D4Cursor[] instances) { - if (!(getScheme() == Scheme.SEQARRAY || getScheme() == Scheme.STRUCTARRAY)) - throw new IllegalStateException("Adding element to !(structure|sequence array) object"); - DapVariable var = (DapVariable) getTemplate(); - this.elements = instances; - return this; - } - - public D4Cursor setOffset(long pos) { - this.offset = pos; - return this; - } - - public D4Cursor setByteStringOffsets(long total, long[] positions) { - this.bytestrings = positions; - return this; - } - - public D4Cursor addField(int m, D4Cursor field) { - if (getScheme() != Scheme.RECORD && getScheme() != Scheme.STRUCTURE) - throw new IllegalStateException("Adding field to non-(structure|record) object"); - if (this.fieldcursors == null) { - DapStructure ds = (DapStructure) ((DapVariable) getTemplate()).getBaseType(); - List fields = ds.getFields(); - this.fieldcursors = new D4Cursor[fields.size()]; - } - if (this.fieldcursors[m] != null) - throw new IndexOutOfBoundsException("Adding duplicate fields at position:" + m); - this.fieldcursors[m] = field; - return this; - } - - public D4Cursor addRecord(D4Cursor rec) { - if (getScheme() != Scheme.SEQUENCE) - throw new IllegalStateException("Adding record to non-sequence object"); - if (this.records == null) - this.records = new ArrayList<>(); - this.records.add(rec); - return this; - } - - public long getElementSize(DapVariable v) { - return v.getBaseType().isFixedSize() ? v.getBaseType().getSize() : 0; - } - - static ByteBuffer skip(long n, ByteBuffer b) { - if (b.position() + ((int) n) > b.limit()) - throw new IllegalArgumentException(); - b.position(b.position() + ((int) n)); - return b; - } - - public static long getLength(ByteBuffer b) { - if (b.position() + D4LENSIZE > b.limit()) - throw new IllegalArgumentException(); - long n = b.getLong(); - return n; - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DSP.java b/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DSP.java deleted file mode 100644 index a841cc9e6b..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DSP.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.dap4lib.serial; - -import dap4.core.dmr.DapDataset; -import dap4.core.util.DapDump; -import dap4.core.util.DapException; -import dap4.dap4lib.AbstractDSP; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -/** - * DAP4 Serial to DSP interface - * This code should be completely independent of thredds. - * Its goal is to provide a DSP interface to - * a sequence of bytes representing serialized data, possibly - * including a leading DMR. - */ - -public abstract class D4DSP extends AbstractDSP { - ////////////////////////////////////////////////// - // Constants - - public static boolean DEBUG = false; - public static boolean DUMPDMR = false; - public static boolean DUMPDAP = false; - - protected static final String DAPVERSION = "4.0"; - protected static final String DMRVERSION = "1.0"; - - ////////////////////////////////////////////////// - // Instance variables - - protected ByteBuffer databuffer = null; // local copy of AbstractDSP.getSource - - ////////////////////////////////////////////////// - // Constructor(s) - - public D4DSP() { - super(); - } - - ////////////////////////////////////////////////// - // DSP API - // Most is left to be subclass defined; - - ////////////////////////////////////////////////// - // (Other) Accessors - - /* packge */ ByteBuffer getBuffer() { - return databuffer; - } - - ////////////////////////////////////////////////// - // Compilation - - protected void build(String document, byte[] serialdata, ByteOrder order) throws DapException { - DapDataset dmr = parseDMR(document); - - if (DEBUG || DUMPDMR) { - System.err.println("\n+++++++++++++++++++++"); - System.err.println(dmr); - System.err.println("+++++++++++++++++++++\n"); - } - if (DEBUG || DUMPDAP) { - ByteBuffer data = ByteBuffer.wrap(serialdata); - System.err.println("+++++++++++++++++++++"); - System.err.println("\n---------------------"); - DapDump.dumpbytes(data, false); - System.err.println("\n---------------------\n"); - } - build(dmr, serialdata, order); - } - - /** - * Build the data from the incoming serial data - * Note that some DSP's will not use - * - * @param dmr - * @param serialdata - * @param order - * @throws DapException - */ - protected void build(DapDataset dmr, byte[] serialdata, ByteOrder order) throws DapException { - setDMR(dmr); - // "Compile" the databuffer section of the server response - this.databuffer = ByteBuffer.wrap(serialdata).order(order); - D4DataCompiler compiler = new D4DataCompiler(this, getChecksumMode(), getOrder(), this.databuffer); - compiler.compile(); - } - -} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DataCompiler.java b/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DataCompiler.java deleted file mode 100644 index c3c9bdb3ca..0000000000 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/serial/D4DataCompiler.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - - -package dap4.dap4lib.serial; - -import dap4.core.data.ChecksumMode; -import dap4.core.dmr.*; -import dap4.core.util.*; -import dap4.dap4lib.LibTypeFcns; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.List; -import static dap4.core.data.DataCursor.Scheme; - -public class D4DataCompiler { - public static boolean DEBUG = false; - - ////////////////////////////////////////////////// - // Constants - - public static final int COUNTSIZE = 8; // databuffer as specified by the DAP4 spec - - static String LBRACE = "{"; - static String RBRACE = "}"; - - - ////////////////////////////////////////////////// - // Instance variables - - protected DapDataset dataset = null; - - // Make compile arguments global - protected ByteBuffer databuffer; - - protected ChecksumMode checksummode = null; - protected ByteOrder order = null; - - protected D4DSP dsp; - - ////////////////////////////////////////////////// - // Constructor(s) - - /** - * Constructor - * - * @param dsp the D4DSP - * @param checksummode - * @param databuffer the source of serialized databuffer - */ - - public D4DataCompiler(D4DSP dsp, ChecksumMode checksummode, ByteOrder order, ByteBuffer databuffer) - throws DapException { - this.dsp = dsp; - this.dataset = this.dsp.getDMR(); - this.databuffer = databuffer; - this.checksummode = checksummode; - this.order = order; - } - - ////////////////////////////////////////////////// - // DataCompiler API - - /** - * The goal here is to process the serialized - * databuffer and locate top-level variable positions - * in the serialized databuffer. Access to non-top-level - * variables is accomplished on the fly. - * - * @throws DapException - */ - public void compile() throws DapException { - assert (this.dataset != null && this.databuffer != null); - // iterate over the variables represented in the databuffer - for (DapVariable vv : this.dataset.getTopVariables()) { - D4Cursor data = compileVar(vv, null); - this.dsp.addVariableData(vv, data); - } - } - - protected D4Cursor compileVar(DapVariable dapvar, D4Cursor container) throws DapException { - boolean isscalar = dapvar.getRank() == 0; - D4Cursor array = null; - DapType type = dapvar.getBaseType(); - if (type.isAtomic()) - array = compileAtomicVar(dapvar, container); - else if (type.isStructType()) { - array = compileStructureArray(dapvar, container); - } else if (type.isSeqType()) { - array = compileSequenceArray(dapvar, container); - } - if (dapvar.isTopLevel() && this.checksummode.enabled(ChecksumMode.DAP)) { - // extract the checksum from databuffer src, - // attach to the array, and make into an attribute - int checksum = extractChecksum(databuffer); - dapvar.setChecksum(checksum); - } - return array; - } - - /** - * @param var - * @param container - * @return data - * @throws DapException - */ - - protected D4Cursor compileAtomicVar(DapVariable var, D4Cursor container) throws DapException { - DapType daptype = var.getBaseType(); - D4Cursor data = new D4Cursor(Scheme.ATOMIC, (D4DSP) this.dsp, var, container); - data.setOffset(getPos(this.databuffer)); - long total = 0; - long dimproduct = var.getCount(); - if (!daptype.isEnumType() && !daptype.isFixedSize()) { - // this is a string, url, or opaque - long[] positions = new long[(int) dimproduct]; - int savepos = databuffer.position(); - // Walk the bytestring and return the instance count (in databuffer) - total = walkByteStrings(positions, databuffer); - databuffer.position(savepos);// leave position unchanged - data.setByteStringOffsets(total, positions); - } else { - total = dimproduct * daptype.getSize(); - } - skip(databuffer, (int) total); - return data; - } - - /** - * Compile a structure array. - * - * @param var the template - * @param container if inside a compound object - * @return A DataCompoundArray for the databuffer for this struct. - * @throws DapException - */ - protected D4Cursor compileStructureArray(DapVariable var, D4Cursor container) throws DapException { - DapStructure dapstruct = (DapStructure) var.getBaseType(); - D4Cursor structarray = - new D4Cursor(Scheme.STRUCTARRAY, this.dsp, var, container).setOffset(getPos(this.databuffer)); - List dimset = var.getDimensions(); - long dimproduct = DapUtil.dimProduct(dimset); - D4Cursor[] instances = new D4Cursor[(int) dimproduct]; - Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset), dimset); - while (odom.hasNext()) { - Index index = odom.next(); - D4Cursor instance = compileStructure(var, dapstruct, structarray); - instance.setIndex(index); - instances[(int) index.index()] = instance; - } - structarray.setElements(instances); - return structarray; - } - - /** - * Compile a structure instance. - * - * @param dapstruct The template - * @param container - * @return A DataStructure for the databuffer for this struct. - * @throws DapException - */ - protected D4Cursor compileStructure(DapVariable var, DapStructure dapstruct, D4Cursor container) throws DapException { - int pos = getPos(this.databuffer); - D4Cursor d4ds = new D4Cursor(Scheme.STRUCTURE, (D4DSP) this.dsp, var, container).setOffset(pos); - List dfields = dapstruct.getFields(); - for (int m = 0; m < dfields.size(); m++) { - DapVariable dfield = dfields.get(m); - D4Cursor dvfield = compileVar(dfield, d4ds); - d4ds.addField(m, dvfield); - assert dfield.getParent() != null; - } - return d4ds; - } - - /** - * Compile a sequence array. - * - * @param var the template - * @return A DataCompoundArray for the databuffer for this sequence. - * @throws DapException - */ - protected D4Cursor compileSequenceArray(DapVariable var, D4Cursor container) throws DapException { - DapSequence dapseq = (DapSequence) var.getBaseType(); - D4Cursor seqarray = new D4Cursor(Scheme.SEQARRAY, this.dsp, var, container).setOffset(getPos(this.databuffer)); - List dimset = var.getDimensions(); - long dimproduct = DapUtil.dimProduct(dimset); - D4Cursor[] instances = new D4Cursor[(int) dimproduct]; - Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset), dimset); - while (odom.hasNext()) { - Index index = odom.next(); - D4Cursor instance = compileSequence(var, dapseq, seqarray); - instance.setIndex(index); - instances[(int) index.index()] = instance; - } - seqarray.setElements(instances); - return seqarray; - } - - /** - * Compile a sequence as a set of records. - * - * @param dapseq - * @param container - * @return sequence - * @throws DapException - */ - public D4Cursor compileSequence(DapVariable var, DapSequence dapseq, D4Cursor container) throws DapException { - int pos = getPos(this.databuffer); - D4Cursor seq = new D4Cursor(Scheme.SEQUENCE, this.dsp, var, container).setOffset(pos); - List dfields = dapseq.getFields(); - // Get the count of the number of records - long nrecs = getCount(this.databuffer); - for (int r = 0; r < nrecs; r++) { - pos = getPos(this.databuffer); - D4Cursor rec = - (D4Cursor) new D4Cursor(D4Cursor.Scheme.RECORD, this.dsp, var, container).setOffset(pos).setRecordIndex(r); - for (int m = 0; m < dfields.size(); m++) { - DapVariable dfield = dfields.get(m); - D4Cursor dvfield = compileVar(dfield, rec); - rec.addField(m, dvfield); - assert dfield.getParent() != null; - } - seq.addRecord(rec); - } - return seq; - } - - ////////////////////////////////////////////////// - // Utilities - - protected int extractChecksum(ByteBuffer data) throws DapException { - assert ChecksumMode.DAP.enabled(this.checksummode); - if (data.remaining() < DapUtil.CHECKSUMSIZE) - throw new DapException("Short serialization: missing checksum"); - return data.getInt(); - } - - protected static void skip(ByteBuffer data, int count) { - data.position(data.position() + count); - } - - protected static int getCount(ByteBuffer data) { - long count = data.getLong(); - count = (count & 0xFFFFFFFF); - return (int) count; - } - - protected static int getPos(ByteBuffer data) { - return data.position(); - } - - /** - * Compute the size in databuffer of the serialized form - * - * @param daptype - * @return type's serialized form size - */ - protected static int computeTypeSize(DapType daptype) { - return LibTypeFcns.size(daptype); - } - - protected static long walkByteStrings(long[] positions, ByteBuffer databuffer) { - int count = positions.length; - long total = 0; - int savepos = databuffer.position(); - // Walk each bytestring - for (int i = 0; i < count; i++) { - int pos = databuffer.position(); - positions[i] = pos; - int size = getCount(databuffer); - total += COUNTSIZE; - total += size; - skip(databuffer, size); - } - databuffer.position(savepos);// leave position unchanged - return total; - } - -} diff --git a/dap4/d4tests/build.gradle b/dap4/d4tests/build.gradle deleted file mode 100644 index d86da229a8..0000000000 --- a/dap4/d4tests/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -apply from: "$rootDir/gradle/any/dependencies.gradle" -apply from: "$rootDir/gradle/any/test-only-projects.gradle" -apply from: "$rootDir/gradle/any/gretty.gradle" - -dependencies { - // I bet some of these dependencies could be in the testRuntimeOnly config, not testImplementation. - compile enforcedPlatform(project(':netcdf-java-platform')) - testImplementation enforcedPlatform(project(':netcdf-java-testing-platform')) - - testImplementation project(':dap4:d4core') - testImplementation project(':dap4:d4lib') - testImplementation project(':dap4:d4cdm') - testImplementation project(':cdm:cdm-core') - testImplementation project(':cdm-test-utils') - testImplementation project(':httpservices') - - testImplementation 'junit:junit' - testImplementation 'org.slf4j:slf4j-api' - - testRuntimeOnly 'ch.qos.logback:logback-classic' -} - -test { - systemProperties['testargs'] = System.getProperty('testargs', '') - - include 'dap4/test/TestCDMClient.class' - include 'dap4/test/TestConstraints.class' - include 'dap4/test/TestDSP.class' - include 'dap4/test/TestDSR.class' - include 'dap4/test/TestNc4Iosp.class' - include 'dap4/test/TestParserCE.class' - include 'dap4/test/TestParserDMR.class' - include 'dap4/test/TestServlet.class' - include 'dap4/test/TestServletConstraints.class' - include 'dap4/test/TestFrontPage.class' - //include 'dap4/test/TestFilters.class' - //include 'dap4/test/TestH5Iosp.class' - //include 'dap4/test/TestHyrax.class' - //include 'dap4/test/TestPrinter.class' - //include 'dap4/test/TestSerial.class' - - dependsOn('farmBeforeIntegrationTest') - finalizedBy('farmAfterIntegrationTest') -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.2.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.2.raw.txt deleted file mode 100644 index 3aec08b1c9..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.2.raw.txt +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_anon_dim.syn.2 { - variables: - int vu32(4); - string vu32:_DAP4_Checksum_CRC32 = "0x417bc794"; - - // global attributes: - string :_dap4.ce = "/vu32[0:3]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu32 = - {-1169720286, -920699049, -2088732436, 1060190036} -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.raw.txt deleted file mode 100644 index 0819467d8f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_anon_dim.syn.raw.txt +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_anon_dim.syn { - variables: - int vu32(6); - string vu32:_DAP4_Checksum_CRC32 = "0x1aca2718"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu32 = - {-1169720286, -920699049, -2088732436, 1060190036, -1123468835, 922940053} -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.5.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.5.raw.txt deleted file mode 100644 index bfc1a9a698..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.5.raw.txt +++ /dev/null @@ -1,30 +0,0 @@ -netcdf test_atomic_array.nc.5 { - variables: - ubyte vu8(1, 2); - string vu8:_DAP4_Checksum_CRC32 = "0x1a9eb5b3"; - - double vd(1); - string vd:_DAP4_Checksum_CRC32 = "0x74c1a1f1"; - - string vs(1, 1); - string vs:_DAP4_Checksum_CRC32 = "0x15293f21"; - - opaque vo(1, 1); - string vo:_DAP4_Checksum_CRC32 = "0x225778dc"; - - // global attributes: - string :_dap4.ce = "/vu8[1][0:2:2];/vd[1];/vs[1][0];/vo[0][1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {3, 5} - } -vd = - {1024.8} -vs = - { "Καλημέα" - } -vo = 0xabcdef0000000000; - -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.raw.txt deleted file mode 100644 index 4aafbcac3b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.raw.txt +++ /dev/null @@ -1,63 +0,0 @@ -netcdf test_atomic_array { - types: - byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - - dimensions: - d1 = 1; - d2 = 2; - d3 = 3; - d4 = 4; - d5 = 5; - variables: - ubyte vu8(d2, d3); - string vu8:_DAP4_Checksum_CRC32 = "0xd42f6486"; - - short v16(d4); - string v16:_DAP4_Checksum_CRC32 = "0x92991416"; - - uint vu32(d2, d3); - string vu32:_DAP4_Checksum_CRC32 = "0x0c56f0f2"; - - double vd(d2); - string vd:_DAP4_Checksum_CRC32 = "0x7c09cbae"; - - char vc(d2); - string vc:_DAP4_Checksum_CRC32 = "0x63add807"; - - string vs(d2, d2); - string vs:_DAP4_Checksum_CRC32 = "0x672f70c4"; - - opaque vo(d1, d2); - string vo:_DAP4_Checksum_CRC32 = "0x2757560d"; - - enum cloud_class_t primary_cloud(d5); - string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0xb58a627a"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {255, 1, 2}, - {3, 4, 5} - } -v16 = - {1, 2, 3, 4} -vu32 = - { - {5, 4, 3}, - {2, 1, 0} - } -vd = - {17.9, 1024.8} -vc = "@&" -vs = - { "hello world", "hello world", "hello world", "hello world" - } -vo = 0x0123456789abcdef, - 0x0123456789abcdef; - -primary_cloud = - {0, 2, 0, 1, 127} -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.syn.raw.txt deleted file mode 100644 index e1388d3f78..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.syn.raw.txt +++ /dev/null @@ -1,63 +0,0 @@ -netcdf test_atomic_array.syn { - types: - byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - - dimensions: - d1 = 1; - d2 = 2; - d3 = 3; - d4 = 4; - d5 = 5; - variables: - ubyte vu8(d2, d3); - string vu8:_DAP4_Checksum_CRC32 = "0xd79bd598"; - - short v16(d4); - string v16:_DAP4_Checksum_CRC32 = "0xa40ee271"; - - uint vu32(d2, d3); - string vu32:_DAP4_Checksum_CRC32 = "0xa06ca308"; - - double vd(d2); - string vd:_DAP4_Checksum_CRC32 = "0x7ee0fb67"; - - char vc(d2); - string vc:_DAP4_Checksum_CRC32 = "0x7cee5238"; - - string vs(d2, d2); - string vs:_DAP4_Checksum_CRC32 = "0x9d474c4c"; - - opaque vo(d1, d2); - string vo:_DAP4_Checksum_CRC32 = "0xd4809521"; - - enum cloud_class_t primary_cloud(d5); - string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x94b74cf7"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {186, 201, 131}, - {63, 189, 55} - } -v16 = - {-341, -21899, -13413, -22144} -vu32 = - { - {2367803413, 3586730583, 511843988}, - {3754752863, 2950934681, 2366232135} - } -vd = - {0.21787008119279183, 0.6024507919967678} -vc = "CO" -vs = - { "{S", "{S", "{S", "{S" - } -vo = 0xa2177aa7287c04fa8bb57bcdf76ec80f, - 0xa2177aa7287c04fa8bb57bcdf76ec80f; - -primary_cloud = - {2, 9, 6, 8, 3} -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.nc.raw.txt deleted file mode 100644 index a6cd1e1933..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.nc.raw.txt +++ /dev/null @@ -1,72 +0,0 @@ -netcdf test_atomic_types { - types: - byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - - variables: - byte v8; - string v8:_DAP4_Checksum_CRC32 = "0x3fba6cad"; - - ubyte vu8; - string vu8:_DAP4_Checksum_CRC32 = "0xff000000"; - - short v16; - string v16:_DAP4_Checksum_CRC32 = "0xac6191df"; - - ushort vu16; - string vu16:_DAP4_Checksum_CRC32 = "0xffff0000"; - - int v32; - string v32:_DAP4_Checksum_CRC32 = "0x12477cdf"; - - uint vu32; - string vu32:_DAP4_Checksum_CRC32 = "0xffffffff"; - - long v64; - string v64:_DAP4_Checksum_CRC32 = "0xccfc5c3c"; - - ulong vu64; - string vu64:_DAP4_Checksum_CRC32 = "0x2144df1c"; - - float vf; - string vf:_DAP4_Checksum_CRC32 = "0x8c2a1365"; - - double vd; - string vd:_DAP4_Checksum_CRC32 = "0xf2bacb72"; - - char vc; - string vc:_DAP4_Checksum_CRC32 = "0xa4deae1d"; - - string vs; - string vs:_DAP4_Checksum_CRC32 = "0x3691a6d4"; - - opaque vo; - string vo:_DAP4_Checksum_CRC32 = "0xd24ddadd"; - - enum cloud_class_t primary_cloud; - string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x3c0c8ea1"; - - enum cloud_class_t secondary_cloud; - string secondary_cloud:_FillValue = "Missing"; - string secondary_cloud:_DAP4_Checksum_CRC32 = "0x12b88320"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v8 =-128 -vu8 =255 -v16 =-32768 -vu16 =65535 -v32 =2147483647 -vu32 =4294967295 -v64 =9223372036854775807 -vu64 =18446744073709551615 -vf =3.1415927 -vd =3.141592653589793 -vc =@ -vs = "hello world" -vo = 0x0123456789abcdef; - -primary_cloud =2 -secondary_cloud =127 -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.syn.raw.txt deleted file mode 100644 index 3c302ef4a6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_types.syn.raw.txt +++ /dev/null @@ -1,72 +0,0 @@ -netcdf test_atomic_types.syn { - types: - byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - - variables: - byte v8; - string v8:_DAP4_Checksum_CRC32 = "0x140e363f"; - - ubyte vu8; - string vu8:_DAP4_Checksum_CRC32 = "0x30ba9599"; - - short v16; - string v16:_DAP4_Checksum_CRC32 = "0xe353db0e"; - - ushort vu16; - string vu16:_DAP4_Checksum_CRC32 = "0x31e23870"; - - int v32; - string v32:_DAP4_Checksum_CRC32 = "0xbad2143f"; - - uint vu32; - string vu32:_DAP4_Checksum_CRC32 = "0x32e54381"; - - long v64; - string v64:_DAP4_Checksum_CRC32 = "0x915dfe6e"; - - ulong vu64; - string vu64:_DAP4_Checksum_CRC32 = "0x9233006a"; - - float vf; - string vf:_DAP4_Checksum_CRC32 = "0x3d571922"; - - double vd; - string vd:_DAP4_Checksum_CRC32 = "0xffd91cad"; - - char vc; - string vc:_DAP4_Checksum_CRC32 = "0x09b9265b"; - - string vs; - string vs:_DAP4_Checksum_CRC32 = "0x81827ad8"; - - opaque vo; - string vo:_DAP4_Checksum_CRC32 = "0x2d29db8e"; - - enum cloud_class_t primary_cloud; - string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x4c667a2e"; - - enum cloud_class_t secondary_cloud; - string secondary_cloud:_FillValue = "Missing"; - string secondary_cloud:_DAP4_Checksum_CRC32 = "0x4b0bbe37"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v8 =58 -vu8 =201 -v16 =896 -vu16 =16177 -v32 =-1123468835 -vu32 =2125143125 -v64 =3059391736915381031 -vu64 =11577488182652895291 -vf =0.5512972 -vd =0.7902673011288164 -vc =* -vs = "O,L?c8A%V" -vo = 0x46f169ef23cbaf9b1febd99e4e16cec9; - -primary_cloud =7 -secondary_cloud =3 -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_fill.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_fill.nc.raw.txt deleted file mode 100644 index 839f800bfe..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_fill.nc.raw.txt +++ /dev/null @@ -1,19 +0,0 @@ -netcdf test_fill { - variables: - ubyte uv8; - string uv8:_DAP4_Checksum_CRC32 = "0x6fbf1d91"; - - short v16; - string v16:_DAP4_Checksum_CRC32 = "0xc9139fe6"; - - uint uv32; - uv32:_FillValue = 17; - string uv32:_DAP4_Checksum_CRC32 = "0x8437b331"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -uv8 =240 -v16 =32700 -uv32 =111000 -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_var.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_var.nc.raw.txt deleted file mode 100644 index 2b376e08ab..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_var.nc.raw.txt +++ /dev/null @@ -1,10 +0,0 @@ -netcdf test_one_var { - variables: - int t; - string t:_DAP4_Checksum_CRC32 = "0xc9e1efe6"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t =17 -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.3.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.3.raw.txt deleted file mode 100644 index 7e65c1a454..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.3.raw.txt +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_one_vararray.nc.3 { - dimensions: - d2 = 2; - variables: - int t(d2); - string t:_DAP4_Checksum_CRC32 = "0x42dfb1d0"; - - // global attributes: - string :_dap4.ce = "/t[0:1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {17, 37} -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_sequence_1.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_sequence_1.syn.raw.txt deleted file mode 100644 index 8fd1eb64bf..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_sequence_1.syn.raw.txt +++ /dev/null @@ -1,23 +0,0 @@ -netcdf test_sequence_1.syn { - variables: - - Sequence { - int i1; - short sh1; - } s(*); - string s:_DAP4_Checksum_CRC32 = "0x4ac0ac5e"; - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: - s = - { - i1 = - {-920699049 - } - sh1 = - {896 - } - } s -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.nc.6.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.nc.6.raw.txt deleted file mode 100644 index 5ca77032b5..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.nc.6.raw.txt +++ /dev/null @@ -1,34 +0,0 @@ -netcdf test_struct_array.nc.6 { - variables: - - Structure { - int x; - string x:_CoordinateAxisType = "GeoX"; - int y; - string y:_CoordinateAxisType = "GeoY"; - } s(2, 2); - string s:_DAP4_Checksum_CRC32 = "0x324d0ea6"; - - - // global attributes: - string :_dap4.ce = "/s[0:2:3][0:1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -s = - { - x =1 - y =-1 - } s(0) - { - x =17 - y =37 - } s(1) - { - x =-4 - y =12 - } s(2) - { - x =-8 - y =8 - } s(3) -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.syn.raw.txt deleted file mode 100644 index 76531f1451..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_array.syn.raw.txt +++ /dev/null @@ -1,78 +0,0 @@ -netcdf test_struct_array.syn { - dimensions: - dx = 4; - dy = 3; - variables: - float z(dx); - string z:_DAP4_Checksum_CRC32 = "0xbef06d05"; - - float t(dy); - string t:_DAP4_Checksum_CRC32 = "0x165934f0"; - - - Structure { - int x; - string x:_CoordinateAxisType = "GeoX"; - int y; - string y:_CoordinateAxisType = "GeoY"; - } s(dx, dy); - string s:_DAP4_Checksum_CRC32 = "0xd91a250e"; - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -z = - {0.72765326, 0.785633, 0.513679, 0.24684471} -t = - {0.738422, 0.21488869, 0.49479842} -s = - { - x =712320147 - y =1268468519 - } s(0) - { - x =696298400 - y =989876086 - } s(1) - { - x =-1927163883 - y =-900795134 - } s(2) - { - x =-708236713 - y =1377500019 - } s(3) - { - x =511843988 - y =1699265896 - } s(4) - { - x =-540214433 - y =-914532520 - } s(5) - { - x =-1344032615 - y =-871416961 - } s(6) - { - x =-1928735161 - y =935744880 - } s(7) - { - x =-1509955773 - y =-1707460853 - } s(8) - { - x =1145911788 - y =-415231529 - } s(9) - { - x =-278269626 - y =-1682978013 - } s(10) - { - x =-1629885665 - y =-909240754 - } s(11) -} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.raw deleted file mode 100644 index 90cf83423e..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.syn.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.syn.raw deleted file mode 100644 index 906759bc74..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.syn.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.raw deleted file mode 100644 index 15ca928b3d..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque.nc.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque.nc.raw deleted file mode 100644 index 983427b986..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque.nc.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_1.syn.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_1.syn.raw deleted file mode 100644 index 6b83150005..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_1.syn.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_2.syn.raw b/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_2.syn.raw deleted file mode 100644 index 2b7c5072b7..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_sequence_2.syn.raw and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_anon_dim.syn.2.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_anon_dim.syn.2.raw.txt deleted file mode 100644 index 3aec08b1c9..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_anon_dim.syn.2.raw.txt +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_anon_dim.syn.2 { - variables: - int vu32(4); - string vu32:_DAP4_Checksum_CRC32 = "0x417bc794"; - - // global attributes: - string :_dap4.ce = "/vu32[0:3]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu32 = - {-1169720286, -920699049, -2088732436, 1060190036} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.5.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.5.raw.txt deleted file mode 100644 index bfc1a9a698..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.5.raw.txt +++ /dev/null @@ -1,30 +0,0 @@ -netcdf test_atomic_array.nc.5 { - variables: - ubyte vu8(1, 2); - string vu8:_DAP4_Checksum_CRC32 = "0x1a9eb5b3"; - - double vd(1); - string vd:_DAP4_Checksum_CRC32 = "0x74c1a1f1"; - - string vs(1, 1); - string vs:_DAP4_Checksum_CRC32 = "0x15293f21"; - - opaque vo(1, 1); - string vo:_DAP4_Checksum_CRC32 = "0x225778dc"; - - // global attributes: - string :_dap4.ce = "/vu8[1][0:2:2];/vd[1];/vs[1][0];/vo[0][1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {3, 5} - } -vd = - {1024.8} -vs = - { "Καλημέα" - } -vo = 0xabcdef0000000000; - -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.8.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.8.raw.txt deleted file mode 100644 index 6c79c85f94..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.8.raw.txt +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_atomic_array.nc.8 { - variables: - short v16(3); - string v16:_DAP4_Checksum_CRC32 = "0xc592fc85"; - - // global attributes: - string :_dap4.ce = "/v16[1:2,2]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v16 = - {2, 3, 3} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.9.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.9.raw.txt deleted file mode 100644 index b367f16522..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_atomic_array.nc.9.raw.txt +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_atomic_array.nc.9 { - variables: - short v16(3); - string v16:_DAP4_Checksum_CRC32 = "0xb6724845"; - - // global attributes: - string :_dap4.ce = "/v16[2,1:2]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v16 = - {3, 2, 3} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_enum_array.nc.4.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_enum_array.nc.4.raw.txt deleted file mode 100644 index 82933a50d3..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_enum_array.nc.4.raw.txt +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_enum_array.nc.4 { - types: - byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - - variables: - enum cloud_class_t primary_cloud(2); - string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x04e840eb"; - - // global attributes: - string :_dap4.ce = "/primary_cloud[1:2:4]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud = - {2, 1} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.1.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.1.raw.txt deleted file mode 100644 index 4b380edb65..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.1.raw.txt +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_one_vararray.nc.1 { - variables: - int t(1); - string t:_DAP4_Checksum_CRC32 = "0xb6a88010"; - - // global attributes: - string :_dap4.ce = "/t[1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {37} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.3.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.3.raw.txt deleted file mode 100644 index 7e65c1a454..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_one_vararray.nc.3.raw.txt +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_one_vararray.nc.3 { - dimensions: - d2 = 2; - variables: - int t(d2); - string t:_DAP4_Checksum_CRC32 = "0x42dfb1d0"; - - // global attributes: - string :_dap4.ce = "/t[0:1]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {17, 37} -} diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_opaque_array.nc.7.raw.txt b/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_opaque_array.nc.7.raw.txt deleted file mode 100644 index f7e6996969..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_opaque_array.nc.7.raw.txt +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_opaque_array.nc.7 { - variables: - opaque vo2(1, 2); - string vo2:_DAP4_Checksum_CRC32 = "0x3f3fa5d4"; - - // global attributes: - string :_dap4.ce = "/vo2[1][0,0]"; - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vo2 = 0xfedcba9876543210, - 0xfedcba9876543210; - -} diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.2.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.2.raw.txt deleted file mode 100644 index 25034c5a30..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.2.raw.txt +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - -/vu32[0] = -1169720286 -/vu32[1] = -920699049 -/vu32[2] = -2088732436 -/vu32[3] = 1060190036 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.raw.txt deleted file mode 100644 index f6dd09784a..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_anon_dim.syn.raw.txt +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - -/vu32[0] = -1169720286 -/vu32[1] = -920699049 -/vu32[2] = -2088732436 -/vu32[3] = 1060190036 -/vu32[4] = -1123468835 -/vu32[5] = 922940053 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.5.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.5.raw.txt deleted file mode 100644 index b4d1d6ce75..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.5.raw.txt +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -/vu8[0,0] = 3 -/vu8[0,1] = 5 -/vd[0] = 1024.800000 -/vs[0,0] = "Καλημέα" -/vo[0,0] = 0xABCDEF0000000000 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.8.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.8.raw.txt deleted file mode 100644 index 447e729347..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.8.raw.txt +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -/v16[0] = 1 -/v16[1] = 2 -/v16[2] = 4 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.9.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.9.raw.txt deleted file mode 100644 index 769a4618ee..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.9.raw.txt +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -/v16[0] = 4 -/v16[1] = 1 -/v16[2] = 2 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.raw.txt deleted file mode 100644 index 2e2bea3dd0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.nc.raw.txt +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/vu8[0,0] = 255 -/vu8[0,1] = 1 -/vu8[0,2] = 2 -/vu8[1,0] = 3 -/vu8[1,1] = 4 -/vu8[1,2] = 5 -/v16[0] = 1 -/v16[1] = 2 -/v16[2] = 3 -/v16[3] = 4 -/vu32[0,0] = 5 -/vu32[0,1] = 4 -/vu32[0,2] = 3 -/vu32[1,0] = 2 -/vu32[1,1] = 1 -/vu32[1,2] = 0 -/vd[0] = 17.900000 -/vd[1] = 1024.800000 -/vc[0] = '@' -/vc[1] = '&' -/vs[0,0] = "hello\tworld" -/vs[0,1] = "\r\n" -/vs[1,0] = "Καλημέα" -/vs[1,1] = "abc" -/vo[0,0] = 0x0123456789ABCDEF -/vo[0,1] = 0xABCDEF0000000000 -/primary_cloud[0] = Clear -/primary_cloud[1] = Stratus -/primary_cloud[2] = Clear -/primary_cloud[3] = Cumulonimbus -/primary_cloud[4] = Missing - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.syn.raw.txt deleted file mode 100644 index 04ad7521e5..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_array.syn.raw.txt +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/vu8[0,0] = 186 -/vu8[0,1] = 201 -/vu8[0,2] = 131 -/vu8[1,0] = 63 -/vu8[1,1] = 189 -/vu8[1,2] = 55 -/v16[0] = -341 -/v16[1] = -21899 -/v16[2] = -13413 -/v16[3] = -22144 -/vu32[0,0] = 2367803413 -/vu32[0,1] = 3586730583 -/vu32[0,2] = 511843988 -/vu32[1,0] = 3754752863 -/vu32[1,1] = 2950934681 -/vu32[1,2] = 2366232135 -/vd[0] = 0.217870 -/vd[1] = 0.602451 -/vc[0] = 'C' -/vc[1] = 'O' -/vs[0,0] = "{S" -/vs[0,1] = "gb8^OE$" -/vs[1,0] = "4a/q%n9;5Y" -/vs[1,1] = "{fIl?T"\A[" -/vo[0,0] = 0xA2177AA7287C04FA8BB57BCDF76EC80F -/vo[0,1] = 0x34FA472AA9404DD543143CADED303A75 -/primary_cloud[0] = Stratus -/primary_cloud[1] = Cirrocumulus -/primary_cloud[2] = Nimbostratus -/primary_cloud[3] = Cirrostratus -/primary_cloud[4] = Stratocumulus - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.nc.raw.txt deleted file mode 100644 index cff7ae5f4d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.nc.raw.txt +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/v8 = -128 -/vu8 = 255 -/v16 = -32768 -/vu16 = 65535 -/v32 = 2147483647 -/vu32 = 4294967295 -/v64 = 9223372036854775807 -/vu64 = 18446744073709551615 -/vf = 3.141593 -/vd = 3.141593 -/vc = '@' -/vs = "hello\tworld" -/vo = 0x0123456789ABCDEF -/primary_cloud = Stratus -/secondary_cloud = Missing - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.syn.raw.txt deleted file mode 100644 index 6a7adb4fd4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_atomic_types.syn.raw.txt +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/v8 = 58 -/vu8 = 201 -/v16 = 896 -/vu16 = 16177 -/v32 = -1123468835 -/vu32 = 2125143125 -/v64 = 3059391736915381031 -/vu64 = 11577488182652895291 -/vf = 0.551297 -/vd = 0.790267 -/vc = '*' -/vs = "O,L?c8A%V" -/vo = 0x46F169EF23CBAF9B1FEBD99E4E16CEC9 -/primary_cloud = Altocumulus -/secondary_cloud = Stratocumulus - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum.nc.raw.txt deleted file mode 100644 index 8c8ce9ebb4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum.nc.raw.txt +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -/primary_cloud = Stratus - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_2.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_2.nc.raw.txt deleted file mode 100644 index f0402352be..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_2.nc.raw.txt +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -/h/primary_cloud = Stratus - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.4.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.4.raw.txt deleted file mode 100644 index 0217409df8..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.4.raw.txt +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -/primary_cloud[0] = Stratus -/primary_cloud[1] = Cumulonimbus - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.raw.txt deleted file mode 100644 index c23486baff..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_enum_array.nc.raw.txt +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -/primary_cloud[0] = Clear -/primary_cloud[1] = Stratus -/primary_cloud[2] = Clear -/primary_cloud[3] = Cumulonimbus -/primary_cloud[4] = Missing - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_fill.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_fill.nc.raw.txt deleted file mode 100644 index dd457986b4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_fill.nc.raw.txt +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -/uv8 = 240 -/v16 = 32700 -/uv32 = 111000 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_groups1.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_groups1.nc.raw.txt deleted file mode 100644 index 431c26d8ea..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_groups1.nc.raw.txt +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -/g/h/v1[0] = -876354855 -/g/h/v1[1] = -1761252264 -/g/h/v1[2] = 1723477387 -/g/h/v1[3] = -46827465 -/g/h/v1[4] = 1475147969 -/g/h/v2[0] = 12.000000 -/g/h/v2[1] = -100.000000 -/g/h/v2[2] = 9969209968386869000000000000000000000.000000 -/g/i/v1[0] = 2 -/g/i/v1[1] = 3 -/g/i/v1[2] = 5 -/g/i/v1[3] = 7 -/g/i/v1[4] = 11 -/g/i/v3[0] = 23.000000 -/g/i/v3[1] = 29.000000 -/g/i/v3[2] = 19.000000 -/g/i/v3[3] = 31.000000 -/g/i/v3[4] = 17.000000 -/g/i/v3[5] = 37.000000 -/g/i/v3[6] = 13.000000 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_var.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_var.nc.raw.txt deleted file mode 100644 index c74172bddb..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_var.nc.raw.txt +++ /dev/null @@ -1,10 +0,0 @@ - - - -/t = 17 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.1.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.1.raw.txt deleted file mode 100644 index 18bedc8d51..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.1.raw.txt +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - -/t[0] = 37 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.raw.txt deleted file mode 100644 index 1d2f858e48..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.raw.txt +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - -/t[0] = 17 -/t[1] = 37 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque.nc.raw.txt deleted file mode 100644 index a0dbfd2e55..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque.nc.raw.txt +++ /dev/null @@ -1,10 +0,0 @@ - - - -/vo1 = 0x0123456789ABCDEF - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.7.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.7.raw.txt deleted file mode 100644 index 157a621f2a..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.7.raw.txt +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - -/vo2[0,0] = 0xFEDCBA9876543210 -/vo2[0,1] = 0xFEDCBA9999999999 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.raw.txt deleted file mode 100644 index 91da77c407..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_opaque_array.nc.raw.txt +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -/vo2[0,0] = 0x0123456789ABCDEF -/vo2[0,1] = 0xABCDEF0000000000 -/vo2[1,0] = 0xFEDCBA9876543210 -/vo2[1,1] = 0xFEDCBA9999999999 - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_1.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_1.syn.raw.txt deleted file mode 100644 index 0e347626ef..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_1.syn.raw.txt +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -/s = { - [ - /s.i1 = -920699049 - /s.sh1 = 896 - ]} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_2.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_2.syn.raw.txt deleted file mode 100644 index bc5c5110e6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_sequence_2.syn.raw.txt +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - -/s[0] = { - [ - /s.i1 = -920699049 - /s.sh1 = 896 - ]} -/s[1] = { - [ - /s.i1 = -1123468835 - /s.sh1 = -18686 - ] [ - /s.i1 = 2125143125 - /s.sh1 = -21899 - ] [ - /s.i1 = 1268468519 - /s.sh1 = -22144 - ] [ - /s.i1 = 989876086 - /s.sh1 = 3361 - ]} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.nc.6.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.nc.6.raw.txt deleted file mode 100644 index e142a33713..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.nc.6.raw.txt +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - -/s[0,0] = { - /s.x = 1 - /s.y = -1 -} -/s[0,1] = { - /s.x = 17 - /s.y = 37 -} -/s[1,0] = { - /s.x = -4 - /s.y = 12 -} -/s[1,1] = { - /s.x = -8 - /s.y = 8 -} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.syn.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.syn.raw.txt deleted file mode 100644 index 0b856f51d9..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_array.syn.raw.txt +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - -/z[0] = 0.727653 -/z[1] = 0.785633 -/z[2] = 0.513679 -/z[3] = 0.246845 -/t[0] = 0.738422 -/t[1] = 0.214889 -/t[2] = 0.494798 -/s[0,0] = { - /s.x = 712320147 - /s.y = 1268468519 -} -/s[0,1] = { - /s.x = 696298400 - /s.y = 989876086 -} -/s[0,2] = { - /s.x = -1927163883 - /s.y = -900795134 -} -/s[1,0] = { - /s.x = -708236713 - /s.y = 1377500019 -} -/s[1,1] = { - /s.x = 511843988 - /s.y = 1699265896 -} -/s[1,2] = { - /s.x = -540214433 - /s.y = -914532520 -} -/s[2,0] = { - /s.x = -1344032615 - /s.y = -871416961 -} -/s[2,1] = { - /s.x = -1928735161 - /s.y = 935744880 -} -/s[2,2] = { - /s.x = -1509955773 - /s.y = -1707460853 -} -/s[3,0] = { - /s.x = 1145911788 - /s.y = -415231529 -} -/s[3,1] = { - /s.x = -278269626 - /s.y = -1682978013 -} -/s[3,2] = { - /s.x = -1629885665 - /s.y = -909240754 -} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested.hdf5.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested.hdf5.raw.txt deleted file mode 100644 index 57c8557ac2..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested.hdf5.raw.txt +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - -/x = { - /x.field1 = { - /x.field1.x = 1 - /x.field1.y = -2 - } - /x.field2 = { - /x.field2.x = 255 - /x.field2.y = 90 - } -} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested3.hdf5.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested3.hdf5.raw.txt deleted file mode 100644 index ed42456ce6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_nested3.hdf5.raw.txt +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - -/x = { - /x.field3 = { - /x.field3.field2 = { - /x.field3.field2.field1 = 17 - } - } -} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_type.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_type.nc.raw.txt deleted file mode 100644 index f15f61d6b3..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_struct_type.nc.raw.txt +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -/s = { - /s.x = 1 - /s.y = -2 -} - diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_utf8.nc.raw.txt b/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_utf8.nc.raw.txt deleted file mode 100644 index 4df9309d37..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_utf8.nc.raw.txt +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - -/vs[0] = "Καλημέα" -/vs[1] = "abc" - diff --git a/dap4/d4tests/src/test/data/resources/TestDSR/baseline/test1.dsr b/dap4/d4tests/src/test/data/resources/TestDSR/baseline/test1.dsr deleted file mode 100644 index 125939c27c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestDSR/baseline/test1.dsr +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0 - TDS-4 - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dap b/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dap deleted file mode 100644 index f36a08093f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dap +++ /dev/null @@ -1,3 +0,0 @@ -count=5 - -1169720286 18719 -2088732436 -16591 -1123468835 -18686 2125143125 -21899 1268468519 -22144 - checksum = 4aad97d4 diff --git a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dmr b/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dmr deleted file mode 100644 index 29109a2c04..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.1.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.2.dap b/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.2.dap deleted file mode 100644 index 7d7d18b90f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestFilters/baseline/test_sequence_1.syn.2.dap +++ /dev/null @@ -1,3 +0,0 @@ -count=3 - -1169720286 18719 -2088732436 -16591 -1123468835 -18686 - checksum = 6a9c6608 diff --git a/dap4/d4tests/src/test/data/resources/TestFrontPage/baseline/test_frontpage.html b/dap4/d4tests/src/test/data/resources/TestFrontPage/baseline/test_frontpage.html deleted file mode 100644 index 51e228d2dd..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestFrontPage/baseline/test_frontpage.html +++ /dev/null @@ -1,296 +0,0 @@ - - -DAP4 Test Files - - - -

DAP4 Test Files

-

http://remotetest.unidata.ucar.edu/d4ts/{testfiles}

-
-

netCDF Based Test Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
test_atomic_array.nc: DMR.XML DAP DSR.XML
test_atomic_types.nc: DMR.XML DAP DSR.XML
test_enum.nc: DMR.XML DAP DSR.XML
test_enum1.nc: DMR.XML DAP DSR.XML
test_enum_2.nc: DMR.XML DAP DSR.XML
test_enum_array.nc: DMR.XML DAP DSR.XML
test_fill.nc: DMR.XML DAP DSR.XML
test_groups1.nc: DMR.XML DAP DSR.XML
test_misc1.nc: DMR.XML DAP DSR.XML
test_one_var.nc: DMR.XML DAP DSR.XML
test_one_vararray.nc: DMR.XML DAP DSR.XML
test_opaque.nc: DMR.XML DAP DSR.XML
test_opaque_array.nc: DMR.XML DAP DSR.XML
test_struct1.nc: DMR.XML DAP DSR.XML
test_struct_array.nc: DMR.XML DAP DSR.XML
test_struct_nested.nc: DMR.XML DAP DSR.XML
test_struct_nested3.nc: DMR.XML DAP DSR.XML
test_struct_type.nc: DMR.XML DAP DSR.XML
test_test.nc: DMR.XML DAP DSR.XML
test_unlim.nc: DMR.XML DAP DSR.XML
test_unlim1.nc: DMR.XML DAP DSR.XML
test_utf8.nc: DMR.XML DAP DSR.XML
test_vlen1.nc: DMR.XML DAP DSR.XML
test_vlen10.nc: DMR.XML DAP DSR.XML
test_vlen11.nc: DMR.XML DAP DSR.XML
test_vlen2.nc: DMR.XML DAP DSR.XML
test_vlen3.nc: DMR.XML DAP DSR.XML
test_vlen4.nc: DMR.XML DAP DSR.XML
test_vlen5.nc: DMR.XML DAP DSR.XML
test_vlen6.nc: DMR.XML DAP DSR.XML
test_vlen7.nc: DMR.XML DAP DSR.XML
test_vlen8.nc: DMR.XML DAP DSR.XML
test_vlen9.nc: DMR.XML DAP DSR.XML
test_zerodim.nc: DMR.XML DAP DSR.XML
tst_fills.nc: DMR.XML DAP DSR.XML
-

HDF5 Based Test Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
test_struct_nested.hdf5: DMR.XML DAP DSR.XML
test_struct_nested3.hdf5: DMR.XML DAP DSR.XML
test_vlen3.hdf5: DMR.XML DAP DSR.XML
test_vlen4.hdf5: DMR.XML DAP DSR.XML
test_vlen5.hdf5: DMR.XML DAP DSR.XML
-

Synthetic Based Test Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
test_anon_dim.syn: DMR.XML DAP DSR.XML
test_atomic_array.syn: DMR.XML DAP DSR.XML
test_atomic_types.syn: DMR.XML DAP DSR.XML
test_sequence_1.syn: DMR.XML DAP DSR.XML
test_sequence_2.syn: DMR.XML DAP DSR.XML
test_struct_array.syn: DMR.XML DAP DSR.XML
-
- diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.1.xml deleted file mode 100644 index 24f33b55bd..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - 1 - 2 - 3 - - - - some_large_hex_value - - - red - green - blue - - - 98.6 - - - barf - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.xml deleted file mode 100644 index e3d90ac6e0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 1 - 2 - 3 - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_1.xml deleted file mode 100644 index eb2ba2bd26..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.1.xml deleted file mode 100644 index 14d9b2b378..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.1.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.xml deleted file mode 100644 index de25771186..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.1.xml deleted file mode 100644 index e2912f2f3c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.1.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - 1 - 2 - 3 - - - - some_large_hex_value - - - red - green - blue - - - 98.6 - - - barf - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.2.xml deleted file mode 100644 index e4bd6ea48c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.2.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.3.xml deleted file mode 100644 index b2e99a4064..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.3.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - 1 - 2 - 3 - - - - some_large_hex_value - - - red - green - blue - - - 98.6 - - - barf - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.4.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.4.xml deleted file mode 100644 index 98354ea298..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.4.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.5.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.5.xml deleted file mode 100644 index 822345c2e6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.5.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.xml deleted file mode 100644 index 7675f27e56..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_3.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.1.xml deleted file mode 100644 index e43ec4f81f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.1.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.xml deleted file mode 100644 index 7728abca32..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_4.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.1.xml deleted file mode 100644 index 8ae88fff55..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.1.xml +++ /dev/null @@ -1,53 +0,0 @@ - - dapVersion="4.0" dmrVersion="1.0"> - - - - - - - - - - - - 1 - 2 - 3 - - - - some_large_hex_value - - - - - - - - - - - - - - - 1 - 2 - 3 - - - - some_large_hex_value - - - red - green - blue - - - 98.6 - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.xml deleted file mode 100644 index 7900313c64..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_5.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.1.xml deleted file mode 100644 index 0585fd7a24..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.1.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - 1 - 2 - 3 - - - - - - - - - - - - - 1 - 2 - 3 - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.2.xml deleted file mode 100644 index 92960908f8..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.2.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - 1 - 2 - 3 - - - - - - - - - - - - - - - - - - - 1 - 2 - 3 - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.xml deleted file mode 100644 index a88b5bf47d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_6.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.1.xml deleted file mode 100644 index 588a1ee931..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.1.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.2.xml deleted file mode 100644 index 25b9b59c51..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.2.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.3.xml deleted file mode 100644 index 5d04405d3d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.3.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.4.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.4.xml deleted file mode 100644 index aef2e07583..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.4.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.5.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.5.xml deleted file mode 100644 index 2e5bcacfee..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.5.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.xml deleted file mode 100644 index d2e55307d7..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_7.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_8.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_8.xml deleted file mode 100644 index 29a93fe87f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/DMR_8.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_1.xml deleted file mode 100644 index da6d955ac4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_10.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_10.xml deleted file mode 100644 index aac65a7955..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_10.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_11.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_11.xml deleted file mode 100644 index f661ce3517..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_11.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_2.xml deleted file mode 100644 index 45ab981649..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_3.xml deleted file mode 100644 index 356785c0e4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_3.xml +++ /dev/null @@ -1,12 +0,0 @@ - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_4.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_4.xml deleted file mode 100644 index e04b11ed9b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_4.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_5.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_5.xml deleted file mode 100644 index de24f7fdfa..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_5.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_6.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_6.xml deleted file mode 100644 index 88a4209425..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_6.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_7.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_7.xml deleted file mode 100644 index 00a22b0c81..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_7.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_8.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_8.xml deleted file mode 100644 index 61919cb9d3..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_array_8.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_escaped_paths.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_escaped_paths.xml deleted file mode 100644 index afd82e7bf2..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_escaped_paths.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.dmr b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.dmr deleted file mode 100644 index 503b89e031..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.dmr +++ /dev/null @@ -1,10 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.xml deleted file mode 100644 index 503b89e031..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_10.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_10.xml deleted file mode 100644 index e87a967368..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_10.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_2.xml deleted file mode 100644 index 78e6928d1e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_2.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3.xml deleted file mode 100644 index 5068261867..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_1.xml deleted file mode 100644 index 5686798376..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_2.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_2.xml deleted file mode 100644 index 6f28cd48ae..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_3.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_3.xml deleted file mode 100644 index c8d6f24d51..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_3_error_3.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_4.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_4.xml deleted file mode 100644 index 416f4597e5..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_4.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - x_axis_value - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_5.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_5.xml deleted file mode 100644 index 5c844638ef..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_5.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_6.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_6.xml deleted file mode 100644 index 20e14a6f6a..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_6.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_7.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_7.xml deleted file mode 100644 index d163b92912..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_7.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_8.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_8.xml deleted file mode 100644 index 4db2522603..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_8.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.1.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.1.xml deleted file mode 100644 index 0dacc20a66..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.1.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.xml b/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.xml deleted file mode 100644 index fd38d284d6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/dmr/test_simple_9.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - xmlns="http://xml.opendap.org/ns/DAP/4.0#" - xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestHyrax/hyrax.html b/dap4/d4tests/src/test/data/resources/TestHyrax/hyrax.html deleted file mode 100644 index e92d923650..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestHyrax/hyrax.html +++ /dev/null @@ -1,380 +0,0 @@ - - -DAP4 Test Files - - - -

DAP4 Test Files

-

http://amazon.com/dap/reader/dap4/dap4.html

-
-

netCDF Based Test Files

- -
-

HDF5 Based Test Files

- -
-

Synthetic Based Test Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
test_simple_1.dmr: DMR (XML) DAP DSR
dmr-testsuite/test_array_10.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_11.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_1.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_2.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_3.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_4.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_5.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_6.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_7.xml: DMR (XML) DAP DSR
dmr-testsuite/test_array_8.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_10.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_1.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_2.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_3_error_1.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_3_error_2.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_3_error_3.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_3.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_4.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_5.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_6.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_7.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_8.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_9.1.xml: DMR (XML) DAP DSR
dmr-testsuite/test_simple_9.xml: DMR (XML) DAP DSR
dmr-testsuite/test_escaped_paths.xml: DMR (XML) DAP DSR
D4-xml/DMR_0.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_0.xml: DMR (XML) DAP DSR
D4-xml/DMR_1.xml: DMR (XML) DAP DSR
D4-xml/DMR_2.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_2.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.2.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.3.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.4.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.5.xml: DMR (XML) DAP DSR
D4-xml/DMR_3.xml: DMR (XML) DAP DSR
D4-xml/DMR_4.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_4.xml: DMR (XML) DAP DSR
D4-xml/DMR_5.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_5.xml: DMR (XML) DAP DSR
D4-xml/DMR_6.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_6.2.xml: DMR (XML) DAP DSR
D4-xml/DMR_6.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.1.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.2.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.3.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.4.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.5.xml: DMR (XML) DAP DSR
D4-xml/DMR_7.xml: DMR (XML) DAP DSR
D4-xml/DMR_8.xml: DMR (XML) DAP DSR
-
- diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dap deleted file mode 100644 index b62c9b8688..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dap +++ /dev/null @@ -1,67 +0,0 @@ -netcdf test_struct_array { - dimensions: - dx = 4; - dy = 3; - variables: - - Structure { - int x; - string x:_CoordinateAxisType = "GeoX"; - int y; - string y:_CoordinateAxisType = "GeoY"; - } s(dx, dy); - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -s = - { - x =1 - y =-1 - } s(0) - { - x =17 - y =37 - } s(1) - { - x =-32767 - y =32767 - } s(2) - { - x =-1 - y =3 - } s(3) - { - x =-2 - y =2 - } s(4) - { - x =-3 - y =1 - } s(5) - { - x =-4 - y =12 - } s(6) - { - x =-8 - y =8 - } s(7) - { - x =-12 - y =4 - } s(8) - { - x =-5 - y =15 - } s(9) - { - x =-10 - y =10 - } s(10) - { - x =-15 - y =5 - } s(11) -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dmr b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dmr deleted file mode 100644 index 8cb6375d5a..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dmr +++ /dev/null @@ -1,24 +0,0 @@ -netcdf test_struct_nested { - variables: - - Structure { - - Structure { - int x; - string x:_CoordinateAxisType = "GeoX"; - int y; - string y:_CoordinateAxisType = "GeoY"; - } field1; - - - Structure { - int x; - int y; - } field2; - - } x; - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dap deleted file mode 100644 index 3c411cc3c6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dap +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_vlen1 { - variables: - int x(*); - string x:_CoordinateAxisType = "GeoX"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -x = - {1, 3, 5, 7} -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dmr b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dmr deleted file mode 100644 index 66e15af40f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen1.nc.nc4.dmr +++ /dev/null @@ -1,8 +0,0 @@ -netcdf test_vlen1 { - variables: - int x(*); - string x:_CoordinateAxisType = "GeoX"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dap deleted file mode 100644 index 8628cb9931..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dap +++ /dev/null @@ -1,21 +0,0 @@ -netcdf test_vlen2 { - dimensions: - d3 = 3; - d2 = 2; - variables: - int x(d3, d2, *); - string x:_CoordinateAxisType = "GeoX"; - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: - x = - { - {1, 3, 5, 7}, - {100, 200}, - {-1, -2}, - {1, 3, 5, 7}, - {100, 200}, - {-1, -2} - } -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dap deleted file mode 100644 index aaef5daf73..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dap +++ /dev/null @@ -1,17 +0,0 @@ -netcdf test_vlen3 { - variables: - - Structure { - int f1(*); - } v1; - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: - v1 = - { - f1 = - {1, 3, 5, 7} - } v1(0) -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dap deleted file mode 100644 index 0c62ce086b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dap +++ /dev/null @@ -1,20 +0,0 @@ -netcdf test_vlen4 { - variables: - - Structure { - int f1(2, *); - } v1; - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: - v1 = - { - f1 = - { - {1, 3, 5, 7}, - {100, 200} - } - } v1(0) -} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dap b/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dap deleted file mode 100644 index 8e92721907..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dap +++ /dev/null @@ -1,23 +0,0 @@ -netcdf test_vlen5 { - dimensions: - d2 = 2; - variables: - - Structure { - int v(*); - } v1(d2); - - - // global attributes: - string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v1 = - { - v = - {1, 3, 5, 7} - } v1(0) - { - v = - {100, 200} - } v1(1) -} diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_anon_dim.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_anon_dim.syn.dmp deleted file mode 100644 index 8bfb4671ca..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_anon_dim.syn.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.nc.dmp deleted file mode 100644 index 52f093929b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.nc.dmp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.syn.dmp deleted file mode 100644 index 3519a327b0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_array.syn.dmp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.nc.dmp deleted file mode 100644 index aef3b9eda0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.nc.dmp +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.syn.dmp deleted file mode 100644 index f7a05c2e72..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_atomic_types.syn.dmp +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum.nc.dmp deleted file mode 100644 index 10841fbc27..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum.nc.dmp +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_2.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_2.nc.dmp deleted file mode 100644 index e29149a244..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_2.nc.dmp +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_array.nc.dmp deleted file mode 100644 index bfa1765093..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_enum_array.nc.dmp +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_fill.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_fill.nc.dmp deleted file mode 100644 index 2d1ba264b4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_fill.nc.dmp +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_groups1.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_groups1.nc.dmp deleted file mode 100644 index 80f918edc6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_groups1.nc.dmp +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_var.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_var.nc.dmp deleted file mode 100644 index 89016b1816..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_var.nc.dmp +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_vararray.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_vararray.nc.dmp deleted file mode 100644 index 8f199d1cb1..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_one_vararray.nc.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque.nc.dmp deleted file mode 100644 index 1214eb28eb..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque.nc.dmp +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque_array.nc.dmp deleted file mode 100644 index b79939de67..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_opaque_array.nc.dmp +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_1.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_1.syn.dmp deleted file mode 100644 index 29109a2c04..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_1.syn.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_2.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_2.syn.dmp deleted file mode 100644 index 4194cf19d4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_sequence_2.syn.dmp +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.nc.dmp deleted file mode 100644 index 8dabe14882..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.nc.dmp +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.syn.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.syn.dmp deleted file mode 100644 index 909d78befa..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_array.syn.dmp +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested.hdf5.dmp deleted file mode 100644 index 376824981e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested.hdf5.dmp +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested3.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested3.hdf5.dmp deleted file mode 100644 index 03ac53d23c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_nested3.hdf5.dmp +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_type.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_type.nc.dmp deleted file mode 100644 index 4e2adb0c1d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_struct_type.nc.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_utf8.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_utf8.nc.dmp deleted file mode 100644 index 74115be967..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_utf8.nc.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen1.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen1.nc.dmp deleted file mode 100644 index b30754e1b2..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen1.nc.dmp +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen2.nc.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen2.nc.dmp deleted file mode 100644 index cea92859ec..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen2.nc.dmp +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen3.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen3.hdf5.dmp deleted file mode 100644 index dbad545664..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen3.hdf5.dmp +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/testall.dmp b/dap4/d4tests/src/test/data/resources/TestParsers/baseline/testall.dmp deleted file mode 100644 index 9b57107614..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/testall.dmp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.nc.dmr deleted file mode 100644 index 29a61e7c8b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.nc.dmr +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.syn.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.syn.dmr deleted file mode 100644 index 3519a327b0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_array.syn.dmr +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.nc.dmr deleted file mode 100644 index aef3b9eda0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.nc.dmr +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.syn.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.syn.dmr deleted file mode 100644 index ec5ed7d9f7..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_atomic_types.syn.dmr +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum.nc.dmr deleted file mode 100644 index 10841fbc27..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum.nc.dmr +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum_array.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum_array.nc.dmr deleted file mode 100644 index bfa1765093..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_enum_array.nc.dmr +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_groups1.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_groups1.nc.dmr deleted file mode 100644 index 80f918edc6..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_groups1.nc.dmr +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_var.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_var.nc.dmr deleted file mode 100644 index 89016b1816..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_var.nc.dmr +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_vararray.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_vararray.nc.dmr deleted file mode 100644 index 8f199d1cb1..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_one_vararray.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_array.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_array.nc.dmr deleted file mode 100644 index 8dabe14882..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_array.nc.dmr +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested.hdf5.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested.hdf5.dmr deleted file mode 100644 index 376824981e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested.hdf5.dmr +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested3.hdf5.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested3.hdf5.dmr deleted file mode 100644 index 03ac53d23c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_nested3.hdf5.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_type.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_type.nc.dmr deleted file mode 100644 index 4e2adb0c1d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_struct_type.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_utf8.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_utf8.nc.dmr deleted file mode 100644 index 74115be967..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_utf8.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen1.nc.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen1.nc.dmr deleted file mode 100644 index b30754e1b2..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen1.nc.dmr +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen3.hdf5.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen3.hdf5.dmr deleted file mode 100644 index dbad545664..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen3.hdf5.dmr +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen5.hdf5.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen5.hdf5.dmr deleted file mode 100644 index 20cc09a17b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen5.hdf5.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/testall.dmr b/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/testall.dmr deleted file mode 100644 index 0e2bf5de38..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/testall.dmr +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - abcd "hello" "quoted" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1.txt b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1.txt deleted file mode 100644 index 73b06f4c1f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Constraint tests for ce1_dmr.txt -/a[1] -/b[10:16] -/c[8:2:15] -/a[1];/b[10:16];/c[8:2:15] -/d[1][0:2:2];/a[1];/e[1][0];/f[0][1] -/s[0:3][0:2].x;/s[0:3][0:2].y - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1_dmr.txt b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1_dmr.txt deleted file mode 100644 index e3b4d952be..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/ce1_dmr.txt +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc1.xml b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc1.xml deleted file mode 100644 index 16d8b476e3..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc1.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc2.xml b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc2.xml deleted file mode 100644 index e92d76698d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_misc2.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_1.xml b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_1.xml deleted file mode 100644 index 985fb24ba0..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_2.xml b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_2.xml deleted file mode 100644 index 60a1956ff4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/test_simple_2.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/testall.xml b/dap4/d4tests/src/test/data/resources/TestParsers/testinput/testall.xml deleted file mode 100644 index dfe668a95c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestParsers/testinput/testall.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - abcd \"hello\" "quoted" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_aaa.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_aaa.nc.dmp deleted file mode 100644 index 54fdf0828f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_aaa.nc.dmp +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -vs(0) = "Καλημέα" ; -vs(1) = "abc" ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.0.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.0.dmp deleted file mode 100644 index 9ee80fe4bb..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.0.dmp +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - -vu8(0,0) = 3 ; -vu8(0,1) = 5 ; -vd(0) = 1024.800000 ; -vs(0,0) = " -" ; -vo(0,0) = 0xABCDEF0000000000 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.1.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.1.dmp deleted file mode 100644 index e076c6ee23..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.1.dmp +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.dmp deleted file mode 100644 index bdea13973c..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.dmp +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -vu8(0,0) = 255 ; -vu8(0,1) = 1 ; -vu8(0,2) = 2 ; -vu8(1,0) = 3 ; -vu8(1,1) = 4 ; -vu8(1,2) = 5 ; -v16(0) = 1 ; -v16(1) = 2 ; -v16(2) = 3 ; -v16(3) = 4 ; -vu32(0,0) = 5 ; -vu32(0,1) = 4 ; -vu32(0,2) = 3 ; -vu32(1,0) = 2 ; -vu32(1,1) = 1 ; -vu32(1,2) = 0 ; -vd(0) = 17.900000 ; -vd(1) = 1024.800000 ; -vc(0) = '@' ; -vc(1) = '&' ; -vs(0,0) = "hello world" ; -vs(0,1) = "abc" ; -vs(1,0) = " -" ; -vs(1,1) = "Καλημέα" ; -vo(0,0) = 0x0123456789ABCDEF ; -vo(0,1) = 0xABCDEF0000000000 ; -primary_cloud(0) = Clear ; -primary_cloud(1) = Stratus ; -primary_cloud(2) = Clear ; -primary_cloud(3) = Cumulonimbus ; -primary_cloud(4) = Missing ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.ncdump deleted file mode 100644 index b9507deedf..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_array.nc.ncdump +++ /dev/null @@ -1,57 +0,0 @@ -netcdf null { - types: - enum cloud_class_t { 'Clear' = 0, 'Cumulonimbus' = 1, 'Stratus' = 2, 'Stratocumulus' = 3, 'Cumulus' = 4, 'Altostratus' = 5, 'Nimbostratus' = 6, 'Altocumulus' = 7, 'Missing' = 127, 'Cirrostratus' = 8, 'Cirrocumulus' = 9, 'Cirrus' = 10}; - - dimensions: - d1 = 1; - d2 = 2; - d3 = 3; - d4 = 4; - d5 = 5; - variables: - byte vu8(d2=2, d3=3); - :_Unsigned = "true"; - - short v16(d4=4); - - int vu32(d2=2, d3=3); - :_Unsigned = "true"; - - double vd(d2=2); - - char vc(d2=2); - - String vs(d2=2, d2=2); - - opaque vo(d1=1, d2=2); - - String primary_cloud(d5=5); - :_FillValue = "Missing"; - - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {-1, 1, 2}, - {3, 4, 5} - } -v16 = - {1, 2, 3, 4} -vu32 = - { - {5, 4, 3}, - {2, 1, 0} - } -vd = - {17.9, 1024.8} -vc = "@&" -vs = - { "hello world", "abc", " -", "Καλημέρα" - } -vo = 0x0123456789abcdef, - 0xabcdef0000000000, - -primary_cloud = "Clear", "Clear", "Clear", "Clear", "Clear" -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.dmp deleted file mode 100644 index e26e76d516..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.dmp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -v8 = -128 ; -vu8 = 255 ; -v16 = -32768 ; -vu16 = 65535 ; -v32 = 2147483647 ; -vu32 = 4294967295 ; -v64 = 9223372036854775807 ; -vu64 = 18446744073709551615 ; -vf = 3.141593 ; -vd = 3.141593 ; -vc = '@' ; -vs = "hello world" ; -vo = 0x0123456789ABCDEF ; -primary_cloud = Stratus ; -secondary_cloud = Missing ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.ncdump deleted file mode 100644 index 62a82936ef..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_atomic_types.nc.ncdump +++ /dev/null @@ -1,61 +0,0 @@ -netcdf null { - types: - enum cloud_class_t { 'Clear' = 0, 'Cumulonimbus' = 1, 'Stratus' = 2, 'Stratocumulus' = 3, 'Cumulus' = 4, 'Altostratus' = 5, 'Nimbostratus' = 6, 'Altocumulus' = 7, 'Missing' = 127, 'Cirrostratus' = 8, 'Cirrocumulus' = 9, 'Cirrus' = 10}; - - variables: - byte v8; - - byte vu8; - :_Unsigned = "true"; - - short v16; - - short vu16; - :_Unsigned = "true"; - - int v32; - - int vu32; - :_Unsigned = "true"; - - long v64; - - long vu64; - :_Unsigned = "true"; - - float vf; - - double vd; - - char vc; - - String vs; - - opaque vo; - - String primary_cloud; - :_FillValue = "Missing"; - - String secondary_cloud; - :_FillValue = "Missing"; - - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v8 =-128 -vu8 =-1 -v16 =-32768 -vu16 =-1 -v32 =2147483647 -vu32 =-1 -v64 =9223372036854775807 -vu64 =-1 -vf =3.1415927 -vd =3.141592653589793 -vc =@ -vs = "hello world" -vo = 0x0123456789abcdef, - -primary_cloud = "Stratus" -secondary_cloud = "Unknown enum value=60" -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum.nc.dmp deleted file mode 100644 index 5708512c59..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum.nc.dmp +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -primary_cloud = Stratus ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.0.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.0.dmp deleted file mode 100644 index c08e20fe0f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.0.dmp +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -primary_cloud(0) = Clear ; -primary_cloud(1) = Stratus ; -primary_cloud(2) = Clear ; -primary_cloud(3) = Cumulonimbus ; -primary_cloud(4) = Missing ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.1.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.1.dmp deleted file mode 100644 index 02fa4ec7e5..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.1.dmp +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -primary_cloud(0) = Stratus ; -primary_cloud(1) = Cumulonimbus ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.dmp deleted file mode 100644 index b82a1e1091..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_enum_array.nc.dmp +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -primary_cloud(0) = Clear ; -primary_cloud(1) = Stratus ; -primary_cloud(2) = Clear ; -primary_cloud(3) = Cumulonimbus ; -primary_cloud(4) = Missing ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.dmp deleted file mode 100644 index 2458e100dd..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.dmp +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.ncdump deleted file mode 100644 index d0ff04ed22..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_groups1.nc.ncdump +++ /dev/null @@ -1,7 +0,0 @@ -netcdf null { - dimensions: - dim1 = 5; - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.dmp deleted file mode 100644 index 07327c9df8..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.dmp +++ /dev/null @@ -1,5 +0,0 @@ - - - - -t = 17 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.ncdump deleted file mode 100644 index f9b96a90ca..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_var.nc.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf null { - variables: - int t; - - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t =17 -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.0.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.0.dmp deleted file mode 100644 index b42a52d67e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.0.dmp +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -t(0) = 17 ; -t(1) = 37 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.1.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.1.dmp deleted file mode 100644 index 5cd368ebb4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.1.dmp +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -t(0) = 37 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.dmp deleted file mode 100644 index b42a52d67e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_one_vararray.nc.dmp +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -t(0) = 17 ; -t(1) = 37 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.0.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.0.dmp deleted file mode 100644 index d9cf704dcf..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.0.dmp +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - -Struct { -s.x = 1 ; -s.y = -1 ; -} s(0); -Struct { -s.x = 17 ; -s.y = 37 ; -} s(1); -Struct { -s.x = -4 ; -s.y = 12 ; -} s(2); -Struct { -s.x = -8 ; -s.y = 8 ; -} s(3); diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.dmp deleted file mode 100644 index 13448edf44..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.dmp +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - -Struct { -s.x = 1 ; -s.y = -1 ; -} s(0); -Struct { -s.x = 17 ; -s.y = 37 ; -} s(1); -Struct { -s.x = -32767 ; -s.y = 32767 ; -} s(2); -Struct { -s.x = -1 ; -s.y = 3 ; -} s(3); -Struct { -s.x = -2 ; -s.y = 2 ; -} s(4); -Struct { -s.x = -3 ; -s.y = 1 ; -} s(5); -Struct { -s.x = -4 ; -s.y = 12 ; -} s(6); -Struct { -s.x = -8 ; -s.y = 8 ; -} s(7); -Struct { -s.x = -12 ; -s.y = 4 ; -} s(8); -Struct { -s.x = -5 ; -s.y = 15 ; -} s(9); -Struct { -s.x = -10 ; -s.y = 10 ; -} s(10); -Struct { -s.x = -15 ; -s.y = 5 ; -} s(11); diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.ncdump deleted file mode 100644 index 296e936377..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_array.nc.ncdump +++ /dev/null @@ -1,26 +0,0 @@ -netcdf null { - dimensions: - dx = 2; - variables: - - Structure { - int x; - :_CoordinateAxisType = "GeoX"; - int y; - :_CoordinateAxisType = "GeoY"; - } x(dx=2); - - - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -x = - { - x =1 - y =-2 - } x(0) - { - x =17 - y =37 - } x(1) -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_nested.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_nested.hdf5.dmp deleted file mode 100644 index ab0a96abaa..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_nested.hdf5.dmp +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - -Struct { -Struct { -x.field1.x = 1 ; -x.field1.y = -2 ; -} x.field1; -Struct { -x.field2.x = 255 ; -x.field2.y = 90 ; -} x.field2; -} x; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.dmp deleted file mode 100644 index 9bf70f993e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -Struct { -s.x = 1 ; -s.y = -2 ; -} s; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.ncdump b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.ncdump deleted file mode 100644 index a7a7e096a9..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_struct_type.nc.ncdump +++ /dev/null @@ -1,18 +0,0 @@ -netcdf null { - variables: - - Structure { - int x; - :_CoordinateAxisType = "GeoX"; - int y; - :_CoordinateAxisType = "GeoY"; - } x; - - - // global attributes: - :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -x = x =1 - y =-2 - -} diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_utf8.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_utf8.nc.dmp deleted file mode 100644 index 54fdf0828f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_utf8.nc.dmp +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -vs(0) = "Καλημέα" ; -vs(1) = "abc" ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen1.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen1.nc.dmp deleted file mode 100644 index d341f2cefc..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen1.nc.dmp +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -x(0) = 1 ; -x(1) = 3 ; -x(2) = 5 ; -x(3) = 7 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen2.nc.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen2.nc.dmp deleted file mode 100644 index f530233504..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen2.nc.dmp +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - -x(0,0) = 1,3,5,7 ; -x(0,1) = 100,200 ; -x(1,0) = -1,-2 ; -x(1,1) = 1,3,5,7 ; -x(2,0) = 100,200 ; -x(2,1) = -1,-2 ; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen3.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen3.hdf5.dmp deleted file mode 100644 index 1197da6c2f..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen3.hdf5.dmp +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - -Struct { -v1.f1(0) = 1 ; -v1.f1(1) = 3 ; -v1.f1(2) = 5 ; -v1.f1(3) = 7 ; -} v1; diff --git a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen5.hdf5.dmp b/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen5.hdf5.dmp deleted file mode 100644 index 341c6ecfe9..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestSerial/baseline/test_vlen5.hdf5.dmp +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - -Struct { -v1.v(0) = 1 ; -v1.v(1) = 3 ; -v1.v(2) = 5 ; -v1.v(3) = 7 ; -} v1(0); -Struct { -v1.v(0) = 100 ; -v1.v(1) = 200 ; -} v1(1); diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dap deleted file mode 100644 index 82d8047804..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dap +++ /dev/null @@ -1 +0,0 @@ - [0] -1169720286 [1] -920699049 [2] -2088732436 [3] 1060190036 [4] -1123468835 [5] 922940053 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dmr b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dmr deleted file mode 100644 index acfbb02341..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_anon_dim.syn.dmr +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dap deleted file mode 100644 index 59a60fbd3b..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dap +++ /dev/null @@ -1,8 +0,0 @@ - [0] 255 [1] 1 [2] 2 [3] 3 [4] 4 [5] 5 - [0] 1 [1] 2 [2] 3 [3] 4 - [0] 5 [1] 4 [2] 3 [3] 2 [4] 1 [5] 0 - [0] 17.9000 [1] 1024.80 - [0] '@' [1] '&' - [0] "hello\tworld" [1] "\r\n" [2] "Καλημέα" [3] "abc" - [0] 0x0123456789ABCDEF [1] 0xABCDEF0000000000 - [0] 0 [1] 2 [2] 0 [3] 1 [4] 127 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dap deleted file mode 100644 index 8bc6508fd1..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dap +++ /dev/null @@ -1,8 +0,0 @@ - [0] 186 [1] 201 [2] 131 [3] 63 [4] 189 [5] 55 - [0] -341 [1] -21899 [2] -13413 [3] -22144 - [0] 2367803413 [1] 3586730583 [2] 511843988 [3] 3754752863 [4] 2950934681 [5] 2366232135 - [0] 0.217870 [1] 0.602451 - [0] 'C' [1] 'O' - [0] "{S" [1] "gb8^OE$" [2] "4a/q%n9;5Y" [3] "{fIl?T\"\\A[" - [0] 0xA2177AA7287C04FA8BB57BCDF76EC80F [1] 0x34FA472AA9404DD543143CADED303A75 - [0] 2 [1] 9 [2] 6 [3] 8 [4] 3 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dap deleted file mode 100644 index 0b6fb8911a..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dap +++ /dev/null @@ -1,15 +0,0 @@ - -128 - 255 - -32768 - 65535 - 2147483647 - 4294967295 - 9223372036854775807 - 18446744073709551615 - 3.14159 - 3.14159 - '@' - "hello\tworld" - 0x0123456789ABCDEF - 2 - 127 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dap deleted file mode 100644 index 4fe0dfa020..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dap +++ /dev/null @@ -1,15 +0,0 @@ - 58 - 201 - 896 - 16177 - -1123468835 - 2125143125 - 3059391736915381031 - 11577488182652895291 - 0.551297 - 0.790267 - '*' - "O,L?c8A%V" - 0x46F169EF23CBAF9B1FEBD99E4E16CEC9 - 7 - 3 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dmr b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dmr deleted file mode 100644 index ad57f898be..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.syn.dmr +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dap deleted file mode 100644 index 671900d5f1..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 2 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dap deleted file mode 100644 index 671900d5f1..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 2 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dap deleted file mode 100644 index d13e008917..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 0 [1] 2 [2] 0 [3] 1 [4] 127 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dap deleted file mode 100644 index 3bf1930073..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dap +++ /dev/null @@ -1,3 +0,0 @@ - 240 - 32700 - 111000 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dap deleted file mode 100644 index 0af89ec492..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dap +++ /dev/null @@ -1,4 +0,0 @@ - [0] -876354855 [1] -1761252264 [2] 1723477387 [3] -46827465 [4] 1475147969 - [0] 12.0000 [1] -100.000 [2] 9.96921e+36 - [0] 2 [1] 3 [2] 5 [3] 7 [4] 11 - [0] 23.0000 [1] 29.0000 [2] 19.0000 [3] 31.0000 [4] 17.0000 [5] 37.0000 [6] 13.0000 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dap deleted file mode 100644 index d193859153..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 17 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dap deleted file mode 100644 index cef7e62967..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 17 37 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dmr b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dmr deleted file mode 100644 index 4e2b7d2430..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_vararray.nc.dmr +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dap deleted file mode 100644 index 8fc9b352ad..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 0x0123456789ABCDEF diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dap deleted file mode 100644 index 41b22527f4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 0x0123456789ABCDEF [1] 0xABCDEF0000000000 [2] 0xFEDCBA9876543210 [3] 0xFEDCBA9999999999 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dap deleted file mode 100644 index c8e824f78e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dap +++ /dev/null @@ -1,2 +0,0 @@ -count=1 - -920699049 896 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dmr b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dmr deleted file mode 100644 index bf34e35c7d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_1.syn.dmr +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dap deleted file mode 100644 index 3d99a97450..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dap +++ /dev/null @@ -1,5 +0,0 @@ -count=1 - -920699049 896 -count=4 - -1123468835 -18686 2125143125 -21899 1268468519 -22144 989876086 3361 - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dmr b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dmr deleted file mode 100644 index c9d9a09ad3..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_sequence_2.syn.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dap deleted file mode 100644 index 9518dd1bd8..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dap +++ /dev/null @@ -1,15 +0,0 @@ - [0] 0.727653 [1] 0.785633 [2] 0.513679 [3] 0.246845 - [0] 0.738422 [1] 0.214889 [2] 0.494798 - [0] 712320147 1268468519 - [0] 696298400 989876086 - [0] -1927163883 -900795134 - [1] -708236713 1377500019 - [1] 511843988 1699265896 - [1] -540214433 -914532520 - [2] -1344032615 -871416961 - [2] -1928735161 935744880 - [2] -1509955773 -1707460853 - [3] 1145911788 -415231529 - [3] -278269626 -1682978013 - [3] -1629885665 -909240754 - diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dap deleted file mode 100644 index 2e043ab8fe..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dap +++ /dev/null @@ -1 +0,0 @@ - 1 -2 255 90 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dap deleted file mode 100644 index d193859153..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dap +++ /dev/null @@ -1 +0,0 @@ - 17 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dap deleted file mode 100644 index 6e0cb49e1d..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dap +++ /dev/null @@ -1 +0,0 @@ - 1 -2 diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dap b/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dap deleted file mode 100644 index eb9b6ef983..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dap +++ /dev/null @@ -1,3 +0,0 @@ - [0] "Καλημέα" - [1] "abc" - diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dap deleted file mode 100644 index a69de268a4..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dap +++ /dev/null @@ -1 +0,0 @@ - 3125247010 3374268247 2206234860 1060190036 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dmr b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dmr deleted file mode 100644 index 058bb28134..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_anon_dim.syn.2.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dap deleted file mode 100644 index 7420b43453..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dap +++ /dev/null @@ -1,4 +0,0 @@ - [0] 3 [1] 5 - [0] 1024.80 - [0] "Καλημέα" - [0] 0xABCDEF0000000000 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dap deleted file mode 100644 index 9c060c2015..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 1 [1] 2 [2] 4 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dap deleted file mode 100644 index b7fc1fa5bd..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 4 [1] 1 [2] 2 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dap deleted file mode 100644 index 8277a7de56..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 2 [1] 1 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dap deleted file mode 100644 index e9082c0001..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dap +++ /dev/null @@ -1 +0,0 @@ - 37 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dap deleted file mode 100644 index cef7e62967..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dap +++ /dev/null @@ -1 +0,0 @@ - 17 37 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dap deleted file mode 100644 index 2c0819195e..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dap +++ /dev/null @@ -1 +0,0 @@ - [0] 0xFEDCBA9876543210 [1] 0xFEDCBA9999999999 diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dap b/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dap deleted file mode 100644 index af7758ecde..0000000000 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dap +++ /dev/null @@ -1 +0,0 @@ - 1 -1 17 37 -4 12 -8 8 diff --git a/dap4/d4tests/src/test/data/resources/favicon.ico b/dap4/d4tests/src/test/data/resources/favicon.ico deleted file mode 100644 index d63ed90888..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/favicon.ico and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/Makefile b/dap4/d4tests/src/test/data/resources/testfiles/Makefile deleted file mode 100644 index fda8984011..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -NC=\ -test_one_var \ -test_one_vararray \ -test_atomic_types \ -test_atomic_array \ -test_enum \ -test_enum_2 \ -test_enum_array \ -test_groups1 \ -test_struct_type \ -test_struct_array \ -test_misc1 \ -test_vlen1 \ -test_vlen2 \ -test_opaque \ -test_opaque_array \ -test_fill \ -test_utf8 - -HDF5=\ -test_struct_nested \ -test_struct_nested3 \ -test_vlen3 \ -test_vlen4 \ -test_vlen5 - -C=tst_fills tst_h5fill - -BUGS= - -all:: all2 all3 - -all1: - for x in ${C} ; do \ - gcc -g -O0 -o $$x.exe $$x.c -L/usr/local/lib -lnetcdf -lcurl -lhdf5 -lhdf5_hl ; \ - ./$$x ; \ - done - -all2: - for x in ${NC} ${HDF5} ; do ncgen -k3 $${x}.cdl ; done - -all3: - for x in ${HDF5} ; do cp $${x}.nc $${x}.hdf5 ; done - -clean:: - rm -f *.nc; rm -f *.hdf5; rm -f *.h5 - for x in ${C} ; do rm -f $$x.exe ; done - rm -fr dump - - -verify: - rm -fr dump - mkdir dump - for x in ${NC} ; do ncdump $${x}.nc > dump/$${x}.cdl ; done - for x in ${HDF5} ; do ncdump $${x}.hdf5 > dump/$${x}.cdl ; done - for x in ${NC} ${HDF5} ; do \ - echo $${x}.cdl ; \ - diff -wBb $${x}.cdl dump/$${x}.cdl ; \ - done - -UI=f:/git/thredds/ui/target/toolsUI-4.4.0-SNAPSHOT.jar -F=test_test - -# note -vall fails -x:: - rm -f ${F}.hdf5 ${F}.nc - ncgen -k3 -o ${F}.nc ${F}.cdl - cp ${F}.nc ${F}.hdf5 - java -cp ${UI} ucar.nc2.NCdumpW ${F}.hdf5 - -# ncdump ${F}.hdf5 - -t:: - ncgen -k3 -o ${F}.nc ${F}.cdl - ncdump ${F}.nc diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_aaa.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_aaa.nc.dmr deleted file mode 100644 index a8d498be14..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_aaa.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_array.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_array.nc.dmr deleted file mode 100644 index 9e0dd4e355..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_array.nc.dmr +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_types.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_types.nc.dmr deleted file mode 100644 index 88340335c2..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_atomic_types.nc.dmr +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum.nc.dmr deleted file mode 100644 index 7126f07378..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum.nc.dmr +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum1.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum1.nc.dmr deleted file mode 100644 index dca662dfc9..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum1.nc.dmr +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum2.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum2.nc.dmr deleted file mode 100644 index 6cfd3fa18c..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum2.nc.dmr +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum_array.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum_array.nc.dmr deleted file mode 100644 index dd8b966f98..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_enum_array.nc.dmr +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_groups1.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_groups1.nc.dmr deleted file mode 100644 index 80f918edc6..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_groups1.nc.dmr +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_numeric_types.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_numeric_types.nc.dmr deleted file mode 100644 index 57cb8ca453..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_numeric_types.nc.dmr +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_var.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_var.nc.dmr deleted file mode 100644 index 89016b1816..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_var.nc.dmr +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_vararray.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_vararray.nc.dmr deleted file mode 100644 index 8f199d1cb1..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_one_vararray.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_opaque_type.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_opaque_type.nc.dmr deleted file mode 100644 index 298d5f9c8e..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_opaque_type.nc.dmr +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_string_type.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_string_type.nc.dmr deleted file mode 100644 index 4b7615450f..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_string_type.nc.dmr +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct1.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct1.nc.dmr deleted file mode 100644 index 9612148ceb..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct1.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_array.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_array.nc.dmr deleted file mode 100644 index 8dabe14882..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_array.nc.dmr +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.hdf5.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.hdf5.dmr deleted file mode 100644 index 376824981e..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.hdf5.dmr +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.nc.dmr deleted file mode 100644 index f42d82a6ba..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_nested.nc.dmr +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_type.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_type.nc.dmr deleted file mode 100644 index 4e2adb0c1d..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_struct_type.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_utf8.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_utf8.nc.dmr deleted file mode 100644 index 74115be967..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_utf8.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen1.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen1.nc.dmr deleted file mode 100644 index b8086d06d1..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen1.nc.dmr +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen2.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen2.nc.dmr deleted file mode 100644 index f5ebdb60b9..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen2.nc.dmr +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.hdf5.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.hdf5.dmr deleted file mode 100644 index 13041f5136..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.hdf5.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.nc.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.nc.dmr deleted file mode 100644 index b8729a4e15..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen3.nc.dmr +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen4.hdf5.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen4.hdf5.dmr deleted file mode 100644 index 09398765d6..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen4.hdf5.dmr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen5.hdf5.dmr b/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen5.hdf5.dmr deleted file mode 100644 index 2cd00c88d1..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/dmr/test_vlen5.hdf5.dmr +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/doit b/dap4/d4tests/src/test/data/resources/testfiles/doit deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_anon_dim.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_anon_dim.syn deleted file mode 100644 index 221f7ac725..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_anon_dim.syn +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.cdl deleted file mode 100644 index ea901a8db6..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.cdl +++ /dev/null @@ -1,39 +0,0 @@ -netcdf test_atomic_array { -types: - opaque(8) o_t; - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -dimensions: - d1 = 1; - d2 = 2; - d3 = 3; - d4 = 4; - d5 = 5; -variables: - ubyte vu8(d2,d3); - short v16(d4); - uint vu32(d2,d3); - double vd(d2); - char vc(d2); - string vs(d2,d2); - o_t vo(d1,d2); - cloud_class_t primary_cloud(d5) ; - cloud_class_t primary_cloud:_FillValue = Missing ; - -data: - vu8 = - 255, 1, 2, - 3, 4, 5 ; - v16 = 1, 2, 3, 4 ; - vu32 = - 5, 4, 3, - 2, 1, 0 ; - vd = 17.9, 1024.8 ; - vc = '@', '&' ; - vs = "hello\tworld", "\r\n", "Καλημέα", "abc" ; - vo = - 0X0123456789ABCDEF, 0XABCDEF0000000000 ; - primary_cloud = Clear, Stratus, Clear, Cumulonimbus, _ ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.nc deleted file mode 100644 index 26cb578f8a..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.ncdump deleted file mode 100644 index 2a9d0f1966..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.ncdump +++ /dev/null @@ -1,48 +0,0 @@ -netcdf test_atomic_array { -types: - opaque(8) o_t ; - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -dimensions: - d1 = 1 ; - d2 = 2 ; - d3 = 3 ; - d4 = 4 ; - d5 = 5 ; -variables: - ubyte vu8(d2, d3) ; - short v16(d4) ; - uint vu32(d2, d3) ; - double vd(d2) ; - char vc(d2) ; - string vs(d2, d2) ; - o_t vo(d1, d2) ; - cloud_class_t primary_cloud(d5) ; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - - vu8 = - 255, 1, 2, - 3, 4, 5 ; - - v16 = 1, 2, 3, 4 ; - - vu32 = - 5, 4, 3, - 2, 1, 0 ; - - vd = 17.9, 1024.8 ; - - vc = "@&" ; - - vs = - "hello\tworld", "\r\n", - "Καλημέα", "abc" ; - - vo = - 0X0123456789ABCDEF, 0XABCDEF0000000000 ; - - primary_cloud = Clear, Stratus, Clear, Cumulonimbus, _ ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.syn deleted file mode 100644 index 86d46ceb7d..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_array.syn +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.cdl deleted file mode 100644 index d43301a201..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.cdl +++ /dev/null @@ -1,42 +0,0 @@ -netcdf test_atomic_types { -types: - opaque(8) o_t; - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - byte v8; - ubyte vu8; - short v16; - ushort vu16; - int v32; - uint vu32; - int64 v64; - uint64 vu64; - float vf; - double vd; - char vc; - string vs; - o_t vo; - cloud_class_t primary_cloud; - cloud_class_t primary_cloud:_FillValue = Missing ; - cloud_class_t secondary_cloud; - cloud_class_t secondary_cloud:_FillValue = Missing ; -data: - v8 = -128; - vu8 = 255; - v16 = -32768; - vu16 = 65535; - v32 = 2147483647; - vu32 = 4294967295; - v64 = 9223372036854775807; - vu64 = 18446744073709551615; - vf = 3.1415926535897932384626433832795; - vd = 3.141592653589793238462643383279502884197169399375105820974944592; - vc = '@'; - vs = "hello\tworld"; - vo = 0x0123456789abcdef; - primary_cloud = Stratus; - secondary_cloud = _; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.ncdump deleted file mode 100644 index dd4d209c48..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.ncdump +++ /dev/null @@ -1,57 +0,0 @@ -netcdf test_atomic_types { -types: - opaque(8) o_t ; - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - byte v8 ; - ubyte vu8 ; - short v16 ; - ushort vu16 ; - int v32 ; - uint vu32 ; - int64 v64 ; - uint64 vu64 ; - float vf ; - double vd ; - char vc ; - string vs ; - o_t vo ; - cloud_class_t primary_cloud ; - cloud_class_t primary_cloud:_FillValue = Missing ; - cloud_class_t secondary_cloud ; - cloud_class_t secondary_cloud:_FillValue = Missing ; -data: - - v8 = -128 ; - - vu8 = 255 ; - - v16 = -32768 ; - - vu16 = _ ; - - v32 = 2147483647 ; - - vu32 = _ ; - - v64 = 9223372036854775807 ; - - vu64 = 18446744073709551615 ; - - vf = 3.141593 ; - - vd = 3.14159265358979 ; - - vc = "@" ; - - vs = "hello\tworld" ; - - vo = 0X0123456789ABCDEF ; - - primary_cloud = Stratus ; - - secondary_cloud = _ ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.syn deleted file mode 100644 index d6f19ef663..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.syn +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_enum.cdl deleted file mode 100644 index 6cd1ceb34b..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.cdl +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_enum { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - cloud_class_t primary_cloud; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - primary_cloud = Stratus; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_enum.nc deleted file mode 100644 index 39a1db3688..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_enum.ncdump deleted file mode 100644 index 7a7ca86e1b..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum.ncdump +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_enum { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - cloud_class_t primary_cloud ; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - - primary_cloud = Stratus ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.cdl deleted file mode 100644 index da9c770a8b..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.cdl +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_enum1 { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - cloud_class_t primary_cloud; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - primary_cloud = Stratus; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.nc deleted file mode 100644 index 39a1db3688..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.ncdump deleted file mode 100644 index 7aea061a3b..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum1.ncdump +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_enum1 { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -variables: - cloud_class_t primary_cloud ; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - - primary_cloud = Stratus ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.cdl deleted file mode 100644 index ef6ab50d1d..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.cdl +++ /dev/null @@ -1,15 +0,0 @@ -// Test cross group enum references -netcdf test_enum_2 { - types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; - group: h { - variables: - /cloud_class_t primary_cloud; - /cloud_class_t primary_cloud:_FillValue = Missing ; - data: - primary_cloud = Stratus; - } -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.nc deleted file mode 100644 index ff30729699..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.ncdump deleted file mode 100644 index b651551733..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_2.ncdump +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_enum_2 { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; - -group: h { - variables: - cloud_class_t primary_cloud ; - cloud_class_t primary_cloud:_FillValue = Missing ; - data: - - primary_cloud = Stratus ; - } // group h -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.cdl deleted file mode 100644 index d395990b64..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.cdl +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_enum_array { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -dimensions: - d5 = 5; -variables: - cloud_class_t primary_cloud(d5); - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - primary_cloud = Clear, Stratus, Clear, Cumulonimbus, _ ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.ncdump deleted file mode 100644 index 1c5944620a..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.ncdump +++ /dev/null @@ -1,15 +0,0 @@ -netcdf test_enum_array { -types: - byte enum cloud_class_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, - Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, - Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, - Missing = 127} ; -dimensions: - d5 = 5 ; -variables: - cloud_class_t primary_cloud(d5) ; - cloud_class_t primary_cloud:_FillValue = Missing ; -data: - - primary_cloud = Clear, Stratus, Clear, Cumulonimbus, _ ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_fill.cdl deleted file mode 100644 index 7d2af998fc..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.cdl +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_fill { -variables: - ubyte uv8; - short v16; - uint uv32; - uv32:_FillValue=17; -data: - uv8 = 240; - v16 = 32700; - uv32 = 111000; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_fill.nc deleted file mode 100644 index 35e817fd5a..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_fill.ncdump deleted file mode 100644 index 5ca0494ef7..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_fill.ncdump +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_fill { -variables: - ubyte uv8 ; - short v16 ; - uint uv32 ; - uv32:_FillValue = 17U ; -data: - - uv8 = 240 ; - - v16 = 32700 ; - - uv32 = 111000 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.cdl deleted file mode 100644 index bde2677083..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.cdl +++ /dev/null @@ -1,35 +0,0 @@ -netcdf test_groups1 { -dimensions: - dim1 = 5 ; - -group: g { - dimensions: - dim2 = 3 ; - - group: h { - dimensions: - dim3 = 7 ; - variables: - int v1(dim1); - float v2(dim2); - data: - - v1 = -876354855, -1761252264, 1723477387, -46827465, 1475147969; - - v2 = 12, -100, _ ; - } // group h - - group: i { - dimensions: - dim3 = 7 ; - variables: - int v1(dim1); - float v3(dim3); - data: - - v1 = 2, 3, 5, 7, 11 ; - - v3 = 23, 29, 19, 31, 17, 37, 13 ; - } // group i -} // group g -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.nc deleted file mode 100644 index b4fe34704f..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.ncdump deleted file mode 100644 index d351478dbe..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_groups1.ncdump +++ /dev/null @@ -1,35 +0,0 @@ -netcdf test_groups1 { -dimensions: - dim1 = 5 ; - -group: g { - dimensions: - dim2 = 3 ; - - group: h { - dimensions: - dim3 = 7 ; - variables: - int v1(dim1) ; - float v2(dim2) ; - data: - - v1 = -876354855, -1761252264, 1723477387, -46827465, 1475147969 ; - - v2 = 12, -100, _ ; - } // group h - - group: i { - dimensions: - dim3 = 7 ; - variables: - int v1(dim1) ; - float v3(dim3) ; - data: - - v1 = 2, 3, 5, 7, 11 ; - - v3 = 23, 29, 19, 31, 17, 37, 13 ; - } // group i - } // group g -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_misc1.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_misc1.nc deleted file mode 100644 index 36fbab844d..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_misc1.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.cdl deleted file mode 100644 index f5edd1268f..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.cdl +++ /dev/null @@ -1,6 +0,0 @@ -netcdf test_one_var { -variables: - int t; -data: - t = 17; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.nc deleted file mode 100644 index 4169d2d296..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.ncdump deleted file mode 100644 index f4ab177bd6..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_one_var.ncdump +++ /dev/null @@ -1,7 +0,0 @@ -netcdf test_one_var { -variables: - int t ; -data: - - t = 17 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.cdl deleted file mode 100644 index 78d1ef14de..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.cdl +++ /dev/null @@ -1,8 +0,0 @@ -netcdf test_one_vararray { -dimensions: - d2 = 2; -variables: - int t(d2); -data: - t = 17, 37; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.ncdump deleted file mode 100644 index 964677c450..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf test_one_vararray { -dimensions: - d2 = 2 ; -variables: - int t(d2) ; -data: - - t = 17, 37 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.cdl deleted file mode 100644 index 5cc4e7abb3..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.cdl +++ /dev/null @@ -1,8 +0,0 @@ -netcdf test_opaque { -types: - opaque(8) o_t; -variables: - o_t vo1; -data: - vo1 = 0X0123456789ABCDEF ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.nc deleted file mode 100644 index ae6b866e9d..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.ncdump deleted file mode 100644 index 97de1aedbf..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf test_opaque { -types: - opaque(8) o_t ; -variables: - o_t vo1 ; -data: - - vo1 = 0X0123456789ABCDEF ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.cdl deleted file mode 100644 index bd33119964..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.cdl +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_opaque_array { -types: - opaque(8) o_t; -dimensions: - d2 = 2; -variables: - o_t vo2(d2,d2); -data: - vo2 = - 0X0123456789ABCDEF, 0XABCDEF0000000000, - 0XFEDCBA9876543210, 0XFEDCBA9999999999; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.ncdump deleted file mode 100644 index 4a7e2f1825..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.ncdump +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_opaque_array { -types: - opaque(8) o_t ; -dimensions: - d2 = 2 ; -variables: - o_t vo2(d2, d2) ; -data: - - vo2 = - 0X0123456789ABCDEF, 0XABCDEF0000000000, - 0XFEDCBA9876543210, 0XFEDCBA9999999999 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_1.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_1.syn deleted file mode 100644 index 355f652977..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_1.syn +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_2.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_2.syn deleted file mode 100644 index 4aa6576faf..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_sequence_2.syn +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.cdl deleted file mode 100644 index 005f897c52..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.cdl +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_struct_type { - types: - compound c_t { - int x ; - int y ; - }; // c_t -variables: - c_t s; -data: - s = {1,-2}; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.nc deleted file mode 100644 index 2a988dc2fe..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.ncdump deleted file mode 100644 index 1b2c36e6f7..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct1.ncdump +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_struct1 { -types: - compound c_t { - int x ; - int y ; - }; // c_t -variables: - c_t s ; -data: - - s = {1, -2} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.cdl deleted file mode 100644 index bc5f723006..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.cdl +++ /dev/null @@ -1,18 +0,0 @@ -netcdf test_struct_array { -types: - compound c_t { - int x ; - int y ; - }; // c_t -dimensions: - dx = 4; - dy = 3; -variables: - c_t s(dx,dy); -data: - s = -/*[0][0..2]*/ {1, -1}, {17, 37}, {-32767, 32767}, -/*[1][0..2]*/ {-1, 3}, {-2, 2}, {-3, 1}, -/*[2][0..2]*/ {-4, 12}, {-8, 8}, {-12, 4}, -/*[3][0..2]*/ {-5, 15}, {-10, 10}, {-15, 5} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.nc deleted file mode 100644 index 00be0b7551..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.ncdump deleted file mode 100644 index c306c05595..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.ncdump +++ /dev/null @@ -1,19 +0,0 @@ -netcdf test_struct_array { -types: - compound c_t { - int x ; - int y ; - }; // c_t -dimensions: - dx = 4 ; - dy = 3 ; -variables: - c_t s(dx, dy) ; -data: - - s = - {1, -1}, {17, 37}, {-32767, 32767}, - {-1, 3}, {-2, 2}, {-3, 1}, - {-4, 12}, {-8, 8}, {-12, 4}, - {-5, 15}, {-10, 10}, {-15, 5} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.syn b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.syn deleted file mode 100644 index dfe5cf7484..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_array.syn +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.cdl deleted file mode 100644 index 399d8954ef..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.cdl +++ /dev/null @@ -1,15 +0,0 @@ -netcdf test_struct_nested { - types: - compound s1_t { - int x ; - int y ; - }; // s1_t - compound s2_t { - s1_t field1 ; - s1_t field2 ; - }; // s2_t -variables: - s2_t x; -data: - x = {{1,-2}, {255, 90}}; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.hdf5 b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.hdf5 deleted file mode 100644 index f49856fa34..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.hdf5 and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.nc deleted file mode 100644 index 42f2e6a7ea..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.ncdump deleted file mode 100644 index 16c71d22bf..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested.ncdump +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_struct_nested { -types: - compound s1_t { - int x ; - int y ; - }; // s1_t - compound s2_t { - s1_t field1 ; - s1_t field2 ; - }; // s2_t -variables: - s2_t x ; -data: - - x = {{1, -2}, {255, 90}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.cdl deleted file mode 100644 index e52eba8179..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.cdl +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_struct_nested3 { - types: - compound s1_t { - int field1 ; - }; // s1_t - compound s2_t { - s1_t field2 ; - }; // s2_t - compound s3_t { - s2_t field3 ; - }; // s2_t -variables: - s3_t x; -data: - x = {{{17}}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.hdf5 b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.hdf5 deleted file mode 100644 index 7e0173c94a..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.hdf5 and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.nc deleted file mode 100644 index c8cc68e0d6..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.ncdump deleted file mode 100644 index a3a6cb40e2..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_nested3.ncdump +++ /dev/null @@ -1,17 +0,0 @@ -netcdf test_struct_nested3 { -types: - compound s1_t { - int field1 ; - }; // s1_t - compound s2_t { - s1_t field2 ; - }; // s2_t - compound s3_t { - s2_t field3 ; - }; // s3_t -variables: - s3_t x ; -data: - - x = {{{17}}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.cdl deleted file mode 100644 index 005f897c52..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.cdl +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_struct_type { - types: - compound c_t { - int x ; - int y ; - }; // c_t -variables: - c_t s; -data: - s = {1,-2}; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.nc deleted file mode 100644 index 2a988dc2fe..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.ncdump deleted file mode 100644 index 6fc0c77b50..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_struct_type.ncdump +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_struct_type { -types: - compound c_t { - int x ; - int y ; - }; // c_t -variables: - c_t s ; -data: - - s = {1, -2} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_test.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_test.cdl deleted file mode 100644 index 684d1c5002..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_test.cdl +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_test { - -types: - byte enum enum_t {c1=1, c2=2, c3=3}; - -variables: - enum_t v1; - -data: - v1 = c1; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_test.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_test.nc deleted file mode 100644 index 56638925f8..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_test.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_test.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_test.ncdump deleted file mode 100644 index 936c3cfeef..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_test.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf test_test { -types: - byte enum enum_t {c1 = 1, c2 = 2, c3 = 3} ; -variables: - enum_t v1 ; -data: - - v1 = c1 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.cdl deleted file mode 100644 index e300442837..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.cdl +++ /dev/null @@ -1,27 +0,0 @@ -netcdf test_unlim1 { -dimensions: - lat = 3 ; - lon = 2 ; - time = UNLIMITED ; // (2 currently) -variables: - float lat(lat) ; - lat:units = "degrees_north" ; - float lon(lon) ; - lon:units = "degrees_east" ; - double time(time) ; - time:units = "seconds since 2009-01-01" ; - float pr(time, lat, lon) ; - pr:standard_name = "air_pressure_at_sea_level" ; - pr:units = "hPa" ; - -// global attributes: - :title = "example for workshop" ; -data: - pr = - 0, 1, - 2, 3, - 4, 5, - 10, 11, - 12, 13, - 14, 15 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.ncdump deleted file mode 100644 index da7d31a211..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.ncdump +++ /dev/null @@ -1,34 +0,0 @@ -netcdf test_unlim1 { -dimensions: - lat = 3 ; - lon = 2 ; - time = UNLIMITED ; // (2 currently) -variables: - float lat(lat) ; - lat:units = "degrees_north" ; - float lon(lon) ; - lon:units = "degrees_east" ; - double time(time) ; - time:units = "seconds since 2009-01-01" ; - float pr(time, lat, lon) ; - pr:standard_name = "air_pressure_at_sea_level" ; - pr:units = "hPa" ; - -// global attributes: - :title = "example for workshop" ; -data: - - lat = _, _, _ ; - - lon = _, _ ; - - time = _, _ ; - - pr = - 0, 1, - 2, 3, - 4, 5, - 10, 11, - 12, 13, - 14, 15 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.cdl deleted file mode 100644 index 14025f5a36..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.cdl +++ /dev/null @@ -1,8 +0,0 @@ -netcdf test_utf8 { -dimensions: - d2 = 2; -variables: - string vs(d2); -data: - vs = "Καλημέα" , "abc"; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.ncdump deleted file mode 100644 index d9429c1be3..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf test_utf8 { -dimensions: - d2 = 2 ; -variables: - string vs(d2) ; -data: - - vs = "Καλημέα", "abc" ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.cdl deleted file mode 100644 index 3ec2f06543..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.cdl +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_vlen1 { - -types: - int(*) vlen_t; - -variables: - vlen_t x; - -data: - x = {1, 3, 5, 7}; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.ncdump deleted file mode 100644 index 68140f424e..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.ncdump +++ /dev/null @@ -1,9 +0,0 @@ -netcdf test_vlen1 { -types: - int(*) vlen_t ; -variables: - vlen_t x ; -data: - - x = {1, 3, 5, 7} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.cdl deleted file mode 100644 index ebdf6ce624..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.cdl +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_vlen10 { - -types: - compound c_t {int x; float y;}; - c_t(*) v_t; - -variables: - v_t v; - -data: - - v = {{17,30.7}, {19,101.1}}; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.nc deleted file mode 100644 index eeb02b6351..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.ncdump deleted file mode 100644 index 432a625790..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen10.ncdump +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_vlen10 { -types: - compound c_t { - int x ; - float y ; - }; // c_t - c_t(*) v_t ; -variables: - v_t v ; -data: - - v = {{17, 30.7}, {19, 101.1}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.cdl deleted file mode 100644 index 98c0575603..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.cdl +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_vlen11 { - -types: - int(*) v1_t; - v1_t(*) v2_t; - -variables: - v2_t v; - -data: - v = {{1, 3, 5, 7},{100,200}} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.ncdump deleted file mode 100644 index 806ec725c1..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.ncdump +++ /dev/null @@ -1,10 +0,0 @@ -netcdf test_vlen11 { -types: - int(*) v1_t ; - v1_t(*) v2_t ; -variables: - v2_t v ; -data: - - v = {{1, 3, 5, 7}, {100, 200}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.cdl deleted file mode 100644 index 8e3a578c18..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.cdl +++ /dev/null @@ -1,15 +0,0 @@ -netcdf test_vlen2 { - -types: - int(*) vlen_t; - -dimensions: - d3=3; - d2=2; - -variables: - vlen_t x(d3,d2); - -data: - x = {1, 3, 5, 7}, {100,200}, {-1,-2},{1, 3, 5, 7}, {100,200}, {-1,-2}; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.nc deleted file mode 100644 index dd2d4a2f1e..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.ncdump deleted file mode 100644 index 0398d71252..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen2.ncdump +++ /dev/null @@ -1,15 +0,0 @@ -netcdf test_vlen2 { -types: - int(*) vlen_t ; -dimensions: - d3 = 3 ; - d2 = 2 ; -variables: - vlen_t x(d3, d2) ; -data: - - x = - {1, 3, 5, 7}, {100, 200}, - {-1, -2}, {1, 3, 5, 7}, - {100, 200}, {-1, -2} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.cdl deleted file mode 100644 index a4365fe4b9..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.cdl +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_vlen3 { - -types: - int(*) v_t; - compound c_t {v_t f1;}; - -variables: - c_t v1; - -data: - v1 = {{1, 3, 5, 7}} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.ncdump deleted file mode 100644 index 84e768b57f..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.ncdump +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_vlen3 { -types: - int(*) v_t ; - compound c_t { - v_t f1 ; - }; // c_t -variables: - c_t v1 ; -data: - - v1 = {{1, 3, 5, 7}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.cdl deleted file mode 100644 index b6db7ff2e7..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.cdl +++ /dev/null @@ -1,13 +0,0 @@ -netcdf test_vlen4 { - -types: - int(*) v_t; - compound c_t {v_t f1(2);}; - -variables: - c_t v1; - -data: - v1 = {{{1, 3, 5, 7},{100,200}}} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.ncdump deleted file mode 100644 index 3f3e8ac2c4..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.ncdump +++ /dev/null @@ -1,12 +0,0 @@ -netcdf test_vlen4 { -types: - int(*) v_t ; - compound c_t { - v_t f1(2) ; - }; // c_t -variables: - c_t v1 ; -data: - - v1 = {{{1, 3, 5, 7}, {100, 200}}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.cdl deleted file mode 100644 index 11d8efa54a..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.cdl +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_vlen5 { - -types: - int(*) v_t; - compound c_t {v_t v;}; - -dimensions: - d2=2; - -variables: - c_t v1(d2); - -data: - v1 = {{1, 3, 5, 7}},{{100,200}} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.ncdump deleted file mode 100644 index aaf9eec519..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.ncdump +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_vlen5 { -types: - int(*) v_t ; - compound c_t { - v_t v ; - }; // c_t -dimensions: - d2 = 2 ; -variables: - c_t v1(d2) ; -data: - - v1 = {{1, 3, 5, 7}}, {{100, 200}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.cdl deleted file mode 100644 index b116583de5..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.cdl +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_vlen6 { - -types: - int(*) v_t; - -dimensions: - d=2; - -variables: - v_t v1(d); - -data: - - v1 = {1,3,5,7}, {17,19} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.ncdump deleted file mode 100644 index bbe124ecaf..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.ncdump +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_vlen6 { -types: - int(*) v_t ; -dimensions: - d = 2 ; -variables: - v_t v1(d) ; -data: - - v1 = {1, 3, 5, 7}, {17, 19} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.cdl deleted file mode 100644 index 3711750729..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.cdl +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_vlen7 { - -types: - int(*) v_t; - -dimensions: - d=1; - -variables: - v_t v1(d); - -data: - - v1 = {17,19,21} ; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.ncdump deleted file mode 100644 index 8826f39f77..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.ncdump +++ /dev/null @@ -1,11 +0,0 @@ -netcdf test_vlen7 { -types: - int(*) v_t ; -dimensions: - d = 1 ; -variables: - v_t v1(d) ; -data: - - v1 = {17, 19, 21} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.cdl deleted file mode 100644 index f7522a93dd..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.cdl +++ /dev/null @@ -1,19 +0,0 @@ -netcdf test_vlen8 { - -types: - int(*) v_t; - -dimensions: - d1=2; - d2=2; - -variables: - v_t v1(d1,d2); - -data: - - v1 = - {1,3,5,7}, {17,19}, - {11,33,55,77}, {717,919}; -} - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.nc deleted file mode 100644 index 9546ef1c64..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.ncdump deleted file mode 100644 index c498cb64f5..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen8.ncdump +++ /dev/null @@ -1,14 +0,0 @@ -netcdf test_vlen8 { -types: - int(*) v_t ; -dimensions: - d1 = 2 ; - d2 = 2 ; -variables: - v_t v1(d1, d2) ; -data: - - v1 = - {1, 3, 5, 7}, {17, 19}, - {11, 33, 55, 77}, {717, 919} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.cdl deleted file mode 100644 index 4244c2425c..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.cdl +++ /dev/null @@ -1,16 +0,0 @@ -netcdf test_vlen9 { - -types: - compound c_t {int x; float y;}; - c_t(*) v_t; - -dimensions: - d=2; - -variables: - v_t v(d); - -data: - - v = {{17,30.7}}, {{19,101.1},{2,1.0}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.nc deleted file mode 100644 index 572ed1deaa..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.ncdump deleted file mode 100644 index 506c9ab6aa..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen9.ncdump +++ /dev/null @@ -1,15 +0,0 @@ -netcdf test_vlen9 { -types: - compound c_t { - int x ; - float y ; - }; // c_t - c_t(*) v_t ; -dimensions: - d = 2 ; -variables: - v_t v(d) ; -data: - - v = {{17, 30.7}}, {{19, 101.1}, {2, 1}} ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.cdl b/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.cdl deleted file mode 100644 index 6afadd0a51..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.cdl +++ /dev/null @@ -1,23 +0,0 @@ -netcdf test_zerodim { -dimensions: - lat = 6 ; - lon = 4 ; - time = UNLIMITED ; // (0 currently) - unlim = UNLIMITED ; // (3 currently) -variables: - float lat(lat) ; - lat:units = "degrees_north" ; - float lon(lon) ; - lon:units = "degrees_east" ; - double time(time) ; - time:units = "seconds since 2009-01-01" ; - float pr(time, lat, lon) ; - pr:standard_name = "air_pressure_at_sea_level" ; - pr:units = "hPa" ; - float var(unlim) ; - -// global attributes: - :title = "example for workshop" ; -data: - var = 0, 1, 3 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.nc b/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.nc deleted file mode 100644 index 85ecf70d96..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.ncdump b/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.ncdump deleted file mode 100644 index e13baa0d39..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/test_zerodim.ncdump +++ /dev/null @@ -1,28 +0,0 @@ -netcdf test_zerodim { -dimensions: - lat = 6 ; - lon = 4 ; - time = UNLIMITED ; // (0 currently) - unlim = UNLIMITED ; // (3 currently) -variables: - float lat(lat) ; - lat:units = "degrees_north" ; - float lon(lon) ; - lon:units = "degrees_east" ; - double time(time) ; - time:units = "seconds since 2009-01-01" ; - float pr(time, lat, lon) ; - pr:standard_name = "air_pressure_at_sea_level" ; - pr:units = "hPa" ; - float var(unlim) ; - -// global attributes: - :title = "example for workshop" ; -data: - - lat = _, _, _, _, _, _ ; - - lon = _, _, _, _ ; - - var = 0, 1, 3 ; -} diff --git a/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.c b/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.c deleted file mode 100644 index dd7844a837..0000000000 --- a/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.c +++ /dev/null @@ -1,51 +0,0 @@ -/* This is part of the netCDF package. Copyright 2008 University - Corporation for Atmospheric Research/Unidata See COPYRIGHT file for - conditions of use. See www.unidata.ucar.edu for more info. - - Create a test file with default fill values for variables of each type. - - $Id: tst_fills.c,v 1.12 2009/03/17 01:22:42 ed Exp $ -*/ - -#include -#include -#include - -#define FILE_NAME "tst_fills.nc" -#define VAR1 "uv8" -# define TYPE1 NC_UBYTE -# define DATA1 240 -#define VAR2 "v16" -# define TYPE2 NC_SHORT -# define DATA2 32700 -#define VAR3 "uv32" -# define TYPE3 NC_INT -# define FILL3 17 -# define DATA3 111000 - -#define ERR abort() - - -int -main(int argc, char **argv) -{ - int ncid; - int varid1, varid2, varid3; - int fill3 = FILL3; - - printf("\n*** Testing fill values.\n"); - - if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; - if (nc_def_var(ncid, VAR1, TYPE1, 0, NULL, &varid1)) ERR; - if (nc_def_var(ncid, VAR2, TYPE2, 0, NULL, &varid2)) ERR; - if (nc_def_var(ncid, VAR3, TYPE3, 0, NULL, &varid3)) ERR; - if (nc_def_var_fill(ncid, varid3, 0, &fill3)) ERR; - - if (nc_enddef(ncid)) ERR; - - {unsigned char data = DATA1; if (nc_put_var(ncid,varid1,&data)) ERR;} - {short data = DATA2; if (nc_put_var(ncid,varid2,&data)) ERR;} - {unsigned int data = DATA3; if (nc_put_var(ncid,varid3,&data)) ERR;} -} - - diff --git a/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.nc b/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.nc deleted file mode 100644 index f45e6600f6..0000000000 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/tst_fills.nc and /dev/null differ diff --git a/dap4/d4tests/src/test/java/dap4/test/DapTestCommon.java b/dap4/d4tests/src/test/java/dap4/test/DapTestCommon.java deleted file mode 100644 index dfe822162b..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/DapTestCommon.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.test; - -import dap4.core.util.DapException; -import dap4.core.util.DapUtil; -import ucar.nc2.NetcdfFile; -import ucar.nc2.jni.netcdf.Nc4prototypes; -import ucar.unidata.util.test.TestDir; -import ucar.unidata.util.test.UnitTestCommon; -import java.io.File; -import java.io.FileFilter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -abstract public class DapTestCommon extends UnitTestCommon { - - ////////////////////////////////////////////////// - // Constants - - static final String DEFAULTTREEROOT = "dap4"; - - static public final String FILESERVER = "file://localhost:8080"; - - static public final String CONSTRAINTTAG = "dap4.ce"; - static public final String ORDERTAG = "ucar.littleendian"; - static public final String NOCSUMTAG = "ucar.nochecksum"; - static public final String TRANSLATETAG = "ucar.translate"; - static public final String TESTTAG = "ucar.testing"; - - static final String D4TESTDIRNAME = "d4tests"; - - // Equivalent to the path to the webapp/d4ts for testing purposes - static protected final String DFALTRESOURCEPATH = "/src/test/data/resources"; - static protected Class NC4IOSP = ucar.nc2.jni.netcdf.Nc4Iosp.class; - - static class TestFilter implements FileFilter { - boolean debug; - boolean strip; - String[] extensions; - - public TestFilter(boolean debug, String[] extensions) { - this.debug = debug; - this.strip = strip; - this.extensions = extensions; - } - - public boolean accept(File file) { - boolean ok = false; - if (file.isFile() && file.canRead()) { - // Check for proper extension - String name = file.getName(); - if (name != null) { - for (String ext : extensions) { - if (name.endsWith(ext)) - ok = true; - } - } - if (!ok && debug) - System.err.println("Ignoring: " + file.toString()); - } - return ok; - } - - static void filterfiles(String path, List matches, String... extensions) { - File testdirf = new File(path); - assert (testdirf.canRead()); - TestFilter tf = new TestFilter(DEBUG, extensions); - File[] filelist = testdirf.listFiles(tf); - for (int i = 0; i < filelist.length; i++) { - File file = filelist[i]; - if (file.isDirectory()) - continue; - String fname = DapUtil.canonicalpath(file.getAbsolutePath()); - matches.add(fname); - } - } - } - - ////////////////////////////////////////////////// - // Static variables - - static protected String dap4root = null; - static protected String dap4testroot = null; - static protected String dap4resourcedir = null; - - static { - dap4root = locateDAP4Root(threddsroot); - if (dap4root == null) - System.err.println("Cannot locate /dap4 parent dir"); - dap4testroot = canonjoin(dap4root, D4TESTDIRNAME); - dap4resourcedir = canonjoin(dap4testroot, DFALTRESOURCEPATH); - } - - ////////////////////////////////////////////////// - // Static methods - - - static protected String getD4TestsRoot() { - return dap4testroot; - } - - static protected String getResourceRoot() { - return dap4resourcedir; - } - - static String locateDAP4Root(String threddsroot) { - String root = threddsroot; - if (root != null) - root = root + "/" + DEFAULTTREEROOT; - // See if it exists - File f = new File(root); - if (!f.exists() || !f.isDirectory()) - root = null; - return root; - } - - ////////////////////////////////////////////////// - // Instance variables - - - protected String d4tsserver = null; - - protected String title = "Dap4 Testing"; - - public DapTestCommon() { - this("DapTest"); - } - - public DapTestCommon(String name) { - super(name); - - this.d4tsserver = TestDir.dap4TestServer; - if (DEBUG) - System.err.println("DapTestCommon: d4tsServer=" + d4tsserver); - } - - /** - * Try to get the system properties - */ - protected void setSystemProperties() { - String testargs = System.getProperty("testargs"); - if (testargs != null && testargs.length() > 0) { - String[] pairs = testargs.split("[ ]*[,][ ]*"); - for (String pair : pairs) { - String[] tuple = pair.split("[ ]*[=][ ]*"); - String value = (tuple.length == 1 ? "" : tuple[1]); - if (tuple[0].length() > 0) - System.setProperty(tuple[0], value); - } - } - if (System.getProperty("nodiff") != null) - prop_diff = false; - if (System.getProperty("baseline") != null) - prop_baseline = true; - if (System.getProperty("nogenerate") != null) - prop_generate = false; - if (System.getProperty("debug") != null) - prop_debug = true; - if (System.getProperty("visual") != null) - prop_visual = true; - if (System.getProperty("ascii") != null) - prop_ascii = true; - if (System.getProperty("utf8") != null) - prop_ascii = false; - if (prop_baseline && prop_diff) - prop_diff = false; - prop_controls = System.getProperty("controls", ""); - } - - ////////////////////////////////////////////////// - // Overrideable methods - - ////////////////////////////////////////////////// - // Accessor - - public void setTitle(String title) { - this.title = title; - } - - public String getTitle() { - return this.title; - } - - ////////////////////////////////////////////////// - // Instance Utilities - - public void visual(String header, String captured) { - if (!captured.endsWith("\n")) - captured = captured + "\n"; - // Dump the output for visual comparison - System.err.println("\n" + header + ":"); - System.err.println("---------------"); - System.err.print(captured); - System.err.println("---------------"); - System.err.flush(); - } - - protected void findServer(String path) throws DapException { - String svc = "http://" + this.d4tsserver + "/d4ts"; - if (!checkServer(svc)) - System.err.println("D4TS Server not reachable: " + svc); - // Since we will be accessing it thru NetcdfDataset, we need to change the schema. - d4tsserver = "dap4://" + d4tsserver + "/d4ts"; - } - - ////////////////////////////////////////////////// - - public String getDAP4Root() { - return this.dap4root; - } - - @Override - public String getResourceDir() { - return this.dap4resourcedir; - } - - static protected void testSetup() { - try { - // Always prefer Nc4Iosp over HDF5 - NetcdfFile.iospDeRegister(NC4IOSP); - NetcdfFile.registerIOProviderPreferred(NC4IOSP, ucar.nc2.iosp.hdf5.H5iosp.class); - // Print out the library version - System.err.printf("Netcdf-c library version: %s%n", getCLibraryVersion()); - System.err.flush(); - } catch (Exception e) { - System.err.println("Cannot load ucar.nc2.jni.netcdf.Nc4Iosp"); - } - } - - static void printDir(String path) { - File testdirf = new File(path); - assert (testdirf.canRead()); - File[] filelist = testdirf.listFiles(); - System.err.println("\n*******************"); - System.err.printf("Contents of %s:%n", path); - for (int i = 0; i < filelist.length; i++) { - File file = filelist[i]; - String fname = file.getName(); - System.err.printf("\t%s%s%n", fname, (file.isDirectory() ? "/" : "")); - } - System.err.println("*******************"); - System.err.flush(); - } - - static public String getCLibraryVersion() { - Nc4prototypes nc4 = getCLibrary(); - return (nc4 == null ? "Unknown" : nc4.nc_inq_libvers()); - } - - static public Nc4prototypes getCLibrary() { - try { - Method getclib = NC4IOSP.getMethod("getCLibrary"); - return (Nc4prototypes) getclib.invoke(null); - } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return null; - } - } -} - diff --git a/dap4/d4tests/src/test/java/dap4/test/Diff.j b/dap4/d4tests/src/test/java/dap4/test/Diff.j deleted file mode 100644 index 4c516837a1..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/Diff.j +++ /dev/null @@ -1,794 +0,0 @@ -// Diff -- text file difference utility. -// See full docu-comment at beginning of Diff class. - -/* Copyright (c) Ian F. Darwin, http://www.darwinsys.com/, 1996-2002. - * All rights reserved. Software written by Ian F. Darwin and others. - * $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * Java, the Duke mascot, and all variants of Sun's Java 'steaming coffee cup' - logo are trademarks of Sun Microsystems. Sun's, and James Gosling's, - * pioneering role in inventing and promulgating (and standardizing) the Java - * language and environment is gratefully acknowledged. - * - * The pioneering role of Dennis Ritchie and Bjarne Stroustrup, of AT&T, for - * inventing predecessor languages C and C+is also gratefully acknowledged. - */ - -package dap4.test; - -import java.io.*; - - -/** - * This is the info kept per-file. - */ -class fileInfo { - - static final int MAXLINECOUNT = 20000; - - BufferedReader file; /* File handle that is open for read. */ - public int maxLine; /* After input done, # lines in file. */ - node symbol[]; /* The symtab handle of each line. */ - int other[]; /* Map of line# to line# in other file */ - /* ( -1 means don't-know ). */ - /* Allocated AFTER the lines are read. */ - - /** - * Normal constructor with one filename; file is opened and saved. - */ - public fileInfo(String filename) throws Exception { - symbol = new node[MAXLINECOUNT + 2]; - other = null; // allocated later! - file = new BufferedReader(new FileReader(filename)); - } - - public fileInfo(Reader rdr) throws Exception { - symbol = new node[MAXLINECOUNT + 2]; - other = null; // allocated later! - file = new BufferedReader(rdr); - } - - // This is done late, to be same size as # lines in input file. - - void alloc() { - other = new int[symbol.length + 2]; - } -}; - -/** - * diff Text file difference utility. - * ---- Copyright 1987, 1989 by Donald C. Lindsay, - * School of Computer Science, Carnegie Mellon University. - * Copyright 1982 by Symbionics. - * Use without fee is permitted when not for direct commercial - * advantage, and when credit to the source is given. Other uses - * require specific permission. - *

- * Converted from C to Java by Ian F. Darwin, http://www.darwinsys.com/, January, 1997. - * Copyright 1997, Ian F. Darwin. - *

- * Conversion is NOT FULLY TESTED. - *

- * USAGE: diff oldfile newfile - *

- * This program assumes that "oldfile" and "newfile" are text files. - * The program writes to stdout a description of the changes which would - * transform "oldfile" into "newfile". - *

- * The printout is in the form of commands, each followed by a block of - * text. The text is delimited by the commands, which are: - *

- * DELETE AT n - * ..deleted lines - *

- * INSERT BEFORE n - * ..inserted lines - *

- * n MOVED TO BEFORE n - * ..moved lines - *

- * n CHANGED FROM - * ..old lines - * CHANGED TO - * ..newer lines - *

- * The line numbers all refer to the lines of the oldfile, as they are - * numbered before any commands are applied. - * The text lines are printed as-is, without indentation or prefixing. The - * commands are printed in upper case, with a prefix of ">>>>", so that - * they will stand out. Other schemes may be preferred. - * Files which contain more than MAXLINECOUNT lines cannot be processed. - * This can be fixed by changing "symbol" to a Vector. - * The algorithm is taken from Communications of the ACM, Apr78 (21, 4, 264-), - * "A Technique for Isolating Differences Between Files." - * Ignoring I/O, and ignoring the symbol table, it should take O(N) time. - * This implementation takes fixed space, plus O(U) space for the symbol - * table (where U is the number of unique lines). Methods exist to change - * the fixed space to O(N) space. - * Note that this is not the only interesting file-difference algorithm. In - * general, different algorithms draw different conclusions about the - * changes that have been made to the oldfile. This algorithm is sometimes - * "more right", particularly since it does not consider a block move to be - * an insertion and a (separate) deletion. However, on some files it will be - * "less right". This is a consequence of the fact that files may contain - * many identical lines (particularly if they are program source). Each - * algorithm resolves the ambiguity in its own way, and the resolution - * is never guaranteed to be "right". However, it is often excellent. - * This program is intended to be pedagogic. Specifically, this program was - * the basis of the Literate Programming column which appeared in the - * Communications of the ACM (CACM), in the June 1989 issue (32, 6, - * 740-755). - * By "pedagogic", I do not mean that the program is gracefully worded, or - * that it showcases language features or its algorithm. I also do not mean - * that it is highly accessible to beginners, or that it is intended to be - * read in full, or in a particular order. Rather, this program is an - * example of one professional's style of keeping things organized and - * maintainable. - * The program would be better if the "print" variables were wrapped into - * a struct. In general, grouping related variables in this way improves - * documentation, and adds the ability to pass the group in argument lists. - * This program is a de-engineered version of a program which uses less - * memory and less time. The article points out that the "symbol" arrays - * can be implemented as arrays of pointers to arrays, with dynamic - * allocation of the subarrays. (In C, macros are very useful for hiding - * the two-level accesses.) In Java, a Vector would be used. This allows an - * extremely large value for MAXLINECOUNT, without dedicating fixed arrays. - * (The "other" array can be allocated after the input phase, when the exact - * sizes are known.) The only slow piece of code is the "strcmp" in the tree - * descent: it can be speeded up by keeping a hash in the tree node, and - * only using "strcmp" when two hashes happen to be equal. - *

- * Change Log - * ---------- - * 1Jan97 Ian F. Darwin: first working rewrite in Java, based entirely on - * D.C.Lindsay's reasonable C version. - * Changed comments from /***************** to /**, shortened, added - * whitespace, used tabs more, etc. - * 6jul89 D.C.Lindsay, CMU: fixed portability bug. Thanks, Gregg Wonderly. - * Just changed "char ch" to "int ch". - * Also added comment about way to improve code. - * 10jun89 D.C.Lindsay, CMU: posted version created. - * Copyright notice changed to ACM style, and Dept. is now School. - * ACM article referenced in docn. - * 26sep87 D.C.Lindsay, CMU: publication version created. - * Condensed all 1982/83 change log entries. - * Removed all command line options, and supporting code. This - * simplified the input code (no case reduction etc). It also - * simplified the symbol table, which was capable of remembering - * offsets into files (instead of strings), and trusting (!) hash - * values to be unique. - * Removed dynamic allocation of arrays: now fixed static arrays. - * Removed speed optimizations in symtab package. - * Removed string compression/decompression code. - * Recoded to Unix standards from old Lattice/MSDOS standards. - * (This affected only the #include's and the IO.) - * Some renaming of variables, and rewording of comments. - * 1982/83 D.C.Lindsay, Symbionics: created. - * - * @author Ian F. Darwin, Java version - * @author D. C. Lindsay, C version (1982-1987) - * @version Java version 0.9, 1997 - */ - -public class Diff { - - /** - * block len > any possible real block len - */ - final int UNREAL = Integer.MAX_VALUE; - - /** - * Keeps track of information about file1 and file2 - */ - fileInfo oldinfo, newinfo; - - PrintWriter printer = null; - - String identifier = ""; - - - /** - * blocklen is the info about found blocks. It will be set to 0, except - * at the line#s where blocks start in the old file. At these places it - * will be set to the # of lines in the block. During printout , - * this # will be reset to -1 if the block is printed as a MOVE block - * (because the printout phase will encounter the block twice, but - * must only print it once.) - * The array declarations are to MAXLINECOUNT+2 so that we can have two - * extra lines (pseudolines) at line# 0 and line# MAXLINECOUNT+1 - * (or less). - */ - int blocklen[]; - - /** - * main - entry point when used standalone. - * NOTE: no routines return error codes or throw any local - * exceptions. Instead, any routine may complain - * to stderr and then exit with error to the system. - */ - public static void main(String argstrings[]) throws Exception { - if (argstrings.length != 2) { - System.err.println("Usage: diff oldfile newfile"); - System.exit(1); - } - Diff d = new Diff("Diff"); - d.doDiff(argstrings[0], argstrings[1]); - return; - } - - /** - * Construct a Diff object. - */ - public Diff(String id) { - identifier = id; - } - - - /* Do comparison against two Reader streams */ - - public boolean doDiff(Reader oldFile, Reader newFile, Writer out) throws Exception { - this.printer = new PrintWriter(out); - oldinfo = new fileInfo(oldFile); - newinfo = new fileInfo(newFile); - return process(); - } - - public boolean doDiff(Reader oldFile, Reader newFile) throws Exception { - Writer w = new OutputStreamWriter(System.out); - return doDiff(oldFile, newFile, w); - } - - /* Do comparison against two string streams */ - - public boolean doDiff(String data1, String data2, Writer out) throws Exception { - if(data1 == null || data2 == null) return false; - return doDiff(new StringReader(data1), new StringReader(data2), out); - } - - public boolean doDiff(String data1, String data2) throws Exception { - return doDiff(data1, data2, new OutputStreamWriter(System.out)); - } - - boolean process() throws Exception { - /* we don't process until we know both files really do exist. */ - inputscan(oldinfo); - inputscan(newinfo); - - /* Now that we've read all the lines, allocate some arrays. - */ - blocklen = new int[(oldinfo.maxLine > newinfo.maxLine ? - oldinfo.maxLine : newinfo.maxLine) + 2]; - oldinfo.alloc(); - newinfo.alloc(); - - /* Now do the work, and print the results. */ - transform(); - return printout(); - } - - static boolean isBlankLine(String s) - { - int index = 0; - int len = s.length(); - for(index=len-1;index>=0;index--) { - if(" \t\r".indexOf(s.charAt(index)) < 0) return false; - } - return true; - } - - /** - * inputscan Reads the file specified by pinfo.file. - * --------- Places the lines of that file in the symbol table. - * Sets pinfo.maxLine to the number of lines found. - */ - void inputscan(fileInfo pinfo) throws IOException { - String linebuffer; - pinfo.maxLine = 0; - while ((linebuffer = pinfo.file.readLine()) != null) { - if(!isBlankLine(linebuffer)) - storeline(linebuffer, pinfo); - } - } - - /** - * storeline Places line into symbol table. - * --------- Expects pinfo.maxLine initted: increments. - * Places symbol table handle in pinfo.ymbol. - * Expects pinfo is either oldinfo or newinfo. - */ - void storeline(String linebuffer, fileInfo pinfo) { - int linenum = ++pinfo.maxLine; /* note, no line zero */ - if (linenum > fileInfo.MAXLINECOUNT) { - System.err.println("MAXLINECOUNT exceeded, must stop."); - System.exit(1); - } - pinfo.symbol[linenum] = node.addSymbol(this, linebuffer, pinfo == oldinfo, linenum); - } - - /* - * transform - * Analyzes the file differences and leaves its findings in - * the global arrays oldinfo.other, newinfo.other, and blocklen. - * Expects both files in symtab. - * Expects valid "maxLine" and "symbol" in oldinfo and newinfo. - */ - - void transform() { - int oldline, newline; - int oldmax = oldinfo.maxLine + 2; /* Count pseudolines at */ - int newmax = newinfo.maxLine + 2; /* ..front and rear of file */ - - for (oldline = 0; oldline < oldmax; oldline++) - oldinfo.other[oldline] = -1; - for (newline = 0; newline < newmax; newline++) - newinfo.other[newline] = -1; - - scanunique(); /* scan for lines used once in both files */ - scanafter(); /* scan past sure-matches for non-unique blocks */ - scanbefore(); /* scan backwards from sure-matches */ - scanblocks(); /* find the fronts and lengths of blocks */ - } - - /* - * scanunique - * Scans for lines which are used exactly once in each file. - * Expects both files in symtab, and oldinfo and newinfo valid. - * The appropriate "other" array entries are set to the line# in - * the other file. - * Claims pseudo-lines at 0 and XXXinfo.maxLine+1 are unique. - */ - - void scanunique() { - int oldline, newline; - node psymbol; - - for (newline = 1; newline <= newinfo.maxLine; newline++) { - psymbol = newinfo.symbol[newline]; - if (psymbol.symbolIsUnique()) { // 1 use in each file - oldline = psymbol.linenum; - newinfo.other[newline] = oldline; // record 1-1 map - oldinfo.other[oldline] = newline; - } - } - newinfo.other[0] = 0; - oldinfo.other[0] = 0; - newinfo.other[newinfo.maxLine + 1] = oldinfo.maxLine + 1; - oldinfo.other[oldinfo.maxLine + 1] = newinfo.maxLine + 1; - } - - /* - * scanafter - * Expects both files in symtab, and oldinfo and newinfo valid. - * Expects the "other" arrays contain positive #s to indicate - * lines that are unique in both files. - * For each such pair of places, scans past in each file. - * Contiguous groups of lines that match non-uniquely are - * taken to be good-enough matches, and so marked in "other". - * Assumes each other[0] is 0. - */ - - void scanafter() { - int oldline, newline; - - for (newline = 0; newline <= newinfo.maxLine; newline++) { - oldline = newinfo.other[newline]; - if (oldline >= 0) { /* is unique in old & new */ - for (; ;) { /* scan after there in both files */ - if (++oldline > oldinfo.maxLine) break; - if (oldinfo.other[oldline] >= 0) break; - if (++newline > newinfo.maxLine) break; - if (newinfo.other[newline] >= 0) break; - - /* oldline & newline exist, and - aren't already matched */ - - if (newinfo.symbol[newline] != - oldinfo.symbol[oldline]) break; // not same - - newinfo.other[newline] = oldline; // record a match - oldinfo.other[oldline] = newline; - } - } - } - } - - /** - * scanbefore - * As scanafter, except scans towards file fronts. - * Assumes the off-end lines have been marked as a match. - */ - void scanbefore() { - int oldline, newline; - - for (newline = newinfo.maxLine + 1; newline > 0; newline--) { - oldline = newinfo.other[newline]; - if (oldline >= 0) { /* unique in each */ - for (; ;) { - if (--oldline <= 0) break; - if (oldinfo.other[oldline] >= 0) break; - if (--newline <= 0) break; - if (newinfo.other[newline] >= 0) break; - - /* oldline and newline exist, - and aren't marked yet */ - - if (newinfo.symbol[newline] != - oldinfo.symbol[oldline]) break; // not same - - newinfo.other[newline] = oldline; // record a match - oldinfo.other[oldline] = newline; - } - } - } - } - - /** - * scanblocks - Finds the beginnings and lengths of blocks of matches. - * Sets the blocklen array (see definition). - * Expects oldinfo valid. - */ - void scanblocks() { - int oldline, newline; - int oldfront = 0; // line# of front of a block in old, or 0 - int newlast = -1; // newline's value during prev. iteration - - for (oldline = 1; oldline <= oldinfo.maxLine; oldline++) - blocklen[oldline] = 0; - blocklen[oldinfo.maxLine + 1] = UNREAL; // starts a mythical blk - - for (oldline = 1; oldline <= oldinfo.maxLine; oldline++) { - newline = oldinfo.other[oldline]; - if (newline < 0) oldfront = 0; /* no match: not in block */ - else { /* match. */ - if (oldfront == 0) oldfront = oldline; - if (newline != (newlast + 1)) oldfront = oldline; - ++blocklen[oldfront]; - } - newlast = newline; - } - } - - /* The following are global to printout's subsidiary routines */ - // enum{ idle, delete, insert, movenew, moveold, - // same, change } printstatus; - public static final int - idle = 0, delete = 1, insert = 2, movenew = 3, moveold = 4, - same = 5, change = 6; - int printstatus; - boolean anyprinted; - int printoldline, printnewline; // line numbers in old & new file - - /** - * printout - Prints summary to stdout. - * Expects all databuffer structures have been filled out. - * - * @return true if differences detected - */ - boolean printout() { - printstatus = idle; - anyprinted = false; - for (printoldline = printnewline = 1; ;) { - if (printoldline > oldinfo.maxLine) { - newconsume(); - break; - } - if (printnewline > newinfo.maxLine) { - oldconsume(); - break; - } - if (newinfo.other[printnewline] < 0) { - if (oldinfo.other[printoldline] < 0) - showchange(); - else - showinsert(); - } else if (oldinfo.other[printoldline] < 0) - showdelete(); - else if (blocklen[printoldline] < 0) - skipold(); - else if (oldinfo.other[printoldline] == printnewline) - showsame(); - else - showmove(); - } - if (anyprinted == true) println(">>>> "+identifier+": End of differences."); - else println(">>>> "+identifier+": Files are identical."); - return anyprinted; - } - - /* - * newconsume Part of printout. Have run out of old file. - * Print the rest of the new file, as inserts and/or moves. - */ - - void newconsume() { - for (; ;) { - if (printnewline > newinfo.maxLine) - break; /* end of file */ - if (newinfo.other[printnewline] < 0) showinsert(); - else showmove(); - } - } - - /** - * oldconsume Part of printout. Have run out of new file. - * Process the rest of the old file, printing any - * parts which were deletes or moves. - */ - void oldconsume() { - for (; ;) { - if (printoldline > oldinfo.maxLine) - break; /* end of file */ - printnewline = oldinfo.other[printoldline]; - if (printnewline < 0) showdelete(); - else if (blocklen[printoldline] < 0) skipold(); - else showmove(); - } - } - - /** - * showdelete Part of printout. - * Expects printoldline is at a deletion. - */ - void showdelete() { - if (printstatus != delete) - println(">>>> DELETE AT " + printoldline); - printstatus = delete; - oldinfo.symbol[printoldline].showSymbol(); - anyprinted = true; - printoldline++; - } - - /* - * showinsert Part of printout. - * Expects printnewline is at an insertion. - */ - - void showinsert() { - if (printstatus == change) println(">>>> CHANGED TO"); - else if (printstatus != insert) - println(">>>> INSERT BEFORE " + printoldline); - printstatus = insert; - newinfo.symbol[printnewline].showSymbol(); - anyprinted = true; - printnewline++; - } - - /** - * showchange Part of printout. - * Expects printnewline is an insertion. - * Expects printoldline is a deletion. - */ - void showchange() { - if (printstatus != change) - println(">>>> " + printoldline + " CHANGED FROM"); - printstatus = change; - oldinfo.symbol[printoldline].showSymbol(); - anyprinted = true; - printoldline++; - } - - /** - * skipold Part of printout. - * Expects printoldline at start of an old block that has - * already been announced as a move. - * Skips over the old block. - */ - void skipold() { - printstatus = idle; - for (; ;) { - if (++printoldline > oldinfo.maxLine) - break; /* end of file */ - if (oldinfo.other[printoldline] < 0) - break; /* end of block */ - if (blocklen[printoldline] != 0) - break; /* start of another */ - } - } - - /** - * skipnew Part of printout. - * Expects printnewline is at start of a new block that has - * already been announced as a move. - * Skips over the new block. - */ - void skipnew() { - int oldline; - printstatus = idle; - for (; ;) { - if (++printnewline > newinfo.maxLine) - break; /* end of file */ - oldline = newinfo.other[printnewline]; - if (oldline < 0) - break; /* end of block */ - if (blocklen[oldline] != 0) - break; /* start of another */ - } - } - - /** - * showsame Part of printout. - * Expects printnewline and printoldline at start of - * two blocks that aren't to be displayed. - */ - void showsame() { - int count; - printstatus = idle; - if (newinfo.other[printnewline] != printoldline) { - System.err.println("BUG IN LINE REFERENCING"); - System.exit(1); - } - count = blocklen[printoldline]; - printoldline += count; - printnewline += count; - } - - /** - * showmove Part of printout. - * Expects printoldline, printnewline at start of - * two different blocks ( a move was done). - */ - void showmove() { - int oldblock = blocklen[printoldline]; - int newother = newinfo.other[printnewline]; - int newblock = blocklen[newother]; - - if (newblock < 0) skipnew(); // already printed. - else if (oldblock >= newblock) { // assume new's blk moved. - blocklen[newother] = -1; // stamp block as "printed". - println(">>>> " + newother + - " THRU " + (newother + newblock - 1) + - " MOVED TO BEFORE " + printoldline); - for (; newblock > 0; newblock--, printnewline++) - newinfo.symbol[printnewline].showSymbol(); - anyprinted = true; - printstatus = idle; - - } else /* assume old's block moved */ - skipold(); /* target line# not known, display later */ - } - - /** - * Convenience wrapper for println - */ - public void println(String s) { - printer.println(s); - printer.flush(); - } - -}; // end of main class! - -/** - * Class "node". The symbol table routines in this class all - * understand the symbol table format, which is a binary tree. - * The methods are: addSymbol, symbolIsUnique, showSymbol. - */ -class node { /* the tree is made up of these nodes */ - - static Diff diff = null; - static node panchor = null; /* symtab is a tree hung from this */ - static final int freshnode = 0, - oldonce = 1, newonce = 2, bothonce = 3, other = 4; - - node pleft, pright; - int linenum; - int /* enum linestates */ linestate; - String line; - - /** - * Construct a new symbol table node and fill in its fields. - * - * @param pline string A line of the text file - */ - public node(String pline) { - pleft = pright = null; - linestate = freshnode; - /* linenum field is not always valid */ - line = pline; - } - - /** - * matchsymbol Searches tree for a match to the line. - * - * @param pline String pline, a line of text - * If node's linestate == freshnode, then created the node. - */ - static node matchsymbol(String pline) { - int comparison; - node pnode = panchor; - if (panchor == null) return panchor = new node(pline); - for (; ;) { - comparison = linecompare(pnode.line,pline); - if (comparison == 0) return pnode; /* found */ - - if (comparison < 0) { - if (pnode.pleft == null) { - pnode.pleft = new node(pline); - return pnode.pleft; - } - pnode = pnode.pleft; - } - if (comparison > 0) { - if (pnode.pright == null) { - pnode.pright = new node(pline); - return pnode.pright; - } - pnode = pnode.pright; - } - } - /* NOTE: There are return stmts, so control does not get here. */ - } - - /** - * addSymbol(String pline) - Saves line into the symbol table. - * Returns a handle to the symtab entry for that unique line. - * If inoldfile nonzero, then linenum is remembered. - */ - static node addSymbol(Diff diff, String pline, boolean inoldfile, int linenum) { - node.diff = diff; - node pnode; - pnode = matchsymbol(pline); /* find the node in the tree */ - if (pnode.linestate == freshnode) { - pnode.linestate = inoldfile ? oldonce : newonce; - } else { - if ((pnode.linestate == oldonce && !inoldfile) || - (pnode.linestate == newonce && inoldfile)) - pnode.linestate = bothonce; - else pnode.linestate = other; - } - if (inoldfile) pnode.linenum = linenum; - return pnode; - } - - /** - * symbolIsUnique Arg is a ptr previously returned by addSymbol. - * -------------- Returns true if the line was added to the - * symbol table exactly once with inoldfile true, - * and exactly once with inoldfile false. - */ - boolean symbolIsUnique() { - return (linestate == bothonce); - } - - /** - * showSymbol Prints the line to stdout. - */ - void showSymbol() { - diff.printer.println(line); - } - static String compact(String line){ - // trim and remove return characters - String[] pieces = line.trim().split("\r"); - line = ""; for(String s: pieces) line = line +s; - // Break line on whitespace and compact - pieces = line.split("[ \t\n][ \t\n]*"); - line = ""; for(String s: pieces) line = line + s; - return line; - } - - static int linecompare(String line1, String line2) - { - return compact(line1).compareToIgnoreCase(compact(line2)); - } - -} diff --git a/dap4/d4tests/src/test/java/dap4/test/TestCDMClient.java b/dap4/d4tests/src/test/java/dap4/test/TestCDMClient.java deleted file mode 100644 index 63fea6f332..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestCDMClient.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2016, University Corporation for Atmospheric Research - * See the LICENSE.txt file for more information. - */ - -package dap4.test; - -import dap4.core.util.DapUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.TestDir; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -/** - * Test Client side access - */ - -public class TestCDMClient extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static final boolean DEBUG = false; - - ////////////////////////////////////////////////// - // Constants - - static final String BASEEXTENSION = ".txt"; - static final String INPUTEXTENSION = ".raw"; - - static final String DAP4TAG = "#protocol=dap4"; - - static final String DATADIR = "src/test/data/resources"; // relative to dap4 root - static final String BASELINEDIR = "TestCDMClient/baseline"; - static final String TESTCDMINPUT = "TestCDMClient/testinput"; - static final String TESTFILESINPUT = "testfiles"; - - static final String[] EXCLUDEDFILETESTS = new String[] {"test_sequence_2.syn.raw"}; - - ////////////////////////////////////////////////// - // Type Declarations - - static class TestCase { - static private String root = null; - - static void setRoot(String r) { - root = r; - } - - static String getRoot() { - return root; - } - - ///////////////////////// - - private String title; - private String dataset; - private String ext; - private boolean checksumming; - private String testpath; - private String baselinepath; - private String url; - - TestCase(String url) { - this(url, true); - } - - TestCase(String url, boolean csum) { - try { - URL u = new URL(url); - this.title = u.getPath(); - } catch (MalformedURLException e) { - this.title = "unknown"; - } - this.checksumming = csum; - this.url = url; - try { - URL u = new URL(url); - this.testpath = DapUtil.canonicalpath(u.getPath()); - int i = this.testpath.lastIndexOf('/'); - assert i > 0; - this.dataset = this.testpath.substring(i + 1, this.testpath.length()); - // strip off any raw extension - if (this.dataset.endsWith(INPUTEXTENSION)) - this.dataset = this.dataset.substring(0, this.dataset.length() - INPUTEXTENSION.length()); - this.baselinepath = root + "/" + BASELINEDIR + "/" + this.dataset + INPUTEXTENSION + BASEEXTENSION; - } catch (MalformedURLException e) { - throw new IllegalArgumentException(url); - } - } - - public String getURL() { - return this.url + DAP4TAG; - } - - public String getPath() { - return this.testpath; - } - - public String getDataset() { - return this.dataset; - } - - public String getBaseline() { - return this.baselinepath; - } - - public String getTitle() { - return this.title; - } - - public String toString() { - return this.url; - } - } - - ////////////////////////////////////////////////// - // Instance variables - - // Test cases - - protected List alltestcases = new ArrayList(); - protected List chosentests = new ArrayList(); - - protected String resourceroot = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - testSetup(); - this.resourceroot = getResourceRoot(); - TestCase.setRoot(resourceroot); - defineAllTestcases(); - chooseTestcases(); - } - - // convert an extension to a file or url prefix - String prefix(String scheme, String ext) { - if (ext.charAt(0) == '.') - ext = ext.substring(1); - if (scheme.startsWith("http")) { - return "http://" + TestDir.dap4TestServer + "/d4ts"; - } else if (scheme.equals("file")) { - if (ext.equals("raw")) - return "file:/" + this.resourceroot + "/" + TESTCDMINPUT; - } - throw new IllegalArgumentException(); - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("file:", "test_atomic_array.nc.raw"); - prop_visual = true; - prop_baseline = false; - } else { - prop_baseline = false; - for (TestCase tc : alltestcases) { - chosentests.add(tc); - } - } - } - - void defineAllTestcases() { - System.err.printf("pwd=%s%n", System.getProperty("user.dir")); - List matches = new ArrayList<>(); - String dir = TestCase.getRoot() + "/" + TESTCDMINPUT; - TestFilter.filterfiles(dir, matches, "raw"); - for (String f : matches) { - boolean excluded = false; - for (String x : EXCLUDEDFILETESTS) { - if (f.endsWith(x)) { - excluded = true; - break; - } - } - if (!excluded) { - add(f); - } - } - } - - protected void add(String path) { - File f = new File(path); - if (!f.exists()) - System.err.println("Non existent file test case: " + path); - else if (!f.canRead()) - System.err.println("Unreadable file test case: " + path); - String ext = path.substring(path.lastIndexOf('.'), path.length()); - String url = "file://" + path; - try { - URL u = new URL(url); - System.err.printf("Testcase: add: %s path=%s%n", u.toString(), u.getPath()); - } catch (MalformedURLException e) { - System.err.println("Malformed file test case: " + url); - } - TestCase tc = new TestCase(url); - for (TestCase t : this.alltestcases) { - assert !t.getURL().equals(tc.getURL()) : "Duplicate TestCases: " + t; - } - this.alltestcases.add(tc); - } - - ////////////////////////////////////////////////// - // Junit test method - @Test - public void testCDMClient() throws Exception { - for (TestCase testcase : chosentests) { - doOneTest(testcase); - } - System.err.println("*** PASS"); - } - - ////////////////////////////////////////////////// - // Primary test method - void doOneTest(TestCase testcase) throws Exception { - System.err.println("Testcase: " + testcase.getURL()); - System.err.println("Baseline: " + testcase.getBaseline()); - - NetcdfDataset ncfile; - try { - ncfile = openDataset(testcase.getURL()); - } catch (Exception e) { - e.printStackTrace(); - throw new Exception("File open failed: " + testcase.getURL(), e); - } - assert ncfile != null; - - String datasetname = testcase.getDataset(); - String data = dumpdata(ncfile, datasetname); - - if (prop_visual) { - visual(testcase.getTitle() + ".dap", data); - } - String baselinefile = testcase.getBaseline(); - - if (prop_baseline) - writefile(baselinefile, data); - else if (prop_diff) { // compare with baseline - // Read the baseline file(s) - String baselinecontent = readfile(baselinefile); - System.err.println("Comparison: vs " + baselinefile); - Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, data)); - } - } - - String dumpmetadata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringWriter sw = new StringWriter(); - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - // Print the meta-databuffer using these args to NcdumpW - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NcdumpW failed"); - } catch (IOException ioe) { - throw new Exception("NcdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - String dumpdata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - StringWriter sw = new StringWriter(); - // Dump the databuffer - sw = new StringWriter(); - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NCdumpW failed"); - } catch (IOException ioe) { - ioe.printStackTrace(); - throw new Exception("NCdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - ////////////////////////////////////////////////// - // Utility methods - - // Locate the test cases with given prefix - List locate(String scheme, String s) { - return locate(scheme, s, null); - } - - List locate(String scheme, String s, List list) { - if (list == null) - list = new ArrayList<>(); - int matches = 0; - for (TestCase ct : this.alltestcases) { - if (!ct.getURL().startsWith(scheme)) - continue; - if (ct.getPath().endsWith(s)) { - matches++; - list.add(ct); - } - } - assert matches > 0 : "No such testcase: " + s; - return list; - } - - static boolean report(String msg) { - System.err.println(msg); - return false; - } - -} diff --git a/dap4/d4tests/src/test/java/dap4/test/TestDAP4Client.java b/dap4/d4tests/src/test/java/dap4/test/TestDAP4Client.java deleted file mode 100644 index 8ddca4ec20..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestDAP4Client.java +++ /dev/null @@ -1,406 +0,0 @@ -package dap4.test; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.httpservices.HTTPException; -import ucar.httpservices.HTTPFactory; -import ucar.httpservices.HTTPMethod; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.UnitTestCommon; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.List; - -/** - * Test OpenDap Server at the NetcdfDataset level - */ -public class TestDAP4Client extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static final boolean DEBUG = false; - - static final boolean BROKEN = false; // on/off known broken tests - - static final boolean BUILDBASELINE = false; - - static final boolean NCDUMP = true; // Use NcDumpW instead of NCPrint - - static final String EXTENSION = (NCDUMP ? "ncdump" : "dmp"); - - static final String TESTEXTENSION = "dmr"; - - // Mnemonic - static final boolean HEADERONLY = false; - - ////////////////////////////////////////////////// - // Constants - - static final String SERVLETPATH = "d4ts/testfiles"; - - static final String DATADIR = "src/test/data"; // relative to dap4 root - static final String BASELINEDIR = "TestDAP4Client/baseline"; - - // Define the names of the xfail tests - static final String[] XFAIL_TESTS = {}; - - static boolean isXfailTest(String t) { - for (String s : XFAIL_TESTS) { - if (s.equals(t)) - return true; - } - return false; - } - - ////////////////////////////////////////////////// - // Type Declarations - - static class Server { - public static String SERVLET = "dts"; - public String ip; - public String port; - - public Server(String ip, String port) { - this.ip = ip; - this.port = port; - } - - public String getURL() { - StringBuilder buf = new StringBuilder(); - buf.append("http://"); - buf.append(this.ip); - if (port != null) { - buf.append(":"); - buf.append(this.port); - } - return buf.toString(); - } - - // Return a URL for testing if server is up/down - public String getTestURL() { - StringBuilder baseurl = new StringBuilder().append(getURL()); - baseurl.append("/"); - baseurl.append(SERVLET); - return baseurl.toString(); - } - - } - - static class ClientTest { - static String root = null; - static String server = null; - static String servlet = null; - static int counter = 0; - - boolean checksumming = true; - boolean xfail = false; - boolean headeronly = false; - - String title; - String dataset; // path minus the server url part. - String baselinepath; - String constraint; - int id; - - ClientTest(String dataset) { - this(0, dataset, null); - } - - ClientTest(int id, String datasetpath, String constraint) { - if (constraint == null) - constraint = ""; - // Break off the final file set name - int index = datasetpath.lastIndexOf('/'); - this.dataset = datasetpath.substring(index + 1, datasetpath.length()); - this.title = this.dataset; - this.id = id; - this.constraint = (constraint.length() == 0 ? null : constraint); - this.baselinepath = root + "/" + BASELINEDIR + "/" + dataset; - if (this.constraint != null) - this.baselinepath += ("." + String.valueOf(this.id)); - } - - public ClientTest nochecksum() { - this.checksumming = false; - return this; - } - - public ClientTest xfail() { - this.xfail = true; - return this; - } - - public ClientTest headeronly() { - this.headeronly = true; - return this; - } - - String makeurl() { - String url = this.server + "/" + this.servlet + "/" + this.dataset; - if (constraint != null) - url += ("?" + constraint); - url += "#dap4"; - return url; - } - - public String toString() { - return dataset; - } - } - - ////////////////////////////////////////////////// - // Class variables - - // Order is important; testing reachability is in the order listed - static List SERVERS; - - static { - SERVERS = new ArrayList<>(); - SERVERS.add(new Server("149.165.169.123", "8080")); - SERVERS.add(new Server("remotetest.unidata.ucar.edu", null)); - } - - ////////////////////////////////////////////////// - // Instance variables - - // Test cases - - List alltestcases = new ArrayList(); - List chosentests = new ArrayList(); - - String datasetpath = null; - - Server server = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - // Find the server to use - this.server = null; - for (Server svc : SERVERS) { - String url = svc.getTestURL(); - try (HTTPMethod method = HTTPFactory.Get(url)) { - try { - int code = method.execute(); - if (code == 200) { - this.server = svc; - System.out.println("Using server url " + url); - break; - } - } catch (HTTPException e) { - this.server = null; - } - } - } - if (this.server == null) - throw new Exception("Cannot locate server"); - defineAllTestcases(this.getResourceDir(), SERVLETPATH, this.server.getURL()); - chooseTestcases(); - if (BUILDBASELINE) - prop_baseline = true; - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("test_atomic_types.nc"); - prop_baseline = true; - } else { - for (ClientTest tc : alltestcases) { - chosentests.add(tc); - } - } - } - - boolean defineAllTestcases(String root, String servlet, String server) { - boolean what = HEADERONLY; - ClientTest.root = root; - ClientTest.server = server; - ClientTest.servlet = servlet; - alltestcases.add(new ClientTest("test_atomic_array.nc")); - alltestcases.add(new ClientTest("test_atomic_types.nc")); - alltestcases.add(new ClientTest("test_enum.nc")); - alltestcases.add(new ClientTest("test_enum_2.nc")); - alltestcases.add(new ClientTest("test_enum_array.nc")); - alltestcases.add(new ClientTest("test_enum1.nc")); - alltestcases.add(new ClientTest("test_fill.nc")); - alltestcases.add(new ClientTest("test_groups1.nc")); - if (BROKEN) - alltestcases.add(new ClientTest("test_misc1.nc")); // 0 size unlimited - if (BROKEN) - alltestcases.add(new ClientTest("test_one_var.nc")); // 0 size unlimited - alltestcases.add(new ClientTest("test_one_vararray.nc")); - alltestcases.add(new ClientTest("test_opaque.nc")); - alltestcases.add(new ClientTest("test_opaque_array.nc")); - alltestcases.add(new ClientTest("test_struct_array.nc")); - alltestcases.add(new ClientTest("test_struct_nested.nc")); - alltestcases.add(new ClientTest("test_struct_nested3.nc")); - alltestcases.add(new ClientTest("test_struct_type.nc")); - alltestcases.add(new ClientTest("test_struct1.nc")); - alltestcases.add(new ClientTest("test_test.nc")); - if (BROKEN) - alltestcases.add(new ClientTest("test_unlim.nc")); // ? - if (BROKEN) - alltestcases.add(new ClientTest("test_unlim1.nc")); // ? - if (BROKEN) - alltestcases.add(new ClientTest("test_utf8.nc")); // ? - alltestcases.add(new ClientTest("test_vlen1.nc")); - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen2.nc")); // non scalar vlen - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen3.nc")); // non scalar vlen - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen4.nc")); // non scalar vlen - alltestcases.add(new ClientTest("test_vlen5.nc")); - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen6.nc")); // non-scalar vlen - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen7.nc")); // non-scalar vlen - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen8.nc")); // non-scalar vlen - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen9.nc")); // non-scalar - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen10.nc")); // non-scalar - if (BROKEN) - alltestcases.add(new ClientTest("test_vlen11.nc")); // unknown failure - if (BROKEN) - alltestcases.add(new ClientTest("test_zerodim.nc")); // non-scalar seq - alltestcases.add(new ClientTest("tst_fills.nc")); - for (ClientTest test : alltestcases) { - if (what == HEADERONLY) - test.headeronly(); - } - return true; - } - - ////////////////////////////////////////////////// - // Junit test method - - @Test - public void testDAP4Client() throws Exception { - boolean pass = true; - for (ClientTest testcase : chosentests) { - if (!doOneTest(testcase)) - pass = false; - } - Assert.assertTrue("*** Fail: TestDAP4Client", pass); - } - - ////////////////////////////////////////////////// - // Primary test method - - boolean doOneTest(ClientTest testcase) throws Exception { - boolean pass = true; - System.out.println("Testcase: " + testcase.dataset); - String url = testcase.makeurl(); - NetcdfDataset ncfile = null; - try { - ncfile = openDataset(url); - } catch (Exception e) { - System.err.println(testcase.xfail ? "XFail" : "Fail"); - e.printStackTrace(); - return testcase.xfail; - } - String usethisname = UnitTestCommon.extractDatasetname(url, null); - String metadata = (NCDUMP ? ncdumpmetadata(ncfile, usethisname) : null); - if (prop_visual) { - visual(testcase.title + ".dmr", metadata); - } - - String data = null; - if (!testcase.headeronly) { - data = (NCDUMP ? ncdumpdata(ncfile, usethisname) : null); - if (prop_visual) { - visual(testcase.title + ".dap", data); - } - } - - String testoutput = (testcase.headeronly ? metadata : (NCDUMP ? data : metadata + data)); - - String baselinefile = testcase.baselinepath + "." + EXTENSION; - - if (prop_baseline) - writefile(baselinefile, testoutput); - - if (prop_diff) { // compare with baseline - // Read the baseline file(s) - String baselinecontent = readfile(baselinefile); - System.out.println("Comparison: vs " + baselinefile); - pass = pass && same(getTitle(), baselinecontent, testoutput); - System.out.println(pass ? "Pass" : "Fail"); - } - return pass; - } - - - String ncdumpmetadata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - // Print the meta-databuffer using these args to NcdumpW - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NcdumpW failed"); - } catch (IOException ioe) { - throw new Exception("NcdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - String ncdumpdata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Dump the databuffer - sw = new StringWriter(); - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NCdumpW failed"); - } catch (IOException ioe) { - ioe.printStackTrace(); - throw new Exception("NCdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - ////////////////////////////////////////////////// - // Utility methods - - - // Locate the test cases with given prefix - List locate(String prefix) { - List results = new ArrayList(); - for (ClientTest ct : this.alltestcases) { - if (!ct.dataset.startsWith(prefix)) - continue; - results.add(ct); - } - return results; - } - - static boolean report(String msg) { - System.err.println(msg); - return false; - } - -} // class TestDAP4Client - diff --git a/dap4/d4tests/src/test/java/dap4/test/TestDSP.java b/dap4/d4tests/src/test/java/dap4/test/TestDSP.java deleted file mode 100644 index c1b1b07c83..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestDSP.java +++ /dev/null @@ -1,351 +0,0 @@ -package dap4.test; - -import dap4.core.data.DSP; -import dap4.core.util.DapContext; -import dap4.core.util.DapUtil; -import dap4.dap4lib.DMRPrinter; -import dap4.dap4lib.DSPPrinter; -import dap4.dap4lib.FileDSP; -import dap4.dap4lib.HttpDSP; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.unidata.util.test.TestDir; -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -/** - * Test some of the DSP classes: - * AbstractDSP: tested by all the other DSPs - * CDMDSP: tested elsewhere (TestServlet) - * HttpDSP: tested elsewhere (TestCDMClient) - * FileDSP: tested here - * Nc4DSP: tested here - * SynDSP: tested here - * D4DSP: tested because superclass of FileDSP, HttpDSP, and SynDSP - * ThreddsDSP: not directly tested anywhere yet - */ -public class TestDSP extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static final boolean DEBUG = false; - static final boolean SHOWTESTCASES = true; - - static final String BASEEXTENSION = "txt"; - - static final String DAP4TAG = "#protocol=dap4"; - - ////////////////////////////////////////////////// - // Constants - - static final String DATADIR = "src/test/data/resources"; // relative to dap4 root - static final String BASELINEDIR = "TestDSP/baseline"; - static final String TESTCDMINPUT = "TestCDMClient/testinput"; - static final String TESTDSPINPUT = "TestDSP/testinput"; - static final String TESTFILESINPUT = "testfiles"; - - static final String[] EXCLUDEDFILETESTS = new String[] {}; - - ////////////////////////////////////////////////// - // Type Declarations - - static class TestCase { - static protected String root = null; - - static void setRoot(String r) { - root = r; - } - - static String getRoot() { - return root; - } - - ///////////////////////// - - private String title; - private String dataset; - private boolean checksumming; - private String testpath; - private String baselinepath; - private String url; - - TestCase(String url) { - this(url, true); - } - - TestCase(String url, boolean csum) { - this.title = dataset; - this.checksumming = csum; - this.url = url; - try { - URL u = new URL(url); - this.testpath = DapUtil.canonicalpath(u.getPath()); - int i = this.testpath.lastIndexOf('/'); - assert i > 0; - this.dataset = this.testpath.substring(i + 1, this.testpath.length()); - // strip off any raw extension - this.baselinepath = root + "/" + BASELINEDIR + "/" + this.dataset + "." + BASEEXTENSION; - } catch (MalformedURLException e) { - throw new IllegalArgumentException(url); - } - } - - public String getURL() { - return this.url + DAP4TAG; - } - - public String getPath() { - return this.testpath; - } - - public String getDataset() { - return this.dataset; - } - - public String getBaseline() { - return this.baselinepath; - } - - public String getTitle() { - return this.title; - } - - public String toString() { - return this.url; - } - } - - ////////////////////////////////////////////////// - // Static variables and methods - - protected DSP dspFor(String surl) { - URL url; - try { - url = new URL(surl); - } catch (MalformedURLException mue) { - throw new IllegalArgumentException("Malformed url: " + surl); - } - String proto = url.getProtocol(); - String path = url.getPath(); - int dot = path.lastIndexOf('.'); - if (dot < 0) - dot = path.length(); - String ext = path.substring(dot, path.length()); - DSP dsp = null; - if ("file".equals(proto)) { - // discriminate on the extensions - if (".raw".equals(ext)) { - dsp = new FileDSP(); - } - } else if ("http".equals(proto) || "https".equals(url.getProtocol())) { - dsp = new HttpDSP(); - } else - throw new IllegalArgumentException("Cannot determine DSP class for: " + surl); - if (DEBUG) - System.err.printf("DSP: %s%n", dsp.getClass().getName()); - return dsp; - } - ////////////////////////////////////////////////// - // Instance variables - - // Test cases - - protected List alltestcases = new ArrayList(); - protected List chosentests = new ArrayList(); - - protected String resourceroot = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - this.resourceroot = getResourceRoot(); - this.resourceroot = DapUtil.absolutize(this.resourceroot); // handle problem of windows paths - TestCase.setRoot(resourceroot); - defineAllTestcases(); - chooseTestcases(); - } - - // convert an extension to a file or url prefix - String prefix(String scheme, String ext) { - if (ext.charAt(0) == '.') - ext = ext.substring(1); - if (scheme.startsWith("http")) { - return "http://" + TestDir.dap4TestServer + "/d4ts"; - } else if (scheme.equals("file")) { - if (ext.equals("raw")) - return "file:/" + this.resourceroot + "/" + TESTCDMINPUT; - if (ext.equals("syn")) - return "file:/" + this.resourceroot + "/" + TESTDSPINPUT; - if (ext.equals("nc")) - return "file:/" + this.resourceroot + "/" + TESTFILESINPUT; - } - throw new IllegalArgumentException(); - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("file:", "test_struct_nested3.hdf5.raw"); - prop_visual = true; - prop_baseline = false; - } else { - prop_baseline = false; - for (TestCase tc : alltestcases) { - if (DEBUG) - System.err.printf("Test case: %s%n", tc.dataset); - chosentests.add(tc); - } - } - } - - void defineAllTestcases() { - List matches = new ArrayList<>(); - String dir = TestCase.root + "/" + TESTCDMINPUT; - TestFilter.filterfiles(dir, matches, "raw"); - if (false) { - dir = TestCase.root + "/" + TESTFILESINPUT; - TestFilter.filterfiles(dir, matches, "nc", "syn"); - } - for (String f : matches) { - boolean excluded = false; - for (String x : EXCLUDEDFILETESTS) { - if (f.indexOf(x) >= 0) { - excluded = true; - break; - } - } - if (!excluded) - add("file:/" + f); - } - if (SHOWTESTCASES) { - for (int i = 0; i < this.alltestcases.size(); i++) { - TestCase tc = this.alltestcases.get(i); - System.err.printf("ALLTESTS: %s%n", tc.getURL()); - } - } - } - - protected void add(String url) { - try { - URL u = new URL(url); - File f = new File(u.getPath()); - if (!f.canRead()) { - System.err.println("Unreadable file test case: " + url); - } - } catch (MalformedURLException e) { - System.err.println("Malformed file test case: " + url); - } - String ext = url.substring(url.lastIndexOf('.'), url.length()); - TestCase tc = new TestCase(url); - for (TestCase t : this.alltestcases) { - assert !t.getURL().equals(tc.getURL()) : "Duplicate TestCases: " + t; - } - this.alltestcases.add(tc); - } - - ////////////////////////////////////////////////// - // Junit test method - @Test - public void testDSP() throws Exception { - for (TestCase testcase : chosentests) { - doOneTest(testcase); - } - System.err.println("*** PASS"); - } - - ////////////////////////////////////////////////// - // Primary test method - void doOneTest(TestCase testcase) throws Exception { - System.err.println("Testcase: " + testcase.getURL()); - System.err.println("Baseline: " + testcase.getBaseline()); - - DSP dsp = dspFor(testcase.getURL()); - - dsp.setContext(new DapContext()); - dsp.open(testcase.getURL()); - - String metadata = dumpmetadata(dsp); - if (prop_visual) - visual(testcase.getURL() + ".dmr", metadata); - String data = dumpdata(dsp); - if (prop_visual) - visual(testcase.getURL() + ".dap", data); - - String baselinefile = testcase.getBaseline(); - - String testoutput = metadata + data; - - if (prop_baseline) - writefile(baselinefile, testoutput); - else if (prop_diff) { // compare with baseline - // Read the baseline file(s) - String baselinecontent = readfile(baselinefile); - System.err.println("Comparison: vs " + baselinefile); - Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, testoutput)); - } - } - - String dumpmetadata(DSP dsp) throws Exception { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - // Print the meta-databuffer using these args to NcdumpW - DMRPrinter p = new DMRPrinter(dsp.getDMR(), pw); - p.testprint(); - pw.close(); - sw.close(); - return sw.toString(); - } - - String dumpdata(DSP dsp) throws Exception { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - // Print the meta-databuffer using these args to NcdumpW - DSPPrinter p = new DSPPrinter(dsp, pw).flag(DSPPrinter.Flags.CONTROLCHAR); - p.print(); - pw.close(); - sw.close(); - return sw.toString(); - } - - ////////////////////////////////////////////////// - // Utility methods - - // Locate the test cases with given prefix - List locate(String scheme, String s) { - return locate(scheme, s, null); - } - - List locate(String scheme, String s, List list) { - if (list == null) - list = new ArrayList<>(); - int matches = 0; - for (TestCase ct : this.alltestcases) { - if (!ct.getURL().startsWith(scheme)) - continue; - if (ct.getPath().endsWith(s)) { - matches++; - list.add(ct); - } - } - assert matches > 0 : "No such testcase: " + s; - return list; - } - - static boolean report(String msg) { - System.err.println(msg); - return false; - } - - -} diff --git a/dap4/d4tests/src/test/java/dap4/test/TestH5Iosp.java b/dap4/d4tests/src/test/java/dap4/test/TestH5Iosp.java deleted file mode 100644 index 1f97677c3b..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestH5Iosp.java +++ /dev/null @@ -1,287 +0,0 @@ -package dap4.test; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.category.NotJenkins; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.math.BigInteger; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.List; - -@Category(NotJenkins.class) -public class TestH5Iosp extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static protected final boolean DEBUG = false; - - static protected final boolean NCDUMP = true; - - static protected final Mode mode = Mode.BOTH; - - ////////////////////////////////////////////////// - // Constants - - static protected String DATADIR = "src/test/data"; // relative to dap4 root - static protected String TESTDATADIR = DATADIR + "/resources/"; - static protected String BASELINEDIR = DATADIR + "/resources/TestIosp/baseline"; - static protected String TESTINPUTDIR = DATADIR + "/resources/testfiles"; - - static protected final BigInteger MASK = new BigInteger("FFFFFFFFFFFFFFFF", 16); - - ////////////////////////////////////////////////// - // Type Declarations - - static protected class H5IospTest { - static String root = null; - String title; - String dataset; - String testinputpath; - String baselinepath; - - H5IospTest(String dataset) { - this.title = dataset; - this.dataset = dataset; - this.testinputpath = root + "/" + TESTINPUTDIR + "/" + dataset; - this.baselinepath = root + "/" + BASELINEDIR + "/" + dataset + ".hdf5"; - } - - public String toString() { - return dataset; - } - } - - static protected enum Mode { - DMR, DATA, BOTH; - } - - ////////////////////////////////////////////////// - // Instance variables - - // Misc variables - protected boolean isbigendian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; - - // Test cases - - protected List alltestcases = new ArrayList(); - - protected List chosentests = new ArrayList(); - - protected String datasetpath = null; - - protected String testroot = null; - - ////////////////////////////////////////////////// - @Before - public void setup() throws Exception { - this.testroot = getTestFilesDir(); - File f = new File(testroot + "/" + BASELINEDIR); - if (!f.exists()) - f.mkdir(); - this.datasetpath = this.testroot + "/" + DATADIR; - defineAllTestcases(this.testroot); - chooseTestcases(); - } - - protected String getTestFilesDir() { - return TESTINPUTDIR; - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("test_enum.nc"); - // chosentests.add(new H5IospTest("test_test.nc")); - } else { - for (H5IospTest tc : alltestcases) { - chosentests.add(tc); - } - } - } - - void defineAllTestcases(String root) { - H5IospTest.root = root; - this.alltestcases.add(new H5IospTest("test_one_var.nc")); - this.alltestcases.add(new H5IospTest("test_one_vararray.nc")); - this.alltestcases.add(new H5IospTest("test_atomic_types.nc")); - this.alltestcases.add(new H5IospTest("test_atomic_array.nc")); - this.alltestcases.add(new H5IospTest("test_enum.nc")); - this.alltestcases.add(new H5IospTest("test_enum_array.nc")); - this.alltestcases.add(new H5IospTest("test_struct_type.nc")); - this.alltestcases.add(new H5IospTest("test_struct_array.nc")); - this.alltestcases.add(new H5IospTest("test_struct_nested.nc")); - this.alltestcases.add(new H5IospTest("test_vlen1.nc")); - this.alltestcases.add(new H5IospTest("test_vlen2.nc")); - this.alltestcases.add(new H5IospTest("test_vlen3.nc")); - this.alltestcases.add(new H5IospTest("test_vlen4.nc")); - this.alltestcases.add(new H5IospTest("test_vlen5.nc")); - } - - - ////////////////////////////////////////////////// - // Junit test methods - - @Test - public void testH5Iosp() throws Exception { - for (H5IospTest testcase : chosentests) { - if (!doOneTest(testcase)) { - Assert.assertTrue(false); - } - } - } - - ////////////////////////////////////////////////// - // Primary test method - boolean doOneTest(H5IospTest testcase) throws Exception { - boolean pass = true; - - System.out.println("Testcase: " + testcase.testinputpath); - - NetcdfDataset ncfile = openDataset(testcase.testinputpath); - - String metadata = null; - String data = null; - if (mode == Mode.DMR || mode == Mode.BOTH) { - metadata = (NCDUMP ? ncdumpmetadata(ncfile, testcase.dataset) : null); - if (prop_visual) - visual("Meta Data: ", metadata); - } - if (mode == Mode.DATA || mode == Mode.BOTH) { - data = (NCDUMP ? ncdumpdata(ncfile, testcase.dataset) : null); - if (prop_visual) - visual("Data: ", data); - } - - String baselinefile = String.format("%s", testcase.baselinepath); - if (prop_baseline) { - if (mode == Mode.DMR || mode == Mode.BOTH) - writefile(baselinefile + ".dmr", metadata); - if (mode == Mode.DATA || mode == Mode.BOTH) - writefile(baselinefile + ".dap", data); - } else if (prop_diff) { // compare with baseline - String baselinecontent = null; - if (mode == Mode.DMR || mode == Mode.BOTH) { - // Read the baseline file(s) - System.out.println("DMR Comparison:"); - baselinecontent = readfile(baselinefile + ".dmr"); - pass = pass && same(getTitle(), baselinecontent, metadata); - System.out.println(pass ? "Pass" : "Fail"); - } - if (mode == Mode.DATA || mode == Mode.BOTH) { - System.out.println("DATA Comparison:"); - baselinecontent = readfile(baselinefile + ".dap"); - pass = pass && same(getTitle(), baselinecontent, data); - System.out.println(pass ? "Pass" : "Fail"); - } - } - return pass; - } - - ////////////////////////////////////////////////// - // Utility methods - - boolean report(String msg) { - System.err.println(msg); - prop_generate = false; - return false; - } - - - // Locate the test cases with given prefix - List locate(String prefix) { - List results = new ArrayList(); - for (H5IospTest ct : this.alltestcases) { - if (ct.dataset.startsWith(prefix)) - results.add(ct); - } - return results; - } - ////////////////////////////////////////////////// - // Stand alone - - static public void main(String[] argv) { - try { - new TestH5Iosp().testH5Iosp(); - } catch (Exception e) { - System.err.println("*** FAIL"); - e.printStackTrace(); - System.exit(1); - } - System.err.println("*** PASS"); - System.exit(0); - }// main - - ////////////////////////////////////////////////// - // Dump methods - - String ncdumpmetadata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - String metadata = null; - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Print the meta-databuffer using these args to NcdumpW - ok = false; - try { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - try { - sw.close(); - } catch (IOException e) { - } - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - return shortenFileName(sw.toString(), ncfile.getLocation()); - } - - String ncdumpdata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - // Dump the databuffer - sw = new StringWriter(); - ok = false; - try { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - try { - sw.close(); - } catch (IOException e) { - } ; - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - return shortenFileName(sw.toString(), ncfile.getLocation()); - } - -} - diff --git a/dap4/d4tests/src/test/java/dap4/test/TestHyrax.java b/dap4/d4tests/src/test/java/dap4/test/TestHyrax.java deleted file mode 100644 index 3dfa0006ce..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestHyrax.java +++ /dev/null @@ -1,393 +0,0 @@ -package dap4.test; - -import dap4.core.util.DapUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.UnitTestCommon; -import ucar.unidata.util.test.category.NotJenkins; -import ucar.unidata.util.test.category.NotPullRequest; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.List; - -/** - * Test OpenDap Server at the NetcdfDataset level - */ -@Ignore -public class TestHyrax extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static final boolean DEBUG = false; - - static final boolean NCDUMP = true; // Use NcDumpW instead of NCPrint - - static final String EXTENSION = (NCDUMP ? "ncdump" : "dmp"); - - static final String TESTEXTENSION = "dmr"; - - // Mnemonic - static final boolean HEADERONLY = false; - - static final String IP = "ec2-54-204-231-163"; - ////////////////////////////////////////////////// - // Constants - - static final String DATADIR = "src/test/data"; // relative to dap4 root - static final String TESTDATADIR = DATADIR + "/resources/TestHyrax"; - static final String BASELINEDIR = TESTDATADIR + "/baseline"; - - // Define the names of the xfail tests - static final String[] XFAIL_TESTS = {"test_struct_array.nc"}; - - // Order is important; testing reachability is in the order - // listed - static final String[] SOURCES = - new String[] {"hyrax", "http://" + IP + ".compute-1.amazonaws.com:8080/opendap/data/reader/dap4/dap4.html", - "dap4://" + IP + ".compute-1.amazonaws.com:8080/opendap/data/reader/dap4"}; - - static boolean isXfailTest(String t) { - for (String s : XFAIL_TESTS) { - if (s.equals(t)) - return true; - } - return false; - } - - ////////////////////////////////////////////////// - // Type Declarations - - static class Source { - public String name; - public String testurl; - public String prefix; - - public Source(String name, String testurl, String prefix) { - this.name = name; - this.prefix = prefix; - this.testurl = testurl; - } - } - - static class ClientTest { - static String root = null; - static String server = null; - static int counter = 0; - - boolean checksumming = true; - boolean xfail = false; - boolean headeronly = false; - - String title; - String dataset; // path minus the server url part. - String datasetpath; // Hyrax test databuffer is segregated into multiple directories - String baselinepath; - String constraint; - int id; - - ClientTest(String dataset) { - this(0, dataset, null); - } - - ClientTest(int id, String datasetpath, String constraint) { - // Break off the final file set name - int index = datasetpath.lastIndexOf('/'); - this.dataset = datasetpath.substring(index + 1, datasetpath.length()); - this.datasetpath = datasetpath; - this.title = this.dataset; - this.id = id; - this.constraint = (constraint.length() == 0 ? null : constraint); - this.baselinepath = root + "/" + BASELINEDIR + "/" + dataset; - if (this.constraint != null) - this.baselinepath += ("." + String.valueOf(this.id)); - } - - public ClientTest nochecksum() { - this.checksumming = false; - return this; - } - - public ClientTest xfail() { - this.xfail = true; - return this; - } - - public ClientTest headeronly() { - this.headeronly = true; - return this; - } - - String makeurl() { - String url = url = server + "/" + datasetpath; - if (constraint != null) - url += ("?" + constraint); - return url; - } - - public String toString() { - return dataset; - } - } - - ////////////////////////////////////////////////// - // Instance variables - - // Test cases - - List alltestcases = new ArrayList(); - List chosentests = new ArrayList(); - - String resourceroot = null; - String datasetpath = null; - - String sourceurl = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - this.resourceroot = getResourceRoot(); - this.resourceroot = DapUtil.absolutize(this.resourceroot); // handle problem of windows paths - System.out.println("Using source url " + this.sourceurl); - defineAllTestcases(this.resourceroot, this.sourceurl); - chooseTestcases(); - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("dmr-testsuite/test_array_7.xml"); - } else { - for (ClientTest tc : alltestcases) { - chosentests.add(tc); - } - } - } - - boolean defineAllTestcases(String root, String server) { - - boolean what = HEADERONLY; - - ClientTest.root = root; - ClientTest.server = server; - if (false) { - alltestcases.add(new ClientTest(1, "D4-xml/DMR_4.xml", "b1")); - } - if (false) { - alltestcases.add(new ClientTest("test_simple_1.dmr")); - // deleted: alltestcases.add(new TestCase("dmr-testsuite/testall.xml")); - } - if (false) { - alltestcases.add(new ClientTest("dmr-testsuite/test_array_1.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_2.xml")); - strings: alltestcases.add(new ClientTest("dmr-testsuite/test_array_3.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_4.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_5.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_6.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_7.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_8.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_10.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_array_11.xml")); - - } - if (false) { - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_1.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_2.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_3.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_4.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_5.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_6.xml")); - // sequence: alltestcases.add(new TestCase("dmr-testsuite/test_simple_7.xml")); - // sequence: alltestcases.add(new TestCase("dmr-testsuite/test_simple_8.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_9.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_9.1.xml")); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_10.xml")); - } - if (false) { - // alltestcases.add(new TestCase("D4-xml/DMR_0.1.xml")); needs fixing - alltestcases.add(new ClientTest("D4-xml/DMR_0.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_1.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_2.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_2.1.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.1.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.2.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.3.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.4.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_3.5.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_4.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_4.1.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_5.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_5.1.xml")); - // serial: alltestcases.add(new TestCase("D4-xml/DMR_6.xml")); - // serial: alltestcases.add(new TestCase("D4-xml/DMR_6.1.xml")); - // serial: alltestcases.add(new TestCase("D4-xml/DMR_6.2.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.1.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.2.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.3.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.4.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_7.5.xml")); - alltestcases.add(new ClientTest("D4-xml/DMR_8.xml")); - } - - if (false) { - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_3_error_1.xml").xfail()); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_3_error_2.xml").xfail()); - alltestcases.add(new ClientTest("dmr-testsuite/test_simple_3_error_3.xml").xfail()); - } - for (ClientTest test : alltestcases) { - if (what == HEADERONLY) - test.headeronly(); - } - return true; - } - - ////////////////////////////////////////////////// - // Junit test method - - @Test - @Category({NotJenkins.class, NotPullRequest.class}) - public void testHyrax() throws Exception { - boolean pass = true; - for (ClientTest testcase : chosentests) { - if (!doOneTest(testcase)) - pass = false; - } - Assert.assertTrue("*** Fail: TestHyrax", pass); - } - - ////////////////////////////////////////////////// - // Primary test method - boolean doOneTest(ClientTest testcase) throws Exception { - boolean pass = true; - System.out.println("Testcase: " + testcase.dataset); - String url = testcase.makeurl(); - NetcdfDataset ncfile = null; - try { - ncfile = openDataset(url); - } catch (Exception e) { - System.err.println(testcase.xfail ? "XFail" : "Fail"); - e.printStackTrace(); - return testcase.xfail; - } - String usethisname = UnitTestCommon.extractDatasetname(url, null); - String metadata = (NCDUMP ? ncdumpmetadata(ncfile, usethisname) : null); - if (prop_visual) { - visual(testcase.title + ".dmr", metadata); - } - - String data = null; - if (!testcase.headeronly) { - data = (NCDUMP ? ncdumpdata(ncfile, usethisname) : null); - if (prop_visual) { - visual(testcase.title + ".dap", data); - } - } - - String testoutput = (testcase.headeronly ? metadata : (NCDUMP ? data : metadata + data)); - - String baselinefile = testcase.baselinepath + "." + EXTENSION; - - if (prop_baseline) - writefile(baselinefile, testoutput); - - if (prop_diff) { // compare with baseline - // Read the baseline file(s) - String baselinecontent = readfile(baselinefile); - System.out.println("Comparison: vs " + baselinefile); - pass = pass && same(getTitle(), baselinecontent, testoutput); - System.out.println(pass ? "Pass" : "Fail"); - } - return pass; - } - - - String ncdumpmetadata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - // Print the meta-databuffer using these args to NcdumpW - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NcdumpW failed"); - } catch (IOException ioe) { - throw new Exception("NcdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - String ncdumpdata(NetcdfDataset ncfile, String datasetname) throws Exception { - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Dump the databuffer - sw = new StringWriter(); - try { - if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) - throw new Exception("NCdumpW failed"); - } catch (IOException ioe) { - ioe.printStackTrace(); - throw new Exception("NCdumpW failed", ioe); - } - sw.close(); - return sw.toString(); - } - - ////////////////////////////////////////////////// - // Utility methods - - - // Locate the test cases with given prefix - List locate(String prefix) { - List results = new ArrayList(); - for (ClientTest ct : this.alltestcases) { - if (!ct.datasetpath.startsWith(prefix)) - continue; - results.add(ct); - } - return results; - } - - static boolean report(String msg) { - System.err.println(msg); - return false; - } - - - ////////////////////////////////////////////////// - // Stand alone - - static public void main(String[] argv) { - try { - new TestHyrax().testHyrax(); - } catch (Exception e) { - System.err.println("*** FAIL"); - e.printStackTrace(); - System.exit(1); - } - System.err.println("*** PASS"); - System.exit(0); - }// main - -} // class TestHyrax - diff --git a/dap4/d4tests/src/test/java/dap4/test/TestNc4Iosp.java b/dap4/d4tests/src/test/java/dap4/test/TestNc4Iosp.java deleted file mode 100644 index 74172ef4df..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestNc4Iosp.java +++ /dev/null @@ -1,287 +0,0 @@ -package dap4.test; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.lang.invoke.MethodHandles; -import java.math.BigInteger; -import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.category.NotPullRequest; - -@Category(NotPullRequest.class) -public class TestNc4Iosp extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static protected final boolean DEBUG = false; - - static protected final boolean NCDUMP = true; - - static protected final Mode mode = Mode.BOTH; - - static String previousJnaEncoding = System.getProperty("jna.encoding"); - - ////////////////////////////////////////////////// - // Constants - - static protected final String RESOURCEPATH = "/src/test/data/resources"; // wrt getTestInputFilesDIr - static protected final String TESTINPUTDIR = "/testfiles"; - static protected final String BASELINEDIR = "/TestIosp/baseline"; - - static protected final BigInteger MASK = new BigInteger("FFFFFFFFFFFFFFFF", 16); - - ////////////////////////////////////////////////// - // Type Declarations - - static protected class Nc4IospTest { - static String inputroot = null; - static String baselineroot = null; - - static public void setRoots(String input, String baseline) { - inputroot = input; - baselineroot = baseline; - } - - String title; - String dataset; - String testinputpath; - String baselinepath; - - Nc4IospTest(String dataset) { - this.title = dataset; - this.dataset = dataset; - this.testinputpath = canonjoin(this.inputroot, dataset); - this.baselinepath = canonjoin(this.baselineroot, dataset) + ".nc4"; - } - - public String toString() { - return dataset; - } - } - - static protected enum Mode { - DMR, DATA, BOTH; - } - - ////////////////////////////////////////////////// - // Instance variables - - // Misc variables - protected boolean isbigendian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; - - // Test cases - - protected List alltestcases = new ArrayList(); - - protected List chosentests = new ArrayList(); - - protected String datasetpath = null; - - protected String root = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - this.root = getResourceRoot(); - testSetup(); - Nc4IospTest.setRoots(canonjoin(getResourceRoot(), TESTINPUTDIR), canonjoin(getResourceRoot(), BASELINEDIR)); - defineAllTestcases(); - chooseTestcases(); - } - - protected String getTestFilesDir() { - return ""; - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("test_struct_array.nc"); - prop_visual = true; - prop_debug = true; - // chosentests.add(new Nc4IospTest("test_test.nc")); - } else { - prop_baseline = false; - for (Nc4IospTest tc : alltestcases) { - chosentests.add(tc); - } - } - } - - void defineAllTestcases() { - this.alltestcases.add(new Nc4IospTest("test_one_var.nc")); - this.alltestcases.add(new Nc4IospTest("test_one_vararray.nc")); - this.alltestcases.add(new Nc4IospTest("test_atomic_types.nc")); - this.alltestcases.add(new Nc4IospTest("test_atomic_array.nc")); - this.alltestcases.add(new Nc4IospTest("test_enum.nc")); - this.alltestcases.add(new Nc4IospTest("test_enum_array.nc")); - this.alltestcases.add(new Nc4IospTest("test_struct_type.nc")); - this.alltestcases.add(new Nc4IospTest("test_struct_array.nc")); - this.alltestcases.add(new Nc4IospTest("test_struct_nested.nc")); - this.alltestcases.add(new Nc4IospTest("test_vlen1.nc")); - this.alltestcases.add(new Nc4IospTest("test_vlen2.nc")); - this.alltestcases.add(new Nc4IospTest("test_vlen3.nc")); - this.alltestcases.add(new Nc4IospTest("test_vlen4.nc")); - this.alltestcases.add(new Nc4IospTest("test_vlen5.nc")); - } - - - ////////////////////////////////////////////////// - // Junit test methods - - @Test - public void testNc4Iosp() throws Exception { - for (Nc4IospTest testcase : chosentests) { - doOneTest(testcase); - } - } - - ////////////////////////////////////////////////// - // Primary test method - void doOneTest(Nc4IospTest testcase) throws Exception { - System.err.println("Testcase: " + testcase.testinputpath); - - NetcdfDataset ncfile = openDataset(testcase.testinputpath); - - String metadata = null; - String data = null; - if (mode == Mode.DMR || mode == Mode.BOTH) { - metadata = (NCDUMP ? ncdumpmetadata(ncfile, testcase.dataset) : null); - if (prop_visual) - visual("Meta Data: ", metadata); - } - if (mode == Mode.DATA || mode == Mode.BOTH) { - data = (NCDUMP ? ncdumpdata(ncfile, testcase.dataset) : null); - if (prop_visual) - visual("Data: ", data); - } - - String baselinefile = String.format("%s", testcase.baselinepath); - System.err.println("Testpath: " + testcase.testinputpath); - System.err.println("Baseline: " + baselinefile); - if (prop_baseline) { - if (mode == Mode.DMR || mode == Mode.BOTH) - writefile(baselinefile + ".dmr", metadata); - if (mode == Mode.DATA || mode == Mode.BOTH) - writefile(baselinefile + ".dap", data); - } else if (prop_diff) { // compare with baseline - String baselinecontent = null; - if (mode == Mode.DMR || mode == Mode.BOTH) { - // Read the baseline file(s) - System.err.println("DMR Comparison:"); - try { - baselinecontent = readfile(baselinefile + ".dmr"); - boolean pass = same(getTitle(), baselinecontent, metadata); - Assert.assertTrue("***Fail", pass); - } catch (IOException ioe) { - Assert.assertTrue("baselinefile" + ".dmr: " + ioe.getMessage(), false); - } - } - if (mode == Mode.DATA || mode == Mode.BOTH) { - System.err.println("DATA Comparison:"); - try { - baselinecontent = readfile(baselinefile + ".dap"); - Assert.assertTrue("***Data Fail", same(getTitle(), baselinecontent, data)); - - } catch (IOException ioe) { - Assert.assertTrue("baselinefile" + ".dap: " + ioe.getMessage(), false); - } - } - } - } - - ////////////////////////////////////////////////// - // Utility methods - - boolean report(String msg) { - System.err.println(msg); - prop_generate = false; - return false; - } - - - // Locate the test cases with given prefix - List locate(String prefix) { - List results = new ArrayList(); - for (Nc4IospTest ct : this.alltestcases) { - if (ct.dataset.startsWith(prefix)) - results.add(ct); - } - return results; - } - - ////////////////////////////////////////////////// - // Dump methods - - String ncdumpmetadata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - String metadata = null; - String dump = ""; - - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Print the meta-databuffer using these args to NcdumpW - ok = false; - try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - OutputStreamWriter outputStreamWriter = new OutputStreamWriter(byteArrayOutputStream, StandardCharsets.UTF_8)) { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), outputStreamWriter, null); - dump = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name()); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - // return shortenFileName(sw.toString(), ncfile.getLocation()); - return dump; - } - - String ncdumpdata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - String dump = ""; - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Dump the databuffer - - ok = false; - try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - OutputStreamWriter outputStreamWriter = new OutputStreamWriter(byteArrayOutputStream, StandardCharsets.UTF_8)) { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), outputStreamWriter, null); - dump = byteArrayOutputStream.toString(StandardCharsets.UTF_8.name()); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - // return shortenFileName(sw.toString(), ncfile.getLocation()); - return dump; - } -} - diff --git a/dap4/d4tests/src/test/java/dap4/test/TestParserCE.java b/dap4/d4tests/src/test/java/dap4/test/TestParserCE.java deleted file mode 100644 index 3acb391e0e..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestParserCE.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.test; - - -import dap4.core.ce.CECompiler; -import dap4.core.ce.CEConstraint; -import dap4.core.ce.parser.CEParserImpl; -import dap4.core.dmr.DMRFactory; -import dap4.core.dmr.DapDataset; -import dap4.core.dmr.parser.DOM4Parser; -import dap4.core.dmr.parser.Dap4Parser; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.List; - -public class TestParserCE extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - ////////////////////////////////////////////////// - // Constants - static final boolean DUMPDMR = false; - static final boolean DMRPARSEDEBUG = false; - static final boolean CEPARSEDEBUG = false; - - static final String TESTCASEDIR = "src/test/data/resources/TestParsers"; // relative to dap4 root - - static final boolean USEDOM = false; - - ////////////////////////////////////////////////// - // Type decls - static class TestSet { - public String dmr; - public String constraint; - public String expected = null; - public String[] debug = null; - public int id = 0; - - public TestSet(int id, String cedmr, String ces, String expected) throws IOException { - this.id = id; - this.dmr = cedmr; - this.constraint = ces; - this.expected = expected; - } - - public TestSet setdebug(String[] debug) { - this.debug = debug; - return this; - } - - public TestSet setdebug(String debug) { - return setdebug(new String[] {debug}); - } - - public String toString() { - return constraint; - } - - } - - ////////////////////////////////////////////////// - // Instance methods - - // All test cases - List alltestsets = new ArrayList<>(); - List chosentests = new ArrayList<>(); - - DapDataset dmr = null; - - ////////////////////////////////////////////////// - @Before - public void setup() { - try { - defineAllTestCases(); - chooseTestcases(); - } catch (IOException ioe) { - ioe.printStackTrace(); - } - } - - ////////////////////////////////////////////////// - // Misc. methods - - protected void chooseTestcases() { - if (false) { - chosentests = locate(7); - assert chosentests.size() > 0 : "Not tests chosen"; - } else { - for (TestSet tc : alltestsets) { - chosentests.add(tc); - } - } - } - - // Locate the test cases - List locate(Object ce) { - List results = new ArrayList<>(); - for (TestSet ct : this.alltestsets) { - if (ce instanceof String) { - if (ct.constraint.equals(ce)) - results.add(ct); - } else if (ce instanceof Integer) { - if (ct.id == ((Integer) ce)) - results.add(ct); - } - } - return results; - } - - protected void defineAllTestCases() throws IOException { - alltestsets.add(new TestSet(1, CE1_DMR, "/a[1]", "/a[1]")); - alltestsets.add(new TestSet(2, CE1_DMR, "/b[10:16]", "/b[10:16]")); - alltestsets.add(new TestSet(3, CE1_DMR, "/c[8:2:15]", "/c[8:2:15]")); - alltestsets.add(new TestSet(4, CE1_DMR, "/a[1];/b[10:16];/c[8:2:15]", "/a[1];/b[10:16];/c[8:2:15]")); - alltestsets - .add(new TestSet(5, CE1_DMR, "/d[1][0:2:2];/a[1];/e[1][0];/f[0][1]", "/d[1][0:2:2];/a[1];/e[1][0];/f[0][1]")); - alltestsets.add(new TestSet(6, CE1_DMR, "/s[0:3][0:2].x;/s[0:3][0:2].y", "/s[0:3][0:2]")); - alltestsets.add(new TestSet(7, CE1_DMR, "/seq|i1<0", "/seq|i1<0")); - alltestsets.add(new TestSet(8, CE1_DMR, "/seq|00,i1<10")); - alltestsets.add(new TestSet(9, CE2_DMR, "vo[1:1][0,0]", "/vo[1][0,0]")); - } - - ////////////////////////////////////////////////// - // Junit test method - - @Test - public void testParserCE() throws Exception { - for (TestSet testset : chosentests) { - if (!doOneTest(testset)) { - Assert.assertTrue(false); - System.exit(1); - } - } - } - - boolean doOneTest(TestSet testset) throws Exception { - boolean pass = true; - - System.out.println("Test Set: " + testset.constraint); - - if (DUMPDMR) { - visual("DMR:", testset.dmr); - } - - // Create the DMR tree - System.out.println("Parsing DMR"); - Dap4Parser parser; - if (!USEDOM) - parser = new DOM4Parser(new DMRFactory()); - if (DMRPARSEDEBUG) - parser.setDebugLevel(1); - boolean parseok = parser.parse(testset.dmr); - if (parseok) - dmr = parser.getDMR(); - if (dmr == null) - parseok = false; - if (!parseok) - throw new Exception("DMR Parse failed"); - System.out.flush(); - System.err.flush(); - - // Iterate over the constraints - String results = ""; - CEConstraint ceroot = null; - System.out.println("constraint: " + testset.constraint); - System.out.flush(); - CEParserImpl ceparser = null; - try { - ceparser = new CEParserImpl(dmr); - if (CEPARSEDEBUG) - ceparser.setDebugLevel(1); - parseok = ceparser.parse(testset.constraint); - CECompiler compiler = new CECompiler(); - ceroot = compiler.compile(dmr, ceparser.getCEAST()); - } catch (Exception e) { - e.printStackTrace(); - parseok = false; - } - if (ceroot == null) - parseok = false; - if (!parseok) - throw new Exception("CE Parse failed"); - - // Dump the parsed CE for comparison purposes - String cedump = ceroot.toConstraintString(); - if (prop_visual) - visual("|" + testset.constraint + "|", cedump); - results += (cedump + "\n"); - if (prop_diff) { // compare with baseline - // Read the baseline file - String baselinecontent = testset.expected; - pass = same(getTitle(), baselinecontent, results); - } - return pass; - } - - - //////////////////////////////////// - // Data for the tests - - String CE1_DMR = "" + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + " " + " " + " " + " " - + ""; - - - String CE2_DMR = "" + " " - + " " + " " + " " + " " + ""; -} diff --git a/dap4/d4tests/src/test/java/dap4/test/TestParserDMR.java b/dap4/d4tests/src/test/java/dap4/test/TestParserDMR.java deleted file mode 100644 index 39b0779c6e..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestParserDMR.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.test; - -import dap4.core.dmr.DMRFactory; -import dap4.core.dmr.DapDataset; -import dap4.core.dmr.ErrorResponse; -import dap4.core.dmr.parser.DOM4Parser; -import dap4.core.dmr.parser.Dap4Parser; -import dap4.core.dmr.parser.ParseUtil; -import dap4.dap4lib.DMRPrinter; -import org.junit.Assert; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.List; - - -public class TestParserDMR extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static final boolean PARSEDEBUG = false; - - // Do a special test to compare the dmr parser print output - // to the original input. This will often fail in non-essential - // ways, so it must be verified by hand. - static final boolean BACKCOMPARE = false; - - ////////////////////////////////////////////////// - // Constants - // Define the input set(s) - static protected final String DIR1 = "/TestParsers/dmrset"; // relative to dap4 root - static protected final String DIR2 = "/TestServlet/baseline"; // relative to dap4 root - static protected final String BASELINE = "/TestParsers/baseline"; // relative to dap4 root - - ////////////////////////////////////////////////// - - static protected class TestCase { - static public String resourceroot = null; - - String name; - String dir; - String ext; - String input; - String baseline; - - public TestCase(String dir, String name, String ext) { - this.name = name; - this.dir = dir; - this.ext = ext; - this.input = resourceroot + dir + "/" + name + "." + ext; - this.baseline = resourceroot + BASELINE + "/" + name + "." + "dmp"; - } - } - ////////////////////////////////////////////////// - // Instance methods - - // Test cases - protected List alltestcases = new ArrayList(); - protected List chosentests = new ArrayList(); - protected int flags = ParseUtil.FLAG_NONE; - protected boolean debug = false; - - ////////////////////////////////////////////////// - - public TestParserDMR() { - super(); - setControls(); - defineTestCases(); - chooseTestcases(); - } - - ////////////////////////////////////////////////// - // Misc. methods - - protected void chooseTestcases() { - if (false) { - chosentests = locate("test_struct_nested.hdf5"); - prop_visual = true; - assert chosentests.size() > 0 : "No tests chosen"; - } else { - for (TestCase tc : alltestcases) { - chosentests.add(tc); - } - } - } - - // Locate the test cases with given prefix - List locate(String prefix) { - List results = new ArrayList(); - for (TestCase ct : this.alltestcases) { - if (ct.name.startsWith(prefix)) - results.add(ct); - } - return results; - } - - protected void defineTestCases() { - String root = getResourceRoot(); - TestCase.resourceroot = root; - loadDir(DIR1, "dmr"); - loadDir(DIR2, "dmr"); - } - - void loadDir(String dirsuffix, String... extensions) { - File dir = new File(TestCase.resourceroot + dirsuffix); - File[] filelist = dir.listFiles(); - for (int i = 0; i < filelist.length; i++) { - File file = filelist[i]; - String name = file.getName(); - // check the extension - String match = null; - for (String ext : extensions) { - if (name.endsWith(ext)) { - match = ext; - break; - } - } - if (match != null) { - String basename = name.substring(0, name.length() - (match.length() + 1)); - TestCase ct = new TestCase(dirsuffix, basename, match); - addtestcase(ct); - } - } - } - - protected void addtestcase(TestCase ct) { - if (DEBUG) { - System.err.printf("Adding Test: input=%s%n", ct.input); - if (!new File(ct.input).exists()) - System.err.printf(" +++%s does not exist%n", ct.input); - System.err.printf(" baseline=%s%n", ct.baseline); - if (!new File(ct.baseline).exists()) - System.err.printf(" ***%s does not exist%n", ct.baseline); - System.err.flush(); - } - this.alltestcases.add(ct); - } - - void setControls() { - if (prop_controls == null) - return; - flags = ParseUtil.FLAG_NOCR; // always - for (int i = 0; i < prop_controls.length(); i++) { - char c = prop_controls.charAt(i); - switch (c) { - case 'w': - flags |= ParseUtil.FLAG_TRIMTEXT; - break; - case 'l': - flags |= ParseUtil.FLAG_ELIDETEXT; - break; - case 'e': - flags |= ParseUtil.FLAG_ESCAPE; - break; - case 'T': - flags |= ParseUtil.FLAG_TRACE; - break; - case 'd': - debug = true; - break; - default: - System.err.println("unknown X option: " + c); - break; - } - } - } - - ////////////////////////////////////////////////// - // Junit test method - - @Test - public void testParser() throws Exception { - int ntests = 0; - for (TestCase testcase : chosentests) { - ntests++; - doOneTest(testcase); - } - Assert.assertTrue("***Pass ", true); - } - - void doOneTest(TestCase testcase) throws Exception { - String document; - int i, c; - - String testinput = testcase.input; - String baseline = testcase.baseline; - - System.err.println("Testcase: " + testinput); - System.err.println("Baseline: " + baseline); - System.err.flush(); - - document = readfile(testinput); - - Dap4Parser parser = new DOM4Parser(new DMRFactory()); - if (PARSEDEBUG || debug) - parser.setDebugLevel(1); - - if (!parser.parse(document)) - throw new Exception("DMR Parse failed: " + testinput); - DapDataset dmr = parser.getDMR(); - ErrorResponse err = parser.getErrorResponse(); - if (err != null) - System.err.println("Error response:\n" + err.buildXML()); - if (dmr == null) { - System.err.println("No dataset created"); - return; - } - - // Dump the parsed DMR for comparison purposes - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DMRPrinter dapprinter = new DMRPrinter(dmr, pw); - dapprinter.testprint(); - pw.close(); - sw.close(); - String testresult = sw.toString(); - - // Read the baseline file - String baselinecontent; - if (BACKCOMPARE) - baselinecontent = document; - else - baselinecontent = readfile(baseline); - if (prop_visual) { - visual("Baseline", baselinecontent); - visual("Output", testresult); - } - - if (prop_baseline) { - writefile(baseline, testresult); - } else if (prop_diff) { // compare with baseline - Assert.assertTrue("Files are different", same(getTitle(), baselinecontent, testresult)); - } - } -} diff --git a/dap4/d4tests/src/test/java/dap4/test/TestPrinter.java b/dap4/d4tests/src/test/java/dap4/test/TestPrinter.java deleted file mode 100644 index d22ff1ac97..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestPrinter.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. - */ - -package dap4.test; - -import dap4.cdm.nc2.DapNetcdfFile; -import dap4.core.dmr.DapDataset; -import dap4.core.util.*; -import dap4.core.data.DSP; -import dap4.dap4lib.DMRPrinter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.*; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.invoke.MethodHandles; -import java.util.Map; - -/** - * Dump DMR and/or data part of a DSP - */ - -public class TestPrinter { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - ////////////////////////////////////////////////// - // Constants - - // Could use enumset, but it is so ugly, - // so use good old OR'able flags - static final int NILFLAGS = 0; - static final int PERLINE = 1; // print xml attributes 1 per line - static final int NONAME = 2; // do not print name xml attribute - static final int NONNIL = 4; // print empty xml attributes - - ////////////////////////////////////////////////// - // Instance Variables - - protected NetcdfFile ncfile = null; // dsp can be extracted from this - protected DSP dsp = null; - protected DapDataset dmr = null; - protected PrintWriter writer = null; - protected Map varmap = null; - protected IndentWriter printer = null; - - ////////////////////////////////////////////////// - // Constructor(s) - - public TestPrinter(NetcdfFile ncfile, PrintWriter writer) { - try { - setDataset(ncfile); - } catch (DapException de) { - System.err.println("Bad NetcdfFile"); - System.exit(1); - } - setWriter(writer); - setVarMap(null); - } - - public TestPrinter(DSP dsp, PrintWriter writer) { - try { - setDSP(dsp); - } catch (DapException de) { - System.err.println("Bad DSP"); - System.exit(1); - } - setWriter(writer); - setVarMap(null); - } - - ////////////////////////////////////////////////// - // Accessors - - public void setWriter(PrintWriter writer) { - this.writer = writer; - this.printer = new IndentWriter(writer); - } - - public void setDataset(NetcdfFile ncfile) throws DapException { - this.ncfile = ncfile; - setDSP(((DapNetcdfFile) this.ncfile).getDSP()); - } - - public void setDSP(DSP dsp) throws DapException { - this.dsp = dsp; - this.dmr = dsp.getDMR(); - } - - public void setVarMap(Map map) { - this.varmap = map; - } - - ////////////////////////////////////////////////// - // Print methods - - public void flush() throws IOException { - printer.flush(); - writer.flush(); - } - - /** - * Print the CDM metadata for a NetcdfFile object in DMR format - * - * @throws IOException - */ - - public void print() throws IOException { - printer.setIndent(0); - DMRPrinter dmrprinter = new DMRPrinter(this.dmr, writer); - dmrprinter.print(); - dmrprinter.flush(); - } - -} // class TestPrinter diff --git a/dap4/d4tests/src/test/java/dap4/test/TestSerial.java b/dap4/d4tests/src/test/java/dap4/test/TestSerial.java deleted file mode 100644 index 1bab343587..0000000000 --- a/dap4/d4tests/src/test/java/dap4/test/TestSerial.java +++ /dev/null @@ -1,302 +0,0 @@ -package dap4.test; - -import dap4.core.util.DapUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ucar.nc2.dataset.NetcdfDataset; -import ucar.unidata.util.test.TestDir; -import ucar.unidata.util.test.UnitTestCommon; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.List; - -/** - * Test at the NetcdfDataset level; access .ser files on server. - */ -public class TestSerial extends DapTestCommon { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - static protected final boolean DEBUG = false; - - static protected final String TESTINPUTDIR = "/testfiles"; - - static protected final boolean NCDUMP = true; // Use NcDumpW instead of D4Print - - static protected final String EXTENSION = (NCDUMP ? "ncdump" : "dmp"); - - static protected final String DAP4TAG = "#dap4"; - - static protected final String[] EMPTY = new String[] {""}; - - ////////////////////////////////////////////////// - // Constants - - static protected final String DATADIR = "src/test/data"; // relative to dap4 root - static protected final String TESTDATADIR = DATADIR + "/resources/TestCDMClient"; - static protected final String BASELINEDIR = TESTDATADIR + "/baseline"; - - static protected final String alpha = "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz".toUpperCase(); - - ////////////////////////////////////////////////// - // Type Declarations - - static protected class ClientTest { - static protected String root = null; - static protected String server = null; - - String title; - String dataset; - String baselinepath; - String[] constraints; - - ClientTest(String dataset) { - this(dataset, EMPTY); - } - - ClientTest(String dataset, String[] constraints) { - this.title = dataset; - this.dataset = dataset; - this.baselinepath = root + "/" + BASELINEDIR + "/" + dataset; - assert constraints != null && constraints.length > 0; - this.constraints = constraints; - } - - String makeurl(String ce) { - StringBuilder url = new StringBuilder(); - url.append("http://"); - url.append(this.server); - url.append("/d4ts"); - url.append("/"); - url.append(TESTINPUTDIR); - url.append("/"); - url.append(this.dataset); - url.append("."); - url.append("nc"); - url.append(DAP4TAG); - if (ce != null && ce.length() > 0) { - url.append("?"); - url.append(DapTestCommon.CONSTRAINTTAG); - url.append("="); - url.append(ce); - } - return url.toString(); - } - - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append(dataset); - buf.append("{"); - if (constraints != null) - for (int i = 0; i < constraints.length; i++) { - if (i > 0) - buf.append(","); - String ce = constraints[i]; - buf.append(ce == null ? "all" : ce); - } - buf.append("}"); - return buf.toString(); - } - } - - ////////////////////////////////////////////////// - // Instance variables - - // Test cases - - protected List alltestcases = new ArrayList(); - protected List chosentests = new ArrayList(); - - protected String resourceroot = null; - protected String datasetpath = null; - - protected String sourceurl = null; - - ////////////////////////////////////////////////// - - @Before - public void setup() throws Exception { - this.resourceroot = getResourceRoot(); - this.resourceroot = DapUtil.absolutize(this.resourceroot); - this.datasetpath = this.resourceroot + "/" + BASELINEDIR; - // findServer(this.datasetpath); - // this.sourceurl = this.d4tsserver; - this.sourceurl = TestDir.dap4TestServer; - System.out.println("Using source url " + this.sourceurl); - defineAllTestcases(this.resourceroot, this.sourceurl); - chooseTestcases(); - } - - ////////////////////////////////////////////////// - // Define test cases - - void chooseTestcases() { - if (false) { - chosentests = locate("test_atomic_array"); - } else { - for (ClientTest tc : alltestcases) { - chosentests.add(tc); - } - } - } - - void defineAllTestcases(String root, String server) { - ClientTest.root = root; - ClientTest.server = server; - alltestcases.add(new ClientTest("test_one_var")); - alltestcases.add(new ClientTest("test_atomic_types")); - alltestcases.add(new ClientTest("test_atomic_array")); - - } - - ////////////////////////////////////////////////// - // Junit test method - - @Test - public void testSerial() throws Exception { - for (ClientTest testcase : chosentests) { - if (!doOneTest(testcase)) { - Assert.assertTrue(false); - } - } - } - - ////////////////////////////////////////////////// - // Primary test method - boolean doOneTest(ClientTest testcase) throws Exception { - boolean pass = true; - int testcounter = 0; - - System.out.println("Testcase: " + testcase.dataset); - - String[] constraints = testcase.constraints; - for (int i = 0; i < constraints.length; i++) { - String url = testcase.makeurl(constraints[i]); - NetcdfDataset ncfile = null; - try { - ncfile = openDataset(url); - } catch (Exception e) { - throw e; - } - - String usethisname = UnitTestCommon.extractDatasetname(url, null); - String metadata = (NCDUMP ? ncdumpmetadata(ncfile, usethisname) : null); - String data = (NCDUMP ? ncdumpdata(ncfile, usethisname) : null); - - if (prop_visual) { - visual("DMR: " + url, metadata); - visual("DAP: " + url, data); - } - - String testoutput = (NCDUMP ? data : metadata + data); - - String baselinefile = String.format("%s.nc.%s", testcase.baselinepath, EXTENSION); - if (prop_baseline) - writefile(baselinefile, testoutput); - - if (prop_diff) { // compare with baseline - // Read the baseline file(s) - String baselinecontent = readfile(baselinefile); - System.out.println("Comparison:"); - pass = pass && same(getTitle(), baselinecontent, testoutput); - System.out.println(pass ? "Pass" : "Fail"); - } - } - return pass; - } - - ////////////////////////////////////////////////// - // Dump methods - - String ncdumpmetadata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - String metadata = null; - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Print the meta-databuffer using these args to NcdumpW - ok = false; - try { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - try { - sw.close(); - } catch (IOException e) { - } ; - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - return sw.toString(); - } - - String ncdumpdata(NetcdfDataset ncfile, String datasetname) { - boolean ok = false; - StringWriter sw = new StringWriter(); - - StringBuilder args = new StringBuilder("-strict -vall"); - if (datasetname != null) { - args.append(" -datasetname "); - args.append(datasetname); - } - - // Dump the databuffer - sw = new StringWriter(); - ok = false; - try { - ok = ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null); - } catch (IOException ioe) { - ioe.printStackTrace(); - ok = false; - } - try { - sw.close(); - } catch (IOException e) { - } ; - if (!ok) { - System.err.println("NcdumpW failed"); - System.exit(1); - } - return sw.toString(); - } - - ////////////////////////////////////////////////// - // Utility methods - - - // Locate the test cases with given prefix - ClientTest locate1(String prefix) { - List tests = locate(prefix); - assert tests.size() > 0; - return tests.get(0); - } - - // Locate the test cases with given prefix and optional constraint - List locate(String prefix) { - List results = new ArrayList(); - for (ClientTest ct : this.alltestcases) { - if (!ct.dataset.startsWith(prefix)) - continue; - results.add(ct); - } - return results; - } - - static protected boolean report(String msg) { - System.err.println(msg); - return false; - } - -} // class TestConstraints diff --git a/dap4/grammars/Makefile b/dap4/grammars/Makefile index 8e2617365b..67d679ca09 100644 --- a/dap4/grammars/Makefile +++ b/dap4/grammars/Makefile @@ -1,26 +1,26 @@ -/* -Note: The bison parser has been replaced by a DOM parser+walker. -The bison code is left in the build tree in case it is useful -elsewhere. -*. +#Note: The bison parser has been replaced by a DOM parser+walker. +#The bison code is left in the build tree in case it is useful +#elsewhere. -DAP4TARGET=../d4core/src/main/java/dap4/core/dmr/parser/bison/Dap4BisonParser.java -CETARGET=../d4core/src/main/java/dap4/core/ce/parser/CEBisonParser.java +DAP4TARGET=../src/main/java/dap4/core/dmr/parser/bison/Dap4BisonParser.java + +CETARGET=../src/main/java/dap4/core/ce/parser/CEBisonParser.java .PHONEY: bison -all: bison +all: dap4 ce # Requires bison 3.0 or later -bison: +dap4:: bison -v dap4.y -o Dap4BisonParser.java +# if test -f ${DAP4TARGET} ; then rm ${DAP4TARGET}; fi +# cp Dap4BisonParser.java ${DAP4TARGET} + +ce:: bison -v ce.y -o CEBisonParser.java - if test -f ${DAP4TARGET} ; then rm ${DAP4TARGET}; fi if test -f ${CETARGET} ; then rm ${CETARGET}; fi - cp Dap4BisonParser.java ${DAP4TARGET} cp CEBisonParser.java ${CETARGET} - clean:: rm -fr Dap4BisonParser.java Dap4BisonParser.output diff --git a/dap4/grammars/ce.y b/dap4/grammars/ce.y index 721b333790..96db9cd9ed 100644 --- a/dap4/grammars/ce.y +++ b/dap4/grammars/ce.y @@ -3,15 +3,15 @@ %language "Java" %debug -%error-verbose +%define parse.error verbose /* Comment out in case we are using an older version of bison %define api.push-pull pull */ -%define abstract -%define package {dap4.core.ce.parser} -%define parser_class_name {CEBisonParser} +%define api.parser.abstract +%define api.package {dap4.core.ce.parser} +%define api.parser.class {CEBisonParser} %define throws {ParseException} %define lex_throws {ParseException} @@ -60,7 +60,7 @@ abstract CEAST.SliceList slicelist(CEAST.SliceList list, Slice slice); %type slice subslice %type filter predicate %type dimredef -%type index +%type extent %type relop eqop %type clauselist %type segmentforest @@ -180,19 +180,19 @@ subslicelist: ; subslice: - index /* case 1 */ + extent /* case 1 */ {$$=subslice(1,$1,null,null);} - | index ':' index /* case 2 */ + | extent ':' extent /* case 2 */ {$$=subslice(2,$1,$3,null);} - | index ':' index ':' index /*case 3*/ + | extent ':' extent ':' extent /*case 3*/ {$$=subslice(3,$1,$5,$3);} - | index ':' /* case 4 */ + | extent ':' /* case 4 */ {$$=subslice(4,$1,null,null);} - | index ':' index ':' /* case 5 */ + | extent ':' extent ':' /* case 5 */ {$$=subslice(5,$1,null,$3);} ; -index: LONG ; +extent: LONG ; /* Semantics: The projection in a selection currently cannot have any diff --git a/dap4/d4core/src/main/java/dap4/core/ce/CEAST.java b/dap4/src/main/java/dap4/core/ce/CEAST.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/ce/CEAST.java rename to dap4/src/main/java/dap4/core/ce/CEAST.java diff --git a/dap4/d4core/src/main/java/dap4/core/ce/CECompiler.java b/dap4/src/main/java/dap4/core/ce/CECompiler.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/ce/CECompiler.java rename to dap4/src/main/java/dap4/core/ce/CECompiler.java diff --git a/dap4/d4core/src/main/java/dap4/core/ce/CEConstraint.java b/dap4/src/main/java/dap4/core/ce/CEConstraint.java similarity index 84% rename from dap4/d4core/src/main/java/dap4/core/ce/CEConstraint.java rename to dap4/src/main/java/dap4/core/ce/CEConstraint.java index 667cded009..d17a188e26 100644 --- a/dap4/d4core/src/main/java/dap4/core/ce/CEConstraint.java +++ b/dap4/src/main/java/dap4/core/ce/CEConstraint.java @@ -6,11 +6,11 @@ package dap4.core.ce; import dap4.core.ce.parser.CEParserImpl; -import dap4.core.data.Constraint; -import dap4.core.data.DataCursor; import dap4.core.dmr.*; import dap4.core.dmr.parser.ParseException; import dap4.core.util.*; +import dap4.dap4lib.D4Array; + import java.util.*; /** @@ -77,7 +77,7 @@ * inverse of iteration and that is fairly tricky. */ -public class CEConstraint implements Constraint { +public class CEConstraint { ////////////////////////////////////////////////// // Constants @@ -97,8 +97,6 @@ protected static enum Expand { NONE, EXPANDED, CONTRACTED } - ; - protected static class Segment { DapVariable var; List slices; // projection slices for this variable @@ -142,109 +140,6 @@ public String toString() { } } - /* - * static protected class ReferenceIterator implements Iterator - * { - * - * ////////////////////////////////////////////////// - * // Instance Variables - * - * List list = new ArrayList<>(); - * Iterator listiter = null; - ** - * - * @param ce the constraint over which to iterate - * - * @throws DapException - * - * public ReferenceIterator(CEConstraint ce) - * throws DapException - * { - * list.addAll(ce.dimrefs); - * list.addAll(ce.enums); - * list.addAll(ce.variables); - * listiter = list.iterator(); - * } - * - * ////////////////////////////////////////////////// - * // Iterator Interface - * - * public boolean hasNext() - * { - * return listiter.hasNext(); - * } - * - * public DapNode next() - * { - * return listiter.next(); - * } - * - * public void remove() - * { - * throw new UnsupportedOperationException(); - * } - * - * } - * - * static protected class FilterIterator implements Iterator - * { - * protected DapSequence seq; - * protected DataCursor data; - * protected long nrecords; - * protected CEAST filter; - * - * protected int recno; - * protected DataCursor current; - * CEConstraint ce; - * - * public FilterIterator(CEConstraint ce, DapSequence seq, DataCursor data, CEAST filter) - * { - * this.ce = ce; - * this.filter = filter; - * this.seq = seq; - * this.data = data; - * this.nrecords = data.getRecordCount(); - * this.recno = 0; // actually recno of next record to read - * this.current = null; - * } - * - * // Iterator interface - * public boolean hasNext() - * { - * if(recno < nrecords) - * return false; - * try { - * // look for next matching record starting at recno - * if(filter == null) { - * this.current = data.getRecord(this.recno); - * this.recno++; - * return true; - * } else for(;recno < nrecords;recno++) { - * this.current = data.getRecord(this.recno); - * if(ce.matches(this.seq, this.current, filter)) - * return true; - * } - * } catch (DapException de) { - * return false; - * } - * this.current = null; - * return false; - * } - * - * public DataCursor next() - * { - * if(this.recno >= nrecords || this.current == null) - * throw new NoSuchElementException(); - * return this.current; - * } - * - * public void remove() - * { - * throw new UnsupportedOperationException(); - * } - * } - */ - ////////////////////////////////////////////////// // class variables and methods @@ -268,22 +163,6 @@ public static void release(DapDataset dmr) { universals.remove(dmr); } - protected static DataCursor fieldValue(DapVariable sqvar, DapSequence seq, DataCursor record, String field) - throws DapException { - DapVariable dapv = seq.findByName(field); - if (dapv == null) - throw new DapException("Unknown variable in filter: " + field); - if (!dapv.isAtomic()) - throw new DapException("Non-atomic variable in filter: " + field); - if (dapv.getRank() > 0) - throw new DapException("Non-scalar variable in filter: " + field); - int fieldindex = seq.indexByName(field); - DataCursor da = (DataCursor) (record.readField(fieldindex)); - if (da == null) - throw new DapException("No such field: " + field); - return da; - } - protected static int compare(Object lvalue, Object rvalue) throws DapException { if (lvalue instanceof String && rvalue instanceof String) return ((String) lvalue).compareTo((String) rvalue); @@ -312,14 +191,14 @@ protected static int compare(Object lvalue, Object rvalue) throws DapException { * @throws DapException * @return the value of the expression (usually a Boolean) */ - protected Object eval(DapVariable var, DapSequence seq, DataCursor record, CEAST expr) throws DapException { + protected Object eval(DapVariable var, DapSequence seq, D4Array record, CEAST expr) throws DapException { switch (expr.sort) { case CONSTANT: return expr.value; case SEGMENT: - return fieldValue(var, seq, record, expr.name); + return null; // ???return fieldValue(var, seq, record, expr.name); case EXPR: Object lhs = eval(var, seq, record, expr.lhs); @@ -618,56 +497,6 @@ public boolean references(DapNode node) { return isref; } - /** - * Reference X Iterator - * Iterate over the variables and return - * those that are referenced. The order of - * return is preorder. - * Inputs: - * 1. the variable whose slices are to be iterated. - * - * @return ReferenceIterator - * @throws DapException if could not create. - */ - /* - * public ReferenceIterator - * referenceIterator() - * throws DapException - * { - * return new ReferenceIterator(this); - * } - */ - - ////////////////////////////////////////////////// - // Projection processing - - /** - * Projection X match - * This is actually rather difficult because it requires - * sort of the inverse of an odometer. For this reason, - * It's implementation is deferred. - */ - - /** - * Projection X Iterator - * This basically returns an odometer that - * will iterate over the appropriate values. - * - * @param var over whose dimensions to iterate - * @throws DapException - */ - /* - * public Odometer - * projectionIterator(DapVariable var) - * throws DapException - * { - * Segment seg = findSegment(var); - * if(seg == null) - * return null; - * return Odometer.factory(seg.slices, seg.dimset, false); - * } - */ - ////////////////////////////////////////////////// // Selection (Filter) processing @@ -682,7 +511,7 @@ public boolean references(DapNode node) { * @throws DapException * @return true if the filter matches the record */ - public boolean match(DapVariable sqvar, DapSequence seq, DataCursor rec) throws DapException { + public boolean match(DapVariable sqvar, DapSequence seq, D4Array rec) throws DapException { Segment sseq = findSegment(sqvar); if (sseq == null) return false; @@ -703,7 +532,7 @@ public boolean match(DapVariable sqvar, DapSequence seq, DataCursor rec) throws * @return true if a match * @throws DapException */ - protected boolean matches(DapVariable var, DapSequence seq, DataCursor rec, CEAST filter) throws DapException { + protected boolean matches(DapVariable var, DapSequence seq, D4Array rec, CEAST filter) throws DapException { Object value = eval(var, seq, rec, filter); return ((Boolean) value); } @@ -947,7 +776,7 @@ protected void computedimensions() throws DapException { if (newdim == null) newdim = dim0; // fill in the undefined last value - slice.setMaxSize(newdim.getSize()); + slice.setMaxSize((int) newdim.getSize()); slice.finish(); Slice newslice = null; if (slice.isConstrained()) { diff --git a/dap4/d4core/src/main/java/dap4/core/ce/Universal.java b/dap4/src/main/java/dap4/core/ce/Universal.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/ce/Universal.java rename to dap4/src/main/java/dap4/core/ce/Universal.java diff --git a/dap4/d4core/src/main/java/dap4/core/ce/parser/CEActions.java b/dap4/src/main/java/dap4/core/ce/parser/CEActions.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/ce/parser/CEActions.java rename to dap4/src/main/java/dap4/core/ce/parser/CEActions.java diff --git a/dap4/d4core/src/main/java/dap4/core/ce/parser/CEBisonParser.java b/dap4/src/main/java/dap4/core/ce/parser/CEBisonParser.java similarity index 50% rename from dap4/d4core/src/main/java/dap4/core/ce/parser/CEBisonParser.java rename to dap4/src/main/java/dap4/core/ce/parser/CEBisonParser.java index 8a6e4be3d1..61cc21b4a1 100644 --- a/dap4/d4core/src/main/java/dap4/core/ce/parser/CEBisonParser.java +++ b/dap4/src/main/java/dap4/core/ce/parser/CEBisonParser.java @@ -1,9 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* * Skeleton implementation for Bison LALR(1) parsers in Java * - * Copyright (C) 2007-2015 Free Software Foundation, Inc. + * Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /* @@ -34,20 +34,26 @@ * version 2.2 of Bison. */ +/* + * DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + * especially those whose name start with YY_ or yy_. They are + * private implementation details that can be changed or removed. + */ + package dap4.core.ce.parser; -/* First part of user declarations. */ -/* "CEBisonParser.java":37 */ /* lalr1.java:91 */ -/* "CEBisonParser.java":39 */ /* lalr1.java:92 */ + +import java.text.MessageFormat; +import java.util.ArrayList; /* "%code imports" blocks. */ -/* "ce.y":18 */ /* lalr1.java:93 */ +/* "ce.y":18 */ import dap4.core.util.Slice; import dap4.core.dmr.parser.ParseException; import dap4.core.ce.CEAST; -/* "CEBisonParser.java":47 */ /* lalr1.java:93 */ +/* "CEBisonParser.java":51 */ /** * A Bison parser, automatically generated from ce.y. @@ -56,19 +62,20 @@ */ abstract class CEBisonParser { /** Version number for the Bison executable that generated this parser. */ - public static final String bisonVersion = "3.0.4"; + public static final String bisonVersion = "3.8.2"; /** Name of the skeleton that generated this parser. */ public static final String bisonSkeleton = "lalr1.java"; + /** * True if verbose error messages are enabled. */ private boolean yyErrorVerbose = true; /** - * Return whether verbose error messages are enabled. + * Whether verbose error messages are enabled. */ public final boolean getErrorVerbose() { return yyErrorVerbose; @@ -85,28 +92,162 @@ public final void setErrorVerbose(boolean verbose) { + public enum SymbolKind { + S_YYEOF(0), /* "end of file" */ + S_YYerror(1), /* error */ + S_YYUNDEF(2), /* "invalid token" */ + S_NAME(3), /* NAME */ + S_STRING(4), /* STRING */ + S_LONG(5), /* LONG */ + S_DOUBLE(6), /* DOUBLE */ + S_BOOLEAN(7), /* BOOLEAN */ + S_8_(8), /* ',' */ + S_NOT(9), /* NOT */ + S_10_(10), /* ';' */ + S_11_(11), /* '.' */ + S_12_(12), /* '{' */ + S_13_(13), /* '}' */ + S_14_(14), /* '[' */ + S_15_(15), /* ']' */ + S_16_(16), /* ':' */ + S_17_(17), /* '|' */ + S_18_(18), /* '!' */ + S_19_(19), /* '<' */ + S_20_(20), /* '=' */ + S_21_(21), /* '>' */ + S_22_(22), /* '~' */ + S_23_(23), /* '(' */ + S_24_(24), /* ')' */ + S_YYACCEPT(25), /* $accept */ + S_constraint(26), /* constraint */ + S_dimredeflist(27), /* dimredeflist */ + S_clauselist(28), /* clauselist */ + S_clause(29), /* clause */ + S_projection(30), /* projection */ + S_segmenttree(31), /* segmenttree */ + S_segmentforest(32), /* segmentforest */ + S_segment(33), /* segment */ + S_slicelist(34), /* slicelist */ + S_slice(35), /* slice */ + S_subslicelist(36), /* subslicelist */ + S_subslice(37), /* subslice */ + S_extent(38), /* extent */ + S_selection(39), /* selection */ + S_filter(40), /* filter */ + S_predicate(41), /* predicate */ + S_relop(42), /* relop */ + S_eqop(43), /* eqop */ + S_primary(44), /* primary */ + S_dimredef(45), /* dimredef */ + S_fieldname(46), /* fieldname */ + S_constant(47); /* constant */ + + + private final int yycode_; + + SymbolKind(int n) { + this.yycode_ = n; + } + + private static final SymbolKind[] values_ = {SymbolKind.S_YYEOF, SymbolKind.S_YYerror, SymbolKind.S_YYUNDEF, + SymbolKind.S_NAME, SymbolKind.S_STRING, SymbolKind.S_LONG, SymbolKind.S_DOUBLE, SymbolKind.S_BOOLEAN, + SymbolKind.S_8_, SymbolKind.S_NOT, SymbolKind.S_10_, SymbolKind.S_11_, SymbolKind.S_12_, SymbolKind.S_13_, + SymbolKind.S_14_, SymbolKind.S_15_, SymbolKind.S_16_, SymbolKind.S_17_, SymbolKind.S_18_, SymbolKind.S_19_, + SymbolKind.S_20_, SymbolKind.S_21_, SymbolKind.S_22_, SymbolKind.S_23_, SymbolKind.S_24_, SymbolKind.S_YYACCEPT, + SymbolKind.S_constraint, SymbolKind.S_dimredeflist, SymbolKind.S_clauselist, SymbolKind.S_clause, + SymbolKind.S_projection, SymbolKind.S_segmenttree, SymbolKind.S_segmentforest, SymbolKind.S_segment, + SymbolKind.S_slicelist, SymbolKind.S_slice, SymbolKind.S_subslicelist, SymbolKind.S_subslice, + SymbolKind.S_extent, SymbolKind.S_selection, SymbolKind.S_filter, SymbolKind.S_predicate, SymbolKind.S_relop, + SymbolKind.S_eqop, SymbolKind.S_primary, SymbolKind.S_dimredef, SymbolKind.S_fieldname, SymbolKind.S_constant}; + + static final SymbolKind get(int code) { + return values_[code]; + } + + public final int getCode() { + return this.yycode_; + } + + /* + * Return YYSTR after stripping away unnecessary quotes and + * backslashes, so that it's suitable for yyerror. The heuristic is + * that double-quoting is unnecessary unless the string contains an + * apostrophe, a comma, or backslash (other than backslash-backslash). + * YYSTR is taken from yytname. + */ + private static String yytnamerr_(String yystr) { + if (yystr.charAt(0) == '"') { + StringBuffer yyr = new StringBuffer(); + strip_quotes: for (int i = 1; i < yystr.length(); i++) + switch (yystr.charAt(i)) { + case '\'': + case ',': + break strip_quotes; + + case '\\': + if (yystr.charAt(++i) != '\\') + break strip_quotes; + /* Fall through. */ + default: + yyr.append(yystr.charAt(i)); + break; + + case '"': + return yyr.toString(); + } + } + return yystr; + } + + /* + * YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + * First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. + */ + private static final String[] yytname_ = yytname_init(); + + private static final String[] yytname_init() { + return new String[] {"\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING", "LONG", "DOUBLE", + "BOOLEAN", "','", "NOT", "';'", "'.'", "'{'", "'}'", "'['", "']'", "':'", "'|'", "'!'", "'<'", "'='", "'>'", + "'~'", "'('", "')'", "$accept", "constraint", "dimredeflist", "clauselist", "clause", "projection", + "segmenttree", "segmentforest", "segment", "slicelist", "slice", "subslicelist", "subslice", "extent", + "selection", "filter", "predicate", "relop", "eqop", "primary", "dimredef", "fieldname", "constant", null}; + } + + /* The user-facing name of this symbol. */ + public final String getName() { + return yytnamerr_(yytname_[yycode_]); + } + + }; + + /** * Communication interface between the scanner and the Bison-generated * parser CEBisonParser. */ public interface Lexer { - /** Token returned by the scanner to signal the end of its input. */ - public static final int EOF = 0; - - /* Tokens. */ - /** Token number,to be returned by the scanner. */ + /* Token kinds. */ + /** Token "end of file", to be returned by the scanner. */ + static final int YYEOF = 0; + /** Token error, to be returned by the scanner. */ + static final int YYerror = 256; + /** Token "invalid token", to be returned by the scanner. */ + static final int YYUNDEF = 257; + /** Token NAME, to be returned by the scanner. */ static final int NAME = 258; - /** Token number,to be returned by the scanner. */ + /** Token STRING, to be returned by the scanner. */ static final int STRING = 259; - /** Token number,to be returned by the scanner. */ + /** Token LONG, to be returned by the scanner. */ static final int LONG = 260; - /** Token number,to be returned by the scanner. */ + /** Token DOUBLE, to be returned by the scanner. */ static final int DOUBLE = 261; - /** Token number,to be returned by the scanner. */ + /** Token BOOLEAN, to be returned by the scanner. */ static final int BOOLEAN = 262; - /** Token number,to be returned by the scanner. */ + /** Token NOT, to be returned by the scanner. */ static final int NOT = 263; + /** Deprecated, use YYEOF instead. */ + public static final int EOF = YYEOF; /** @@ -126,15 +267,17 @@ public interface Lexer { int yylex() throws ParseException; /** - * Entry point for error reporting. Emits an error - * in a user-defined way. + * Emit an errorin a user-defined way. + * * - * * @param msg The string for the error message. */ void yyerror(String msg); + + } + /** * The object doing lexical analysis for us. */ @@ -153,11 +296,11 @@ public CEBisonParser(Lexer yylexer) { } + private java.io.PrintStream yyDebugStream = System.err; /** - * Return the PrintStream on which the debugging output is - * printed. + * The PrintStream on which the debugging output is printed. */ public final java.io.PrintStream getDebugStream() { return yyDebugStream; @@ -192,6 +335,16 @@ public final void setDebugLevel(int level) { yydebug = level; } + + private int yynerrs = 0; + + /** + * The number of syntax errors so far. + */ + public final int getNumberOfErrors() { + return yynerrs; + } + /** * Print an error message via the lexer. * @@ -202,14 +355,18 @@ public final void yyerror(String msg) { } + protected final void yycdebugNnl(String s) { + if (0 < yydebug) + yyDebugStream.print(s); + } + protected final void yycdebug(String s) { - if (yydebug > 0) + if (0 < yydebug) yyDebugStream.println(s); } private final class YYStack { private int[] stateStack = new int[16]; - private Object[] valueStack = new Object[16]; public int size = 16; @@ -222,7 +379,6 @@ public final void push(int state, Object value) { System.arraycopy(stateStack, 0, newStateStack, 0, height); stateStack = newStateStack; - Object[] newValueStack = new Object[size * 2]; System.arraycopy(valueStack, 0, newValueStack, 0, height); valueStack = newValueStack; @@ -231,7 +387,6 @@ public final void push(int state, Object value) { } stateStack[height] = state; - valueStack[height] = value; } @@ -241,9 +396,8 @@ public final void pop() { public final void pop(int num) { // Avoid memory leaks... garbage collection is a white lie! - if (num > 0) { + if (0 < num) { java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null); - } height -= num; } @@ -304,7 +458,7 @@ public void print(java.io.PrintStream out) { /** - * Return whether error recovery is being done. In this state, the parser + * Whether error recovery is being done. In this state, the parser * reads token until it reaches a known state, and then restarts normal * operation. */ @@ -318,18 +472,15 @@ public final boolean recovering() { * @param yystate the current state * @param yysym the nonterminal to push on the stack */ - private int yy_lr_goto_state_(int yystate, int yysym) { - int yyr = yypgoto_[yysym - yyntokens_] + yystate; - if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + private int yyLRGotoState(int yystate, int yysym) { + int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate; + if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate) return yytable_[yyr]; else - return yydefgoto_[yysym - yyntokens_]; + return yydefgoto_[yysym - YYNTOKENS_]; } private int yyaction(int yyn, YYStack yystack, int yylen) throws ParseException { - Object yyval; - - /* * If YYLEN is nonzero, implement the default value of the action: * '$$ = $1'. Otherwise, use the top of the stack. @@ -338,467 +489,430 @@ private int yyaction(int yyn, YYStack yystack, int yylen) throws ParseException * This behavior is undocumented and Bison * users should not rely upon it. */ - if (yylen > 0) - yyval = yystack.valueAt(yylen - 1); - else - yyval = yystack.valueAt(0); + Object yyval = (0 < yylen) ? yystack.valueAt(yylen - 1) : yystack.valueAt(0); - yy_reduce_print(yyn, yystack); + yyReducePrint(yyn, yystack); switch (yyn) { - case 2: + case 2: /* constraint: dimredeflist clauselist */ if (yyn == 2) - /* "ce.y":103 */ /* lalr1.java:489 */ + /* "ce.y":103 */ { - yyval = constraint(((CEAST.NodeList) (yystack.valueAt(2 - (2))))); + yyval = constraint(((CEAST.NodeList) (yystack.valueAt(0)))); } ; break; - case 5: + case 5: /* clauselist: clause */ if (yyn == 5) - /* "ce.y":113 */ /* lalr1.java:489 */ + /* "ce.y":113 */ { - yyval = nodelist(null, ((CEAST) (yystack.valueAt(1 - (1))))); + yyval = nodelist(null, ((CEAST) (yystack.valueAt(0)))); } ; break; - case 6: + case 6: /* clauselist: clauselist ';' clause */ if (yyn == 6) - /* "ce.y":115 */ /* lalr1.java:489 */ + /* "ce.y":115 */ { - yyval = nodelist(((CEAST.NodeList) (yystack.valueAt(3 - (1)))), ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = nodelist(((CEAST.NodeList) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 9: + case 9: /* projection: segmenttree */ if (yyn == 9) - /* "ce.y":133 */ /* lalr1.java:489 */ + /* "ce.y":133 */ { - yyval = projection(((CEAST) (yystack.valueAt(1 - (1))))); + yyval = projection(((CEAST) (yystack.valueAt(0)))); } ; break; - case 10: + case 10: /* segmenttree: segment */ if (yyn == 10) - /* "ce.y":138 */ /* lalr1.java:489 */ + /* "ce.y":138 */ { - yyval = segmenttree(null, ((CEAST) (yystack.valueAt(1 - (1))))); + yyval = segmenttree(null, ((CEAST) (yystack.valueAt(0)))); } ; break; - case 11: + case 11: /* segmenttree: segmenttree '.' segment */ if (yyn == 11) - /* "ce.y":140 */ /* lalr1.java:489 */ + /* "ce.y":140 */ { - yyval = segmenttree(((CEAST) (yystack.valueAt(3 - (1)))), ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = segmenttree(((CEAST) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 12: + case 12: /* segmenttree: segmenttree '.' '{' segmentforest '}' */ if (yyn == 12) - /* "ce.y":142 */ /* lalr1.java:489 */ + /* "ce.y":142 */ { - yyval = segmenttree(((CEAST) (yystack.valueAt(5 - (1)))), ((CEAST.NodeList) (yystack.valueAt(5 - (4))))); + yyval = segmenttree(((CEAST) (yystack.valueAt(4))), ((CEAST.NodeList) (yystack.valueAt(1)))); } ; break; - case 13: + case 13: /* segmenttree: segmenttree '{' segmentforest '}' */ if (yyn == 13) - /* "ce.y":144 */ /* lalr1.java:489 */ + /* "ce.y":144 */ { - yyval = segmenttree(((CEAST) (yystack.valueAt(4 - (1)))), ((CEAST.NodeList) (yystack.valueAt(4 - (3))))); + yyval = segmenttree(((CEAST) (yystack.valueAt(3))), ((CEAST.NodeList) (yystack.valueAt(1)))); } ; break; - case 14: + case 14: /* segmentforest: segmenttree */ if (yyn == 14) - /* "ce.y":149 */ /* lalr1.java:489 */ + /* "ce.y":149 */ { - yyval = nodelist(null, ((CEAST) (yystack.valueAt(1 - (1))))); + yyval = nodelist(null, ((CEAST) (yystack.valueAt(0)))); } ; break; - case 15: + case 15: /* segmentforest: segmentforest ',' segmenttree */ if (yyn == 15) - /* "ce.y":151 */ /* lalr1.java:489 */ + /* "ce.y":151 */ { - yyval = nodelist(((CEAST.NodeList) (yystack.valueAt(3 - (1)))), ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = nodelist(((CEAST.NodeList) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 16: + case 16: /* segment: NAME */ if (yyn == 16) - /* "ce.y":156 */ /* lalr1.java:489 */ + /* "ce.y":156 */ { - yyval = segment(((String) (yystack.valueAt(1 - (1)))), null); + yyval = segment(((String) (yystack.valueAt(0))), null); } ; break; - case 17: + case 17: /* segment: NAME slicelist */ if (yyn == 17) - /* "ce.y":158 */ /* lalr1.java:489 */ + /* "ce.y":158 */ { - yyval = segment(((String) (yystack.valueAt(2 - (1)))), ((CEAST.SliceList) (yystack.valueAt(2 - (2))))); + yyval = segment(((String) (yystack.valueAt(1))), ((CEAST.SliceList) (yystack.valueAt(0)))); } ; break; - case 18: + case 18: /* slicelist: slice */ if (yyn == 18) - /* "ce.y":163 */ /* lalr1.java:489 */ + /* "ce.y":163 */ { - yyval = slicelist(null, ((Slice) (yystack.valueAt(1 - (1))))); + yyval = slicelist(null, ((Slice) (yystack.valueAt(0)))); } ; break; - case 19: + case 19: /* slicelist: slicelist slice */ if (yyn == 19) - /* "ce.y":165 */ /* lalr1.java:489 */ + /* "ce.y":165 */ { - yyval = slicelist(((CEAST.SliceList) (yystack.valueAt(2 - (1)))), ((Slice) (yystack.valueAt(2 - (2))))); + yyval = slicelist(((CEAST.SliceList) (yystack.valueAt(1))), ((Slice) (yystack.valueAt(0)))); } ; break; - case 20: + case 20: /* slice: '[' ']' */ if (yyn == 20) - /* "ce.y":170 */ /* lalr1.java:489 */ + /* "ce.y":170 */ { yyval = slice(null); } ; break; - case 21: + case 21: /* slice: '[' subslicelist ']' */ if (yyn == 21) - /* "ce.y":172 */ /* lalr1.java:489 */ + /* "ce.y":172 */ { - yyval = slice(((CEAST.SliceList) (yystack.valueAt(3 - (2))))); + yyval = slice(((CEAST.SliceList) (yystack.valueAt(1)))); } ; break; - case 22: + case 22: /* subslicelist: subslice */ if (yyn == 22) - /* "ce.y":177 */ /* lalr1.java:489 */ + /* "ce.y":177 */ { - yyval = slicelist(null, ((Slice) (yystack.valueAt(1 - (1))))); + yyval = slicelist(null, ((Slice) (yystack.valueAt(0)))); } ; break; - case 23: + case 23: /* subslicelist: subslicelist ',' subslice */ if (yyn == 23) - /* "ce.y":179 */ /* lalr1.java:489 */ + /* "ce.y":179 */ { - yyval = slicelist(((CEAST.SliceList) (yystack.valueAt(3 - (1)))), ((Slice) (yystack.valueAt(3 - (3))))); + yyval = slicelist(((CEAST.SliceList) (yystack.valueAt(2))), ((Slice) (yystack.valueAt(0)))); } ; break; - case 24: + case 24: /* subslice: extent */ if (yyn == 24) - /* "ce.y":184 */ /* lalr1.java:489 */ + /* "ce.y":184 */ { - yyval = subslice(1, ((String) (yystack.valueAt(1 - (1)))), null, null); + yyval = subslice(1, ((String) (yystack.valueAt(0))), null, null); } ; break; - case 25: + case 25: /* subslice: extent ':' extent */ if (yyn == 25) - /* "ce.y":186 */ /* lalr1.java:489 */ + /* "ce.y":186 */ { - yyval = subslice(2, ((String) (yystack.valueAt(3 - (1)))), ((String) (yystack.valueAt(3 - (3)))), null); + yyval = subslice(2, ((String) (yystack.valueAt(2))), ((String) (yystack.valueAt(0))), null); } ; break; - case 26: + case 26: /* subslice: extent ':' extent ':' extent */ if (yyn == 26) - /* "ce.y":188 */ /* lalr1.java:489 */ + /* "ce.y":188 */ { - yyval = subslice(3, ((String) (yystack.valueAt(5 - (1)))), ((String) (yystack.valueAt(5 - (5)))), - ((String) (yystack.valueAt(5 - (3))))); + yyval = subslice(3, ((String) (yystack.valueAt(4))), ((String) (yystack.valueAt(0))), + ((String) (yystack.valueAt(2)))); } ; break; - case 27: + case 27: /* subslice: extent ':' */ if (yyn == 27) - /* "ce.y":190 */ /* lalr1.java:489 */ + /* "ce.y":190 */ { - yyval = subslice(4, ((String) (yystack.valueAt(2 - (1)))), null, null); + yyval = subslice(4, ((String) (yystack.valueAt(1))), null, null); } ; break; - case 28: + case 28: /* subslice: extent ':' extent ':' */ if (yyn == 28) - /* "ce.y":192 */ /* lalr1.java:489 */ + /* "ce.y":192 */ { - yyval = subslice(5, ((String) (yystack.valueAt(4 - (1)))), null, ((String) (yystack.valueAt(4 - (3))))); + yyval = subslice(5, ((String) (yystack.valueAt(3))), null, ((String) (yystack.valueAt(1)))); } ; break; - case 30: + case 30: /* selection: segmenttree '|' filter */ if (yyn == 30) - /* "ce.y":203 */ /* lalr1.java:489 */ + /* "ce.y":203 */ { - yyval = selection(((CEAST) (yystack.valueAt(3 - (1)))), ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = selection(((CEAST) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 32: + case 32: /* filter: predicate ',' predicate */ if (yyn == 32) - /* "ce.y":209 */ /* lalr1.java:489 */ + /* "ce.y":209 */ { - yyval = logicalAnd(((CEAST) (yystack.valueAt(3 - (1)))), ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = logicalAnd(((CEAST) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 33: + case 33: /* filter: '!' predicate */ if (yyn == 33) - /* "ce.y":211 */ /* lalr1.java:489 */ + /* "ce.y":211 */ { - yyval = logicalNot(((CEAST) (yystack.valueAt(2 - (2))))); + yyval = logicalNot(((CEAST) (yystack.valueAt(0)))); } ; break; - case 34: + case 34: /* predicate: primary relop primary */ if (yyn == 34) - /* "ce.y":216 */ /* lalr1.java:489 */ + /* "ce.y":216 */ { - yyval = predicate(((CEAST.Operator) (yystack.valueAt(3 - (2)))), ((CEAST) (yystack.valueAt(3 - (1)))), - ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = predicate(((CEAST.Operator) (yystack.valueAt(1))), ((CEAST) (yystack.valueAt(2))), + ((CEAST) (yystack.valueAt(0)))); } ; break; - case 35: + case 35: /* predicate: primary relop primary relop primary */ if (yyn == 35) - /* "ce.y":218 */ /* lalr1.java:489 */ + /* "ce.y":218 */ { - yyval = predicaterange(((CEAST.Operator) (yystack.valueAt(5 - (2)))), - ((CEAST.Operator) (yystack.valueAt(5 - (4)))), ((CEAST) (yystack.valueAt(5 - (1)))), - ((CEAST) (yystack.valueAt(5 - (3)))), ((CEAST) (yystack.valueAt(5 - (5))))); + yyval = predicaterange(((CEAST.Operator) (yystack.valueAt(3))), ((CEAST.Operator) (yystack.valueAt(1))), + ((CEAST) (yystack.valueAt(4))), ((CEAST) (yystack.valueAt(2))), ((CEAST) (yystack.valueAt(0)))); } ; break; - case 36: + case 36: /* predicate: primary eqop primary */ if (yyn == 36) - /* "ce.y":220 */ /* lalr1.java:489 */ + /* "ce.y":220 */ { - yyval = predicate(((CEAST.Operator) (yystack.valueAt(3 - (2)))), ((CEAST) (yystack.valueAt(3 - (1)))), - ((CEAST) (yystack.valueAt(3 - (3))))); + yyval = predicate(((CEAST.Operator) (yystack.valueAt(1))), ((CEAST) (yystack.valueAt(2))), + ((CEAST) (yystack.valueAt(0)))); } ; break; - case 37: + case 37: /* relop: '<' '=' */ if (yyn == 37) - /* "ce.y":224 */ /* lalr1.java:489 */ + /* "ce.y":224 */ { yyval = CEAST.Operator.LE; } ; break; - case 38: + case 38: /* relop: '>' '=' */ if (yyn == 38) - /* "ce.y":225 */ /* lalr1.java:489 */ + /* "ce.y":225 */ { yyval = CEAST.Operator.GE; } ; break; - case 39: + case 39: /* relop: '<' */ if (yyn == 39) - /* "ce.y":226 */ /* lalr1.java:489 */ + /* "ce.y":226 */ { yyval = CEAST.Operator.LT; } ; break; - case 40: + case 40: /* relop: '>' */ if (yyn == 40) - /* "ce.y":227 */ /* lalr1.java:489 */ + /* "ce.y":227 */ { yyval = CEAST.Operator.GT; } ; break; - case 41: + case 41: /* eqop: '=' '=' */ if (yyn == 41) - /* "ce.y":231 */ /* lalr1.java:489 */ + /* "ce.y":231 */ { yyval = CEAST.Operator.EQ; } ; break; - case 42: + case 42: /* eqop: '!' '=' */ if (yyn == 42) - /* "ce.y":232 */ /* lalr1.java:489 */ + /* "ce.y":232 */ { yyval = CEAST.Operator.NEQ; } ; break; - case 43: + case 43: /* eqop: '~' '=' */ if (yyn == 43) - /* "ce.y":233 */ /* lalr1.java:489 */ + /* "ce.y":233 */ { yyval = CEAST.Operator.REQ; } ; break; - case 46: + case 46: /* primary: '(' predicate ')' */ if (yyn == 46) - /* "ce.y":239 */ /* lalr1.java:489 */ + /* "ce.y":239 */ { - yyval = ((CEAST) (yystack.valueAt(3 - (2)))); + yyval = ((CEAST) (yystack.valueAt(1))); } ; break; - case 47: + case 47: /* dimredef: NAME '=' slice */ if (yyn == 47) - /* "ce.y":245 */ /* lalr1.java:489 */ + /* "ce.y":245 */ { yyval = null; - dimredef(((String) (yystack.valueAt(3 - (1)))), ((Slice) (yystack.valueAt(3 - (3))))); + dimredef(((String) (yystack.valueAt(2))), ((Slice) (yystack.valueAt(0)))); } ; break; - case 48: + case 48: /* fieldname: NAME */ if (yyn == 48) - /* "ce.y":249 */ /* lalr1.java:489 */ + /* "ce.y":249 */ { - yyval = fieldname(((String) (yystack.valueAt(1 - (1))))); + yyval = fieldname(((String) (yystack.valueAt(0)))); } ; break; - case 49: + case 49: /* constant: STRING */ if (yyn == 49) - /* "ce.y":253 */ /* lalr1.java:489 */ + /* "ce.y":253 */ { - yyval = constant(CEAST.Constant.STRING, ((String) (yystack.valueAt(1 - (1))))); + yyval = constant(CEAST.Constant.STRING, ((String) (yystack.valueAt(0)))); } ; break; - case 50: + case 50: /* constant: LONG */ if (yyn == 50) - /* "ce.y":254 */ /* lalr1.java:489 */ + /* "ce.y":254 */ { - yyval = constant(CEAST.Constant.LONG, ((String) (yystack.valueAt(1 - (1))))); + yyval = constant(CEAST.Constant.LONG, ((String) (yystack.valueAt(0)))); } ; break; - case 51: + case 51: /* constant: DOUBLE */ if (yyn == 51) - /* "ce.y":255 */ /* lalr1.java:489 */ + /* "ce.y":255 */ { - yyval = constant(CEAST.Constant.DOUBLE, ((String) (yystack.valueAt(1 - (1))))); + yyval = constant(CEAST.Constant.DOUBLE, ((String) (yystack.valueAt(0)))); } ; break; - case 52: + case 52: /* constant: BOOLEAN */ if (yyn == 52) - /* "ce.y":256 */ /* lalr1.java:489 */ + /* "ce.y":256 */ { - yyval = constant(CEAST.Constant.BOOLEAN, ((String) (yystack.valueAt(1 - (1))))); + yyval = constant(CEAST.Constant.BOOLEAN, ((String) (yystack.valueAt(0)))); } ; break; - /* "CEBisonParser.java":643 */ /* lalr1.java:489 */ + /* "CEBisonParser.java":825 */ + default: break; } - yy_symbol_print("-> $$ =", yyr1_[yyn], yyval); + yySymbolPrint("-> $$ =", SymbolKind.get(yyr1_[yyn]), yyval); yystack.pop(yylen); yylen = 0; - /* Shift the result of the reduction. */ - int yystate = yy_lr_goto_state_(yystack.stateAt(0), yyr1_[yyn]); + int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]); yystack.push(yystate, yyval); return YYNEWSTATE; } - /* - * Return YYSTR after stripping away unnecessary quotes and - * backslashes, so that it's suitable for yyerror. The heuristic is - * that double-quoting is unnecessary unless the string contains an - * apostrophe, a comma, or backslash (other than backslash-backslash). - * YYSTR is taken from yytname. - */ - private final String yytnamerr_(String yystr) { - if (yystr.charAt(0) == '"') { - StringBuffer yyr = new StringBuffer(); - strip_quotes: for (int i = 1; i < yystr.length(); i++) - switch (yystr.charAt(i)) { - case '\'': - case ',': - break strip_quotes; - - case '\\': - if (yystr.charAt(++i) != '\\') - break strip_quotes; - /* Fall through. */ - default: - yyr.append(yystr.charAt(i)); - break; - - case '"': - return yyr.toString(); - } - } else if (yystr.equals("$end")) - return "end of input"; - - return yystr; - } - - /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ - private void yy_symbol_print(String s, int yytype, Object yyvaluep) { - if (yydebug > 0) - yycdebug(s + (yytype < yyntokens_ ? " token " : " nterm ") + yytname_[yytype] + " (" - + (yyvaluep == null ? "(null)" : yyvaluep.toString()) + ")"); + private void yySymbolPrint(String s, SymbolKind yykind, Object yyvalue) { + if (0 < yydebug) { + yycdebug(s + (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ") + yykind.getName() + " (" + + (yyvalue == null ? "(null)" : yyvalue.toString()) + ")"); + } } @@ -814,10 +928,10 @@ public boolean parse() throws ParseException, ParseException { - - /* Lookahead and lookahead in internal form. */ - int yychar = yyempty_; - int yytoken = 0; + /* Lookahead token kind. */ + int yychar = YYEMPTY_; + /* Lookahead symbol kind. */ + SymbolKind yytoken = null; /* State. */ int yyn = 0; @@ -826,15 +940,16 @@ public boolean parse() throws ParseException, ParseException YYStack yystack = new YYStack(); int label = YYNEWSTATE; - /* Error handling. */ - int yynerrs_ = 0; /* Semantic value of the lookahead. */ Object yylval = null; - yycdebug("Starting parse\n"); + + + yycdebug("Starting parse"); yyerrstatus_ = 0; + yynerrs = 0; /* Initialize the stack. */ yystack.push(yystate, yylval); @@ -848,76 +963,81 @@ public boolean parse() throws ParseException, ParseException * pushed when we come here. */ case YYNEWSTATE: - yycdebug("Entering state " + yystate + "\n"); - if (yydebug > 0) + yycdebug("Entering state " + yystate); + if (0 < yydebug) yystack.print(yyDebugStream); /* Accept? */ - if (yystate == yyfinal_) + if (yystate == YYFINAL_) return true; /* Take a decision. First try without lookahead. */ yyn = yypact_[yystate]; - if (yy_pact_value_is_default_(yyn)) { + if (yyPactValueIsDefault(yyn)) { label = YYDEFAULT; break; } /* Read a lookahead token. */ - if (yychar == yyempty_) { + if (yychar == YYEMPTY_) { - - yycdebug("Reading a token: "); + yycdebug("Reading a token"); yychar = yylexer.yylex(); yylval = yylexer.getLVal(); } /* Convert token to internal form. */ - if (yychar <= Lexer.EOF) { - yychar = yytoken = Lexer.EOF; - yycdebug("Now at end of input.\n"); + yytoken = yytranslate_(yychar); + yySymbolPrint("Next token is", yytoken, yylval); + + if (yytoken == SymbolKind.S_YYerror) { + // The scanner already issued an error message, process directly + // to error recovery. But do not keep the error token as + // lookahead, it is too special and may lead us to an endless + // loop in error recovery. */ + yychar = Lexer.YYUNDEF; + yytoken = SymbolKind.S_YYUNDEF; + label = YYERRLAB1; } else { - yytoken = yytranslate_(yychar); - yy_symbol_print("Next token is", yytoken, yylval); - } + /* + * If the proper action on seeing token YYTOKEN is to reduce or to + * detect an error, take that action. + */ + yyn += yytoken.getCode(); + if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode()) { + label = YYDEFAULT; + } - /* - * If the proper action on seeing token YYTOKEN is to reduce or to - * detect an error, take that action. - */ - yyn += yytoken; - if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) - label = YYDEFAULT; + /* <= 0 means reduce or error. */ + else if ((yyn = yytable_[yyn]) <= 0) { + if (yyTableValueIsError(yyn)) { + label = YYERRLAB; + } else { + yyn = -yyn; + label = YYREDUCE; + } + } - /* <= 0 means reduce or error. */ - else if ((yyn = yytable_[yyn]) <= 0) { - if (yy_table_value_is_error_(yyn)) - label = YYERRLAB; else { - yyn = -yyn; - label = YYREDUCE; + /* Shift the lookahead token. */ + yySymbolPrint("Shifting", yytoken, yylval); + + /* Discard the token being shifted. */ + yychar = YYEMPTY_; + + /* + * Count tokens shifted since error; after three, turn off error + * status. + */ + if (yyerrstatus_ > 0) + --yyerrstatus_; + + yystate = yyn; + yystack.push(yystate, yylval); + label = YYNEWSTATE; } } - - else { - /* Shift the lookahead token. */ - yy_symbol_print("Shifting", yytoken, yylval); - - /* Discard the token being shifted. */ - yychar = yyempty_; - - /* - * Count tokens shifted since error; after three, turn off error - * status. - */ - if (yyerrstatus_ > 0) - --yyerrstatus_; - - yystate = yyn; - yystack.push(yystate, yylval); - label = YYNEWSTATE; - } break; /*-----------------------------------------------------------. @@ -946,25 +1066,24 @@ else if ((yyn = yytable_[yyn]) <= 0) { case YYERRLAB: /* If not already recovering from an error, report this error. */ if (yyerrstatus_ == 0) { - ++yynerrs_; - if (yychar == yyempty_) - yytoken = yyempty_; - yyerror(yysyntax_error(yystate, yytoken)); + ++yynerrs; + if (yychar == YYEMPTY_) + yytoken = null; + yyreportSyntaxError(new Context(this, yystack, yytoken)); } - if (yyerrstatus_ == 3) { /* * If just tried and failed to reuse lookahead token after an * error, discard it. */ - if (yychar <= Lexer.EOF) { + if (yychar <= Lexer.YYEOF) { /* Return failure if at end of input. */ - if (yychar == Lexer.EOF) + if (yychar == Lexer.YYEOF) return false; } else - yychar = yyempty_; + yychar = YYEMPTY_; } /* @@ -978,8 +1097,6 @@ else if ((yyn = yytable_[yyn]) <= 0) { | errorlab -- error raised explicitly by YYERROR. | `-------------------------------------------------*/ case YYERROR: - - /* * Do not reclaim the symbols of the rule which action triggered * this YYERROR. @@ -996,11 +1113,12 @@ else if ((yyn = yytable_[yyn]) <= 0) { case YYERRLAB1: yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + // Pop stack until we find a state that shifts the error token. for (;;) { yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_(yyn)) { - yyn += yyterror_; - if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) { + if (!yyPactValueIsDefault(yyn)) { + yyn += SymbolKind.S_YYerror.getCode(); + if (0 <= yyn && yyn <= YYLAST_ && yycheck_[yyn] == SymbolKind.S_YYerror.getCode()) { yyn = yytable_[yyn]; if (0 < yyn) break; @@ -1017,7 +1135,7 @@ else if ((yyn = yytable_[yyn]) <= 0) { yystack.pop(); yystate = yystack.stateAt(0); - if (yydebug > 0) + if (0 < yydebug) yystack.print(yyDebugStream); } @@ -1028,7 +1146,7 @@ else if ((yyn = yytable_[yyn]) <= 0) { /* Shift the error token. */ - yy_symbol_print("Shifting", yystos_[yyn], yylval); + yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]), yylval); yystate = yyn; yystack.push(yyn, yylval); @@ -1047,73 +1165,153 @@ else if ((yyn = yytable_[yyn]) <= 0) { - // Generate an error message. - private String yysyntax_error(int yystate, int tok) { - if (yyErrorVerbose) { - /* - * There are many possibilities here to consider: - * - If this state is a consistent state with a default action, - * then the only way this function was invoked is if the - * default action is an error action. In that case, don't - * check for expected tokens because there are none. - * - The only way there can be no lookahead present (in tok) is - * if this state is a consistent state with a default action. - * Thus, detecting the absence of a lookahead is sufficient to - * determine that there is no unexpected or expected token to - * report. In that case, just report a simple "syntax error". - * - Don't assume there isn't a lookahead just because this - * state is a consistent state with a default action. There - * might have been a previous inconsistent state, consistent - * state with a non-default action, or user semantic action - * that manipulated yychar. (However, yychar is currently out - * of scope during semantic actions.) - * - Of course, the expected token list depends on states to - * have correct lookahead information, and it depends on the - * parser not to perform extra reductions after fetching a - * lookahead from the scanner and before detecting a syntax - * error. Thus, state merging (from LALR or IELR) and default - * reductions corrupt the expected token list. However, the - * list is correct for canonical LR with one exception: it - * will still contain any token that will not be accepted due - * to an error action in a later state. - */ - if (tok != yyempty_) { + /** + * Information needed to get the list of expected tokens and to forge + * a syntax error diagnostic. + */ + public static final class Context { + Context(CEBisonParser parser, YYStack stack, SymbolKind token) { + yyparser = parser; + yystack = stack; + yytoken = token; + } + + private CEBisonParser yyparser; + private YYStack yystack; + + + /** + * The symbol kind of the lookahead token. + */ + public final SymbolKind getToken() { + return yytoken; + } + + private SymbolKind yytoken; + static final int NTOKENS = CEBisonParser.YYNTOKENS_; + + /** + * Put in YYARG at most YYARGN of the expected tokens given the + * current YYCTX, and return the number of tokens stored in YYARG. If + * YYARG is null, return the number of expected tokens (guaranteed to + * be less than YYNTOKENS). + */ + int getExpectedTokens(SymbolKind yyarg[], int yyargn) { + return getExpectedTokens(yyarg, 0, yyargn); + } + + int getExpectedTokens(SymbolKind yyarg[], int yyoffset, int yyargn) { + int yycount = yyoffset; + int yyn = yypact_[this.yystack.stateAt(0)]; + if (!yyPactValueIsDefault(yyn)) { /* - * FIXME: This method of building the message is not compatible - * with internationalization. + * Start YYX at -YYN if negative to avoid negative + * indexes in YYCHECK. In other words, skip the first + * -YYN actions for this state because they are default + * actions. */ - StringBuffer res = new StringBuffer("syntax error, unexpected "); - res.append(yytnamerr_(yytname_[tok])); - int yyn = yypact_[yystate]; - if (!yy_pact_value_is_default_(yyn)) { - /* - * Start YYX at -YYN if negative to avoid negative - * indexes in YYCHECK. In other words, skip the first - * -YYN actions for this state because they are default - * actions. - */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = yylast_ - yyn + 1; - int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; - int count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yyterror_ && !yy_table_value_is_error_(yytable_[x + yyn])) - ++count; - if (count < 5) { - count = 0; - for (int x = yyxbegin; x < yyxend; ++x) - if (yycheck_[x + yyn] == x && x != yyterror_ && !yy_table_value_is_error_(yytable_[x + yyn])) { - res.append(count++ == 0 ? ", expecting " : " or "); - res.append(yytnamerr_(yytname_[x])); - } + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST_ - yyn + 1; + int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != SymbolKind.S_YYerror.getCode() + && !yyTableValueIsError(yytable_[yyx + yyn])) { + if (yyarg == null) + yycount += 1; + else if (yycount == yyargn) + return 0; // FIXME: this is incorrect. + else + yyarg[yycount++] = SymbolKind.get(yyx); } - } - return res.toString(); } + if (yyarg != null && yycount == yyoffset && yyoffset < yyargn) + yyarg[yycount] = null; + return yycount - yyoffset; } + } + + - return "syntax error"; + private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) { + /* + * There are many possibilities here to consider: + * - If this state is a consistent state with a default action, + * then the only way this function was invoked is if the + * default action is an error action. In that case, don't + * check for expected tokens because there are none. + * - The only way there can be no lookahead present (in tok) is + * if this state is a consistent state with a default action. + * Thus, detecting the absence of a lookahead is sufficient to + * determine that there is no unexpected or expected token to + * report. In that case, just report a simple "syntax error". + * - Don't assume there isn't a lookahead just because this + * state is a consistent state with a default action. There + * might have been a previous inconsistent state, consistent + * state with a non-default action, or user semantic action + * that manipulated yychar. (However, yychar is currently out + * of scope during semantic actions.) + * - Of course, the expected token list depends on states to + * have correct lookahead information, and it depends on the + * parser not to perform extra reductions after fetching a + * lookahead from the scanner and before detecting a syntax + * error. Thus, state merging (from LALR or IELR) and default + * reductions corrupt the expected token list. However, the + * list is correct for canonical LR with one exception: it + * will still contain any token that will not be accepted due + * to an error action in a later state. + */ + int yycount = 0; + if (yyctx.getToken() != null) { + if (yyarg != null) + yyarg[yycount] = yyctx.getToken(); + yycount += 1; + yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn); + } + return yycount; + } + + + /** + * Build and emit a "syntax error" message in a user-defined way. + * + * @param ctx The context of the error. + */ + private void yyreportSyntaxError(Context yyctx) { + if (yyErrorVerbose) { + final int argmax = 5; + SymbolKind[] yyarg = new SymbolKind[argmax]; + int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax); + String[] yystr = new String[yycount]; + for (int yyi = 0; yyi < yycount; ++yyi) { + yystr[yyi] = yyarg[yyi].getName(); + } + String yyformat; + switch (yycount) { + default: + case 0: + yyformat = "syntax error"; + break; + case 1: + yyformat = "syntax error, unexpected {0}"; + break; + case 2: + yyformat = "syntax error, unexpected {0}, expecting {1}"; + break; + case 3: + yyformat = "syntax error, unexpected {0}, expecting {1} or {2}"; + break; + case 4: + yyformat = "syntax error, unexpected {0}, expecting {1} or {2} or {3}"; + break; + case 5: + yyformat = "syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"; + break; + } + yyerror(new MessageFormat(yyformat).format(yystr)); + } else { + yyerror("syntax error"); + } } /** @@ -1121,7 +1319,7 @@ private String yysyntax_error(int yystate, int tok) { * * @param yyvalue the value to check */ - private static boolean yy_pact_value_is_default_(int yyvalue) { + private static boolean yyPactValueIsDefault(int yyvalue) { return yyvalue == yypact_ninf_; } @@ -1131,7 +1329,7 @@ private static boolean yy_pact_value_is_default_(int yyvalue) { * * @param yyvalue the value to check */ - private static boolean yy_table_value_is_error_(int yyvalue) { + private static boolean yyTableValueIsError(int yyvalue) { return yyvalue == yytable_ninf_; } @@ -1142,7 +1340,7 @@ private static boolean yy_table_value_is_error_(int yyvalue) { * YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing * STATE-NUM. */ - private static final byte yypact_[] = yypact_init(); + private static final byte[] yypact_ = yypact_init(); private static final byte[] yypact_init() { return new byte[] {-47, 40, 18, -47, -5, 23, 17, -47, -47, 26, -47, -47, 15, -5, -47, 35, -47, 50, 21, 50, -1, -47, @@ -1156,7 +1354,7 @@ private static final byte[] yypact_init() { * Performed when YYTABLE does not specify something else to do. Zero * means the default is an error. */ - private static final byte yydefact_[] = yydefact_init(); + private static final byte[] yydefact_ = yydefact_init(); private static final byte[] yydefact_init() { return new byte[] {3, 0, 0, 1, 16, 0, 2, 5, 7, 9, 10, 8, 0, 17, 18, 0, 4, 0, 0, 0, 0, 29, 20, 0, 22, 24, 19, 0, 6, @@ -1165,7 +1363,7 @@ private static final byte[] yydefact_init() { } /* YYPGOTO[NTERM-NUM]. */ - private static final byte yypgoto_[] = yypgoto_init(); + private static final byte[] yypgoto_ = yypgoto_init(); private static final byte[] yypgoto_init() { return new byte[] {-47, -47, -47, -47, 49, -47, -19, 32, 52, -47, -2, -47, 24, -46, -47, -47, -31, 0, -47, -42, -47, @@ -1173,10 +1371,10 @@ private static final byte[] yypgoto_init() { } /* YYDEFGOTO[NTERM-NUM]. */ - private static final byte yydefgoto_[] = yydefgoto_init(); + private static final byte[] yydefgoto_ = yydefgoto_init(); private static final byte[] yydefgoto_init() { - return new byte[] {-1, 1, 2, 6, 7, 8, 9, 32, 10, 13, 14, 23, 24, 25, 11, 40, 41, 60, 61, 42, 16, 43, 44}; + return new byte[] {0, 1, 2, 6, 7, 8, 9, 32, 10, 13, 14, 23, 24, 25, 11, 40, 41, 60, 61, 42, 16, 43, 44}; } /* @@ -1184,7 +1382,7 @@ private static final byte[] yydefgoto_init() { * positive, shift that token. If negative, reduce the rule whose * number is the opposite. If YYTABLE_NINF, syntax error. */ - private static final byte yytable_[] = yytable_init(); + private static final byte[] yytable_ = yytable_init(); private static final byte[] yytable_init() { return new byte[] {31, 63, 33, 34, 35, 36, 37, 52, 53, 12, 31, 26, 33, 34, 35, 36, 37, 38, 73, 74, 21, 4, 39, 67, 4, @@ -1192,7 +1390,7 @@ private static final byte[] yytable_init() { 58, 27, 54, 47, 21, 68, 66, 49, 69, 70, 71, 72, 28, 75, 0, 62, 30, 0, 0, 76}; } - private static final byte yycheck_[] = yycheck_init(); + private static final byte[] yycheck_ = yycheck_init(); private static final byte[] yycheck_init() { return new byte[] {19, 47, 3, 4, 5, 6, 7, 38, 39, 14, 29, 13, 3, 4, 5, 6, 7, 18, 60, 61, 5, 3, 23, 54, 3, 27, 3, 10, @@ -1201,10 +1399,10 @@ private static final byte[] yycheck_init() { } /* - * YYSTOS[STATE-NUM] -- The (internal number of the) accessing - * symbol of state STATE-NUM. + * YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + * state STATE-NUM. */ - private static final byte yystos_[] = yystos_init(); + private static final byte[] yystos_ = yystos_init(); private static final byte[] yystos_init() { return new byte[] {0, 26, 27, 0, 3, 10, 28, 29, 30, 31, 33, 39, 14, 34, 35, 3, 45, 10, 11, 12, 17, 5, 15, 36, 37, @@ -1212,8 +1410,8 @@ private static final byte[] yystos_init() { 18, 19, 20, 21, 22, 42, 43, 37, 38, 13, 31, 24, 41, 20, 20, 20, 20, 20, 44, 44, 16, 42, 38, 44}; } - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ - private static final byte yyr1_[] = yyr1_init(); + /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ + private static final byte[] yyr1_ = yyr1_init(); private static final byte[] yyr1_init() { return new byte[] {0, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, @@ -1221,41 +1419,18 @@ private static final byte[] yyr1_init() { 47}; } - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ - private static final byte yyr2_[] = yyr2_init(); + /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ + private static final byte[] yyr2_ = yyr2_init(); private static final byte[] yyr2_init() { return new byte[] {0, 2, 2, 0, 3, 1, 3, 1, 1, 1, 1, 3, 5, 4, 1, 3, 1, 2, 1, 2, 2, 3, 1, 3, 1, 3, 5, 2, 4, 1, 3, 1, 3, 2, 3, 5, 3, 2, 2, 1, 1, 2, 2, 2, 1, 1, 3, 3, 1, 1, 1, 1, 1}; } - /* - * YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding - * to YYLEX-NUM. - */ - private static final short yytoken_number_[] = yytoken_number_init(); - private static final short[] yytoken_number_init() { - return new short[] {0, 256, 257, 258, 259, 260, 261, 262, 44, 263, 59, 46, 123, 125, 91, 93, 58, 124, 33, 60, 61, - 62, 126, 40, 41}; - } - - /* - * YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - * First, the terminals, then, starting at \a yyntokens_, nonterminals. - */ - private static final String yytname_[] = yytname_init(); - - private static final String[] yytname_init() { - return new String[] {"$end", "error", "$undefined", "NAME", "STRING", "LONG", "DOUBLE", "BOOLEAN", "','", "NOT", - "';'", "'.'", "'{'", "'}'", "'['", "']'", "':'", "'|'", "'!'", "'<'", "'='", "'>'", "'~'", "'('", "')'", - "$accept", "constraint", "dimredeflist", "clauselist", "clause", "projection", "segmenttree", "segmentforest", - "segment", "slicelist", "slice", "subslicelist", "subslice", "index", "selection", "filter", "predicate", - "relop", "eqop", "primary", "dimredef", "fieldname", "constant", null}; - } /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ - private static final short yyrline_[] = yyrline_init(); + private static final short[] yyrline_ = yyrline_init(); private static final short[] yyrline_init() { return new short[] {0, 101, 101, 106, 108, 112, 114, 119, 120, 132, 137, 139, 141, 143, 148, 150, 155, 157, 162, @@ -1265,23 +1440,37 @@ private static final short[] yyrline_init() { // Report on the debug stream that the rule yyrule is going to be reduced. - private void yy_reduce_print(int yyrule, YYStack yystack) { + private void yyReducePrint(int yyrule, YYStack yystack) { if (yydebug == 0) return; int yylno = yyrline_[yyrule]; int yynrhs = yyr2_[yyrule]; /* Print the symbols being reduced, and their result. */ - yycdebug("Reducing stack by rule " + (yyrule - 1) + " (line " + yylno + "), "); + yycdebug("Reducing stack by rule " + (yyrule - 1) + " (line " + yylno + "):"); /* The symbols being reduced. */ for (int yyi = 0; yyi < yynrhs; yyi++) - yy_symbol_print(" $" + (yyi + 1) + " =", yystos_[yystack.stateAt(yynrhs - (yyi + 1))], - ((yystack.valueAt(yynrhs - (yyi + 1))))); + yySymbolPrint(" $" + (yyi + 1) + " =", SymbolKind.get(yystos_[yystack.stateAt(yynrhs - (yyi + 1))]), + yystack.valueAt((yynrhs) - (yyi + 1))); } - /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - private static final byte yytranslate_table_[] = yytranslate_table_init(); + /* + * YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + * as returned by yylex, with out-of-bounds checking. + */ + private static final SymbolKind yytranslate_(int t) { + // Last valid token kind. + int code_max = 263; + if (t <= 0) + return SymbolKind.S_YYEOF; + else if (t <= code_max) + return SymbolKind.get(yytranslate_table_[t]); + else + return SymbolKind.S_YYUNDEF; + } + + private static final byte[] yytranslate_table_ = yytranslate_table_init(); private static final byte[] yytranslate_table_init() { return new byte[] {0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1294,27 +1483,14 @@ private static final byte[] yytranslate_table_init() { 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 9}; } - private static final byte yytranslate_(int t) { - if (t >= 0 && t <= yyuser_token_number_max_) - return yytranslate_table_[t]; - else - return yyundef_token_; - } - private static final int yylast_ = 73; - private static final int yynnts_ = 23; - private static final int yyempty_ = -2; - private static final int yyfinal_ = 3; - private static final int yyterror_ = 1; - private static final int yyerrcode_ = 256; - private static final int yyntokens_ = 25; + private static final int YYLAST_ = 73; + private static final int YYEMPTY_ = -2; + private static final int YYFINAL_ = 3; + private static final int YYNTOKENS_ = 25; - private static final int yyuser_token_number_max_ = 263; - private static final int yyundef_token_ = 2; - - /* User implementation code. */ /* Unqualified %code blocks. */ - /* "ce.y":24 */ /* lalr1.java:1066 */ + /* "ce.y":24 */ // Provide accessors for the parser lexer @@ -1325,7 +1501,7 @@ Lexer getLexer() { void setLexer(Lexer lexer) { this.yylexer = lexer; } - /* "ce.y":31 */ /* lalr1.java:1066 */ + /* "ce.y":31 */ // Abstract Parser actions abstract CEAST constraint(CEAST.NodeList clauses) throws ParseException; @@ -1364,7 +1540,6 @@ abstract CEAST predicaterange(CEAST.Operator op1, CEAST.Operator op2, CEAST lhs, abstract CEAST.SliceList slicelist(CEAST.SliceList list, Slice slice); - /* "CEBisonParser.java":1350 */ /* lalr1.java:1066 */ + /* "CEBisonParser.java":1534 */ } - diff --git a/dap4/d4core/src/main/java/dap4/core/ce/parser/CELexer.java b/dap4/src/main/java/dap4/core/ce/parser/CELexer.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/ce/parser/CELexer.java rename to dap4/src/main/java/dap4/core/ce/parser/CELexer.java diff --git a/dap4/d4core/src/main/java/dap4/core/ce/parser/CEParserImpl.java b/dap4/src/main/java/dap4/core/ce/parser/CEParserImpl.java similarity index 98% rename from dap4/d4core/src/main/java/dap4/core/ce/parser/CEParserImpl.java rename to dap4/src/main/java/dap4/core/ce/parser/CEParserImpl.java index 51e89238ad..429a776d7a 100644 --- a/dap4/d4core/src/main/java/dap4/core/ce/parser/CEParserImpl.java +++ b/dap4/src/main/java/dap4/core/ce/parser/CEParserImpl.java @@ -157,7 +157,7 @@ Slice subslice(int state, String sfirst, String send, String sstride) throws Par Slice x; try { - x = new Slice(first, stop, stride); + x = new Slice((int) first, (int) stop, (int) stride); } catch (DapException de) { throw new ParseException(de); } @@ -203,7 +203,7 @@ void dimredef(String name, Slice slice) throws ParseException { throw new ParseException("Attempt to redefine a non-existent shared dimension: " + name); // Verify that the slice is consistent with the shared dimension try { - slice.setMaxSize(dim.getSize()); + slice.setMaxSize((int) dim.getSize()); slice.finish(); } catch (DapException de) { throw new ParseException(de); diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DMRFactory.java b/dap4/src/main/java/dap4/core/dmr/DMRFactory.java similarity index 98% rename from dap4/d4core/src/main/java/dap4/core/dmr/DMRFactory.java rename to dap4/src/main/java/dap4/core/dmr/DMRFactory.java index b72dfcce3e..bb43efd184 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DMRFactory.java +++ b/dap4/src/main/java/dap4/core/dmr/DMRFactory.java @@ -43,7 +43,7 @@ public DapDimension newDimension(String name, long size) { return node; } - public DapMap newMap(DapVariable target) { + public DapMap newMap(String target) { DapMap node = new DapMap(target); if (DEBUG) debug(node); diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DMRPrinter.java b/dap4/src/main/java/dap4/core/dmr/DMRPrinter.java similarity index 75% rename from dap4/d4lib/src/main/java/dap4/dap4lib/DMRPrinter.java rename to dap4/src/main/java/dap4/core/dmr/DMRPrinter.java index 57823889c2..c11bb910b2 100644 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/DMRPrinter.java +++ b/dap4/src/main/java/dap4/core/dmr/DMRPrinter.java @@ -3,13 +3,17 @@ * See the LICENSE file for more information. */ -package dap4.dap4lib; +package dap4.core.dmr; import dap4.core.ce.CEConstraint; -import dap4.core.dmr.*; import dap4.core.util.*; + import java.io.IOException; +import java.io.PrintStream; import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.ByteOrder; +import java.util.EnumSet; import java.util.List; import java.util.Map; @@ -43,6 +47,41 @@ public class DMRPrinter { public static final boolean ALLOWFIELDMAPS = false; + static public final String XMLDOCUMENTHEADER = ""; + + ////////////////////////////////////////////////// + // Types + + public enum Controls { + RESERVED; // print reserved attributes + } + + ////////////////////////////////////////////////// + // Static Methods + static public void print(DapDataset dmr, PrintStream stream) { + try { + PrintWriter pw = new PrintWriter(stream); + new DMRPrinter(dmr, pw).print(); + pw.close(); + } catch (IOException ioe) { + } ; + } + + static public String printAsString(DapDataset dmr) { + String s = null; + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + new DMRPrinter(dmr, pw).print(); + pw.close(); + s = sw.toString(); + sw.close(); + } catch (IOException ioe) { + s = null; + } ; + return s; + } + ////////////////////////////////////////////////// // Instance Variables @@ -51,7 +90,13 @@ public class DMRPrinter { protected DapDataset dmr = null; protected CEConstraint ce = null; protected ResponseFormat format = null; - protected boolean testing = false; + protected DapContext cxt = null; + // Following extracted from context + protected ByteOrder order = null; + protected Map localchecksummap = null; + protected Map remotechecksummap = null; + + protected EnumSet controls = EnumSet.noneOf(Controls.class); ////////////////////////////////////////////////// // Constructor(s) @@ -63,12 +108,20 @@ public DMRPrinter(DapDataset dmr, PrintWriter writer) { } public DMRPrinter(DapDataset dmr, CEConstraint ce, PrintWriter writer, ResponseFormat format) { + this(dmr, ce, writer, format, null); + } + + public DMRPrinter(DapDataset dmr, CEConstraint ce, PrintWriter writer, ResponseFormat format, DapContext cxt) { this(); this.dmr = dmr; - this.ce = ce; + this.ce = (ce == null ? CEConstraint.getUniversal(dmr) : ce); this.writer = writer; this.printer = new IndentWriter(writer); this.format = (format == null ? ResponseFormat.XML : format); + this.cxt = (cxt == null ? new DapContext() : cxt); + this.order = (ByteOrder) this.cxt.get(DapConstants.DAP4ENDIANTAG); + this.localchecksummap = (Map) this.cxt.get("localchecksummap"); + this.remotechecksummap = (Map) this.cxt.get("remotechecksummap"); } ////////////////////////////////////////////////// @@ -85,6 +138,10 @@ public void close() { ////////////////////////////////////////////////// // External API + public void setControl(Controls ctl) { + this.controls.add(ctl); + } + /** * Print a DapDataset: * - as DMR @@ -94,25 +151,11 @@ public void close() { */ public void print() throws IOException { - if (this.ce == null) - this.ce = CEConstraint.getUniversal(dmr); - assert (this.ce != null); this.printer.setIndent(0); - printNode(dmr); // start printing at the root - printer.eol(); - } - - - /** - * Same as print() except certain items of - * information are suppressed. - * - * @throws IOException - */ - - public void testprint() throws IOException { - this.testing = true; - print(); + // Print XML Document Header + this.printer.marginPrintln(XMLDOCUMENTHEADER); + if (printNode(dmr)) // start printing at the root + printer.eol(); } ////////////////////////////////////////////////// @@ -133,21 +176,34 @@ public void testprint() throws IOException { * printDimrefs, printMaps * * @param node - the node to print + * @return true if anything was printed -- needed to control eol output * @throws IOException Note that the PrintWriter is global. */ - public void printNode(DapNode node) throws IOException { + public boolean printNode(DapNode node) throws IOException { if (node == null) - return; + return false; + // Do first level suppression check DapSort sort = node.getSort(); + switch (sort) { + case DATASET: + case GROUP: + case DIMENSION: + case ENUMERATION: + case VARIABLE: + if (!this.ce.references(node)) + return false; + break; + default: + break; + } + String dmrname = sort.getName(); switch (sort) { case DATASET:// treat like group case GROUP: - if (!this.ce.references(node)) - break; DapGroup group = (DapGroup) node; printer.marginPrint("<" + dmrname); int flags = (sort == DapSort.DATASET ? PERLINE : NILFLAGS); @@ -159,47 +215,46 @@ public void printNode(DapNode node) throws IOException { for (DapNode subnode : group.getDimensions()) { if (!this.ce.references(subnode)) continue; - printNode(subnode); - printer.eol(); + if (printNode(subnode)) + printer.eol(); } } if (group.getEnums().size() > 0) { for (DapNode subnode : group.getEnums()) { if (!this.ce.references(subnode)) continue; - printNode(subnode); - printer.eol(); + if (printNode(subnode)) + printer.eol(); } } if (group.getVariables().size() > 0) for (DapNode subnode : group.getVariables()) { if (!this.ce.references(subnode)) continue; - printNode(subnode); - printer.eol(); + if (printNode(subnode)) + printer.eol(); } printMetadata(node); - if (group.getGroups().size() > 0) + if (group.getGroups().size() > 0) { for (DapNode subnode : group.getGroups()) { if (!this.ce.references(subnode)) continue; - printNode(subnode); - printer.eol(); + if (printNode(subnode)) + printer.eol(); } + } printer.outdent(); printer.marginPrint(""); break; case DIMENSION: - if (!this.ce.references(node)) - break; DapDimension dim = (DapDimension) node; if (!dim.isShared()) - break; // ignore, here, anonymous dimensions + return false; // ignore, here, anonymous dimensions printer.marginPrint("<" + dmrname); printXMLAttributes(node, ce, NILFLAGS); if (dim.isUnlimited()) - printXMLAttribute(AbstractDSP.UCARTAGUNLIMITED, "1", NILFLAGS); + printXMLAttribute(DapAttribute.UCARTAGUNLIMITED, "1", NILFLAGS); if (hasMetadata(node)) { printer.println(">"); printMetadata(node); @@ -210,8 +265,6 @@ public void printNode(DapNode node) throws IOException { break; case ENUMERATION: - if (!this.ce.references(node)) - break; DapEnumeration en = (DapEnumeration) node; printer.marginPrint("<" + dmrname); printXMLAttributes(en, ce, NILFLAGS); @@ -230,14 +283,14 @@ public void printNode(DapNode node) throws IOException { break; case VARIABLE: - if (!this.ce.references(node)) - break; DapVariable var = (DapVariable) node; + if (var.getCount() == 0) // Has zero-length dimension + return false; DapType type = var.getBaseType(); printer.marginPrint("<" + type.getTypeSort().name()); printXMLAttributes(node, ce, NILFLAGS); if (type.isAtomic()) { - if ((hasMetadata(node) || hasDimensions(var) || hasMaps(var))) { + if ((hasMetadata(node) || hasDimensions(var) || hasMaps(var) || hasRequestData(var))) { printer.println(">"); printer.indent(); if (hasDimensions(var)) @@ -246,6 +299,8 @@ public void printNode(DapNode node) throws IOException { printMetadata(var); if (hasMaps(var)) printMaps(var); + if (hasRequestData(var)) + printRequestData(var); printer.outdent(); printer.marginPrint(""); } else @@ -257,12 +312,14 @@ public void printNode(DapNode node) throws IOException { for (DapVariable field : struct.getFields()) { if (!this.ce.references(field)) continue; - printNode(field); - printer.eol(); + if (printNode(field)) + printer.eol(); } printDimrefs(var); printMetadata(var); printMaps(var); + if (hasRequestData(var)) + printRequestData(var); printer.outdent(); printer.marginPrint(""); } else @@ -273,7 +330,7 @@ public void printNode(DapNode node) throws IOException { assert (false) : "Unexpected sort: " + sort.name(); break; } - + return true; } /** @@ -299,8 +356,8 @@ void printXMLAttributes(DapNode node, CEConstraint ce, int flags) throws IOExcep printXMLAttribute("dapVersion", dataset.getDapVersion(), flags); printXMLAttribute("dmrVersion", dataset.getDMRVersion(), flags); // boilerplate - printXMLAttribute("xmlns", "http://xml.opendap.org/ns/DAP/4.0#", flags); - printXMLAttribute("xmlns:dap", "http://xml.opendap.org/ns/DAP/4.0#", flags); + printXMLAttribute("xmlns", DapConstants.X_DAP_NS, flags); + printXMLAttribute("xmlns:dap", DapConstants.X_DAP_NS, flags); break; case DIMENSION: @@ -340,7 +397,7 @@ void printXMLAttributes(DapNode node, CEConstraint ce, int flags) throws IOExcep default: break; // node either has no attributes or name only } // switch - if (!this.testing) + if (controls.contains(Controls.RESERVED)) printReserved(node); if ((flags & PERLINE) != 0) { printer.outdent(2); @@ -387,11 +444,10 @@ protected void printReserved(DapNode node) throws DapException { } protected void printMetadata(DapNode node) throws IOException { - + boolean isdataset = node.getSort() == DapSort.DATASET; Map attributes = node.getAttributes(); - if (attributes.size() == 0) { + if (!isdataset && attributes.size() == 0) return; - } for (Map.Entry entry : attributes.entrySet()) { DapAttribute attr = entry.getValue(); assert (attr != null); @@ -407,6 +463,8 @@ protected void printMetadata(DapNode node) throws IOException { break; } } + if (isdataset) + printRequestMetaData(node); } protected void printContainerAttribute(DapAttribute attr) {} @@ -447,8 +505,6 @@ static boolean isSpecial(DapAttribute attr) { } void printAttribute(DapAttribute attr) throws IOException { - if (this.testing && isSpecial(attr)) - return; printer.marginPrint(" maps = parent.getMaps(); if (maps.size() == 0) return; @@ -529,11 +583,11 @@ void printMaps(DapVariable parent) throws IOException { // Optionally suppress field maps if (!ALLOWFIELDMAPS) { DapVariable mapvar = map.getVariable(); - if (mapvar.getParent() != null && !mapvar.getParent().getSort().isGroup()) + if (mapvar != null && mapvar.getParent() != null && !mapvar.getParent().getSort().isGroup()) continue; // Supress maps with non-top-level vars } // Separate out name attribute so we can use FQN. - String name = map.getFQN(); + String name = map.getTargetName(); assert (name != null) : "Illegal reference"; printer.marginPrint("DAP + * translations. + */ + void printRequestMetaData(DapNode dataset) throws DapException { + try { + // Add dap4.ce attribute + if (!this.ce.isUniversal()) { + String sce = this.ce.toConstraintString(); + DapAttribute a = new DapAttribute(DapConstants.CEATTRNAME, DapType.STRING); + a.setValues(new String[] {sce}); + printAttribute(a); + } + // Add + DapAttribute a = new DapAttribute(DapConstants.LITTLEENDIANATTRNAME, DapType.UINT8); + String[] value = new String[1]; + value[0] = (this.order == ByteOrder.LITTLE_ENDIAN ? "1" : "0"); + a.setValues(value); + printAttribute(a); + } catch (IOException ioe) { + throw new DapException(ioe); + } + } + + /** + * Print request-specific per-variable data + * Like printRequestMetaData, this is nasty hack + * to avoid modifying the DMR. + * + * @param var + */ + protected void printRequestData(DapVariable var) throws DapException { + try {// Add per-variable checksum + Long csum = localchecksummap.get(var); + if (csum == null) + return; + DapAttribute a = var.getChecksumAttribute(); + if (a == null) { + a = new DapAttribute(DapConstants.CHECKSUMATTRNAME, DapType.INT32); + a.setValues(new String[] {csum.toString()}); + } + printAttribute(a); + } catch (IOException ioe) { + throw new DapException(ioe); + } + } + ////////////////////////////////////////////////// // Misc. Static Utilities @@ -606,13 +709,17 @@ protected boolean hasMetadata(DapNode node) { return node.getAttributes().size() > 0; } - protected static boolean hasMaps(DapVariable var) { + protected boolean hasMaps(DapVariable var) { return var.getMaps().size() > 0; } - protected static boolean hasDimensions(DapVariable var) { + protected boolean hasDimensions(DapVariable var) { return var.getDimensions().size() > 0; } + protected boolean hasRequestData(DapVariable var) { + return localchecksummap != null && localchecksummap.containsKey(var); + } + } // class DapPrint diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapAttribute.java b/dap4/src/main/java/dap4/core/dmr/DapAttribute.java similarity index 78% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapAttribute.java rename to dap4/src/main/java/dap4/core/dmr/DapAttribute.java index cebd220a4f..e890d32e0c 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapAttribute.java +++ b/dap4/src/main/java/dap4/core/dmr/DapAttribute.java @@ -16,8 +16,17 @@ public class DapAttribute extends DapNode { ////////////////////////////////////////////////// - // Instance Variables + // Constants + + // Define reserved XML attributes + public static final String UCARTAGOPAQUE = "_edu.ucar.opaque.size"; + public static final String UCARTAGUNLIMITED = "_edu.ucar.isunlimited"; + // Not yet implemented + public static final String UCARTAGVLEN = "_edu.ucar.isvlen"; + public static final String UCARTAGORIGTYPE = "_edu.ucar.orig.type"; + ////////////////////////////////////////////////// + // Instance Variables protected List namespaceList = new ArrayList(); diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapAttributeSet.java b/dap4/src/main/java/dap4/core/dmr/DapAttributeSet.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapAttributeSet.java rename to dap4/src/main/java/dap4/core/dmr/DapAttributeSet.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapDataset.java b/dap4/src/main/java/dap4/core/dmr/DapDataset.java similarity index 98% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapDataset.java rename to dap4/src/main/java/dap4/core/dmr/DapDataset.java index f723fb38ce..ffe08cbc68 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapDataset.java +++ b/dap4/src/main/java/dap4/core/dmr/DapDataset.java @@ -10,8 +10,7 @@ import java.util.*; /** - * This class defines a non-Gridd Grid: - * i.e. one with an atomic type. + * This is the root object of a DMR tree. */ public class DapDataset extends DapGroup { @@ -49,6 +48,8 @@ public class DapDataset extends DapGroup { protected boolean finished = false; + protected Map checksummap = null; + ////////////////////////////////////////////////// // Constructors @@ -131,9 +132,8 @@ public CEConstraint getConstraint() { return this.ce; } - public DapDataset setConstraint(CEConstraint ce) { + public void setConstraint(CEConstraint ce) { this.ce = ce; - return this; } public String getDapVersion() { diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapDecl.java b/dap4/src/main/java/dap4/core/dmr/DapDecl.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapDecl.java rename to dap4/src/main/java/dap4/core/dmr/DapDecl.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapDimension.java b/dap4/src/main/java/dap4/core/dmr/DapDimension.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapDimension.java rename to dap4/src/main/java/dap4/core/dmr/DapDimension.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapEnumConst.java b/dap4/src/main/java/dap4/core/dmr/DapEnumConst.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapEnumConst.java rename to dap4/src/main/java/dap4/core/dmr/DapEnumConst.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapEnumeration.java b/dap4/src/main/java/dap4/core/dmr/DapEnumeration.java similarity index 81% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapEnumeration.java rename to dap4/src/main/java/dap4/core/dmr/DapEnumeration.java index 4a869aa02f..fe611b3637 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapEnumeration.java +++ b/dap4/src/main/java/dap4/core/dmr/DapEnumeration.java @@ -17,6 +17,33 @@ public class DapEnumeration extends DapType { public static final DapType DEFAULTBASETYPE = DapType.INT32; + ////////////////////////////////////////////////// + // Static Methods + + // See if two enumeration objects appear to be identical + static public boolean same(DapEnumeration enum1, DapEnumeration enum2) { + if (!enum1.getShortName().equals(enum2.getShortName())) + return false; + if (enum1.getBaseType() != enum2.getBaseType()) + return false; + List list1 = enum1.getEnumConsts(); + List list2 = enum2.getEnumConsts(); + if (list1.size() != list2.size()) + return false; + for (DapEnumConst ec1 : list1) { + boolean found = false; + for (DapEnumConst ec2 : list2) { + if (ec1.getShortName().equals(ec2.getShortName()) && ec1.getValue().equals(ec2.getValue())) { + found = true; + break; + } + } + if (!found) + return false; + } + return true; + } + ////////////////////////////////////////////////// // Instance Variables @@ -55,6 +82,10 @@ public DapType getBaseType() { return basetype; } + public List getEnumConsts() { + return constants; + } + public void setBaseType(DapType basetype) { // validate the base type if (!basetype.isIntegerType()) diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapGroup.java b/dap4/src/main/java/dap4/core/dmr/DapGroup.java similarity index 92% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapGroup.java rename to dap4/src/main/java/dap4/core/dmr/DapGroup.java index 6cc648183a..7f18408359 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapGroup.java +++ b/dap4/src/main/java/dap4/core/dmr/DapGroup.java @@ -68,8 +68,14 @@ public void addDecl(DapNode newdecl) throws DapException { // Look for name conflicts (ignore anonymous dimensions) if (newsort != DapSort.DIMENSION || newname != null) { for (DapNode decl : decls) { - if (newsort == decl.getSort() && newname.equals(decl.getShortName())) - throw new DapException("DapGroup: attempt to add duplicate decl: " + newname); + if (newsort == decl.getSort() && newname.equals(decl.getShortName())) { + if (false) { + // If we have duplicate enums, then just use the first one + if (newsort != DapSort.ENUMERATION || !DapEnumeration.same((DapEnumeration) decl, (DapEnumeration) newdecl)) + throw new DapException("DapGroup: attempt to add duplicate decl: " + newname); + } + return; // Duplicate enumeration + } } } else { // Anonymous DapDimension anon = (DapDimension) newdecl; @@ -160,6 +166,15 @@ public List getVariables() { ////////////////////////////////////////////////// // Lookup Functions + // Test for specific decl + public boolean containsDecl(DapNode decl) { + for (DapNode d : getDecls()) { + if (d == decl) + return true; + } + return false; + } + public DapNode findByName(String name, DapSort... sortset) { return findInGroup(name, sortset); } diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapMap.java b/dap4/src/main/java/dap4/core/dmr/DapMap.java similarity index 72% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapMap.java rename to dap4/src/main/java/dap4/core/dmr/DapMap.java index af61d4e1f7..18aa008c3c 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapMap.java +++ b/dap4/src/main/java/dap4/core/dmr/DapMap.java @@ -12,6 +12,8 @@ public class DapMap extends DapNode { DapVariable actualvar = null; + String target = null; + ////////////////////////////////////////////////// // Constructors @@ -19,16 +21,25 @@ public DapMap() { super(); } - public DapMap(DapVariable var) { - this(); - setVariable(var); + public DapMap(String target) { + super(); + this.target = target; + // Use for toString() + this.setShortName(this.target); } ////////////////////////////////////////////////// // Get/set + public String getTargetName() { + if (this.actualvar != null) + return this.actualvar.getFQN(); + else + return this.target; + } + public DapVariable getVariable() { - return actualvar; + return this.actualvar; } public void setVariable(DapVariable var) { diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapNode.java b/dap4/src/main/java/dap4/core/dmr/DapNode.java similarity index 93% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapNode.java rename to dap4/src/main/java/dap4/core/dmr/DapNode.java index 584e792383..c28e6ca005 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapNode.java +++ b/dap4/src/main/java/dap4/core/dmr/DapNode.java @@ -102,8 +102,6 @@ else if (this instanceof DapType) // must follow enumeration this.sort = DapSort.ATOMICTYPE; else if (this instanceof DapEnumConst) this.sort = DapSort.ENUMCONST; - else if (this instanceof DapEnumeration) - this.sort = DapSort.ENUMERATION; else if (this instanceof DapMap) this.sort = DapSort.MAP; else @@ -240,7 +238,8 @@ public DapDataset getDataset() { assert curr != null; next = curr.getGroup(); } while (curr.getSort() != DapSort.DATASET); - setDataset((DapDataset) curr); + // setDataset((DapDataset) curr); + assert (curr != null); } return this.dataset; } @@ -311,7 +310,7 @@ public DapNode getParent() { /** * Set the parent DapNode; may sometimes be same as container, * but not always (think attributes or maps). - * Invariant: parent must be either a group or a variable. + * Invariant: parent must be either a group (including DapDataset) or a variable. * We can infer the container, so set that also. * * @param parent the proposed parent node @@ -319,9 +318,10 @@ public DapNode getParent() { public void setParent(DapNode parent) { assert this.parent == null; assert ((this.getSort() == DapSort.ENUMCONST && parent.getSort() == DapSort.ENUMERATION) - || parent.getSort().isa(DapSort.GROUP) || parent.getSort() == DapSort.VARIABLE - || parent.getSort() == DapSort.STRUCTURE || parent.getSort() == DapSort.SEQUENCE - || this.getSort() == DapSort.ATTRIBUTE || this.getSort() == DapSort.ATTRIBUTESET); + || parent.getSort().isa(DapSort.GROUP) || parent.getSort().isa(DapSort.DATASET) + || parent.getSort() == DapSort.VARIABLE || parent.getSort() == DapSort.STRUCTURE + || parent.getSort() == DapSort.SEQUENCE || this.getSort() == DapSort.ATTRIBUTE + || this.getSort() == DapSort.ATTRIBUTESET); this.parent = parent; } @@ -366,9 +366,8 @@ public String getFQN() { } /** - * Compute the path upto, and including - * some specified containing node (null=>root) - * The containing node is included as is this node. + * Compute the path upto, and including the root Dataset. + * This node is included as last element in path. * * @return ordered list of parent nodes */ @@ -430,8 +429,8 @@ public List getGroupPath() { * Compute the FQN of this node */ public String computefqn() { - List path = getPath(); // excludes root/wrt - StringBuilder fqn = new StringBuilder(); + List path = getPath(); // including root + StringBuilder sfqn = new StringBuilder(); DapNode parent = path.get(0); for (int i = 1; i < path.size(); i++) { // start at 1 to skip root DapNode current = path.get(i); @@ -440,23 +439,22 @@ public String computefqn() { case DATASET: case GROUP: case ENUMERATION: - fqn.append('/'); - fqn.append(Escape.backslashEscape(current.getShortName(), "/.")); + sfqn.append('/'); break; // These use '.' case STRUCTURE: case SEQUENCE: case ENUMCONST: case VARIABLE: - fqn.append('.'); - fqn.append(current.getEscapedShortName()); + sfqn.append('.'); break; default: // Others should never happen throw new IllegalArgumentException("Illegal FQN parent"); } + sfqn.append(current.getEscapedShortName()); parent = current; } - return fqn.toString(); + return sfqn.toString(); } ////////////////////////////////////////////////// @@ -471,10 +469,9 @@ public boolean isTopLevel() { public String toString() { String sortname = (sort == null ? "undefined" : sort.name()); - // String name = getFQN(); - String name = null; + String name = this.fqn; if (name == null) - name = getShortName(); + name = this.shortname; if (name == null) name = "?"; return sortname + "::" + name; diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapOtherXML.java b/dap4/src/main/java/dap4/core/dmr/DapOtherXML.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapOtherXML.java rename to dap4/src/main/java/dap4/core/dmr/DapOtherXML.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapSequence.java b/dap4/src/main/java/dap4/core/dmr/DapSequence.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapSequence.java rename to dap4/src/main/java/dap4/core/dmr/DapSequence.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapStructure.java b/dap4/src/main/java/dap4/core/dmr/DapStructure.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapStructure.java rename to dap4/src/main/java/dap4/core/dmr/DapStructure.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapType.java b/dap4/src/main/java/dap4/core/dmr/DapType.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapType.java rename to dap4/src/main/java/dap4/core/dmr/DapType.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/DapVariable.java b/dap4/src/main/java/dap4/core/dmr/DapVariable.java similarity index 93% rename from dap4/d4core/src/main/java/dap4/core/dmr/DapVariable.java rename to dap4/src/main/java/dap4/core/dmr/DapVariable.java index 483a2de6bb..8c1ba6f9d9 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/DapVariable.java +++ b/dap4/src/main/java/dap4/core/dmr/DapVariable.java @@ -22,7 +22,7 @@ public class DapVariable extends DapNode implements DapDecl { protected DapType basetype = null; protected List dimensions = new ArrayList(); protected List maps = new ArrayList(); // maps are ordered - protected int checksum = 0; + protected DapAttribute attributechecksum = null; protected int fieldindex = -1; ////////////////////////////////////////////////// @@ -86,12 +86,12 @@ public void addMap(DapMap map) throws DapException { maps.add(map); } - public int getChecksum() { - return this.checksum; + public DapAttribute getChecksumAttribute() { + return this.attributechecksum; } - public void setChecksum(int csum) { - this.checksum = csum; + public void setAttributeChecksum(DapAttribute csum) { + this.attributechecksum = csum; } public int getFieldIndex() { diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/ErrorResponse.java b/dap4/src/main/java/dap4/core/dmr/ErrorResponse.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/ErrorResponse.java rename to dap4/src/main/java/dap4/core/dmr/ErrorResponse.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/TypeSort.java b/dap4/src/main/java/dap4/core/dmr/TypeSort.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/TypeSort.java rename to dap4/src/main/java/dap4/core/dmr/TypeSort.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/DOM4Parser.java b/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java similarity index 94% rename from dap4/d4core/src/main/java/dap4/core/dmr/parser/DOM4Parser.java rename to dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java index d0d3c900b3..8ba7d4203f 100644 --- a/dap4/d4core/src/main/java/dap4/core/dmr/parser/DOM4Parser.java +++ b/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java @@ -70,6 +70,7 @@ public class DOM4Parser implements Dap4Parser { sortmap.put("sequence", DapSort.SEQUENCE); sortmap.put("structure", DapSort.STRUCTURE); sortmap.put("char", DapSort.VARIABLE); + sortmap.put("byte", DapSort.VARIABLE); sortmap.put("int8", DapSort.VARIABLE); sortmap.put("uint8", DapSort.VARIABLE); sortmap.put("int16", DapSort.VARIABLE); @@ -88,6 +89,7 @@ public class DOM4Parser implements Dap4Parser { typemap = new HashMap(); // se lower cas enames typemap.put("char", TypeSort.Char); + typemap.put("byte", TypeSort.UInt8); // alias typemap.put("int8", TypeSort.Int8); typemap.put("uint8", TypeSort.UInt8); typemap.put("int16", TypeSort.Int16); @@ -280,6 +282,12 @@ protected String pull(Node n, String name) { return attr.getNodeValue(); } + protected boolean notexists(Node n, String name) { + NamedNodeMap map = n.getAttributes(); + Node attr = map.getNamedItem(name); + return (attr == null); + } + ////////////////////////////////////////////////// // Attribute construction @@ -407,6 +415,11 @@ protected void recordattr(DapAttribute attr, DapNode parent) throws ParseExcepti } } + protected boolean isattributeset(Node node) { + String type = pull(node, "type"); + return (nodesort(node) == DapSort.ATTRIBUTE && (isempty(type) || "container".equalsIgnoreCase(type))); + } + ////////////////////////////////////////////////// // Recursive descent parser @@ -545,11 +558,8 @@ else if (type.isAtomic()) recorddecl(v.getBaseType(), group); recorddecl(v, group); break; - case ATTRIBUTESET: - recordattr(parseattrset(n), group); - break; case ATTRIBUTE: - recordattr(parseattr(n), group); + parseattr(n, group, null); break; case OTHERXML: recordattr(parseotherxml(n), group); @@ -692,8 +702,8 @@ protected DapDimension parsedimdef(Node node) throws ParseException { throw new ParseException("Dimdef: Empty dimension declaration size"); try { lvalue = Long.parseLong(size); - if (lvalue <= 0) - throw new ParseException("Dimdef: value <= 0: " + lvalue); + // Allow zero length dimensions ; they will be elided later + // if (lvalue <= 0) throw new ParseException("Dimdef: value <= 0: " + lvalue); } catch (NumberFormatException nfe) { throw new ParseException("Dimdef: non-integer value: " + size); } @@ -855,10 +865,7 @@ protected void fillmetadata(Node node, DapVariable var) throws ParseException { var.addMap(parsemap(n)); break; case ATTRIBUTE: - recordattr(parseattr(n), var); - break; - case ATTRIBUTESET: - recordattr(parseattrset(n), var); + parseattr(n, var, null); break; case OTHERXML: recordattr(parseotherxml(n), var); @@ -916,43 +923,27 @@ protected DapMap parsemap(Node node) throws ParseException { String name = pull(node, "name"); if (isempty(name)) throw new ParseException("Mapref: Empty map name"); - DapVariable target; - try { - target = (DapVariable) this.root.findByFQN(name, DapSort.VARIABLE, DapSort.SEQUENCE, DapSort.STRUCTURE); - } catch (DapException de) { - throw new ParseException(de); - } - if (target == null) - throw new ParseException("Mapref: undefined target variable: " + name); - // Verify that this is a legal map => - // 1. it is outside the scope of its parent if the parent - // is a structure. - DapNode container = target.getContainer(); - DapNode scope; - try { - scope = getParentScope(); - } catch (DapException de) { - throw new ParseException(de); - } - if ((container.getSort() == DapSort.STRUCTURE || container.getSort() == DapSort.SEQUENCE) && container == scope) - throw new ParseException("Mapref: map target variable not in outer scope: " + name); - DapMap map = factory.newMap(target); + DapMap map = factory.newMap(name); if (trace) trace("map.exit"); return map; } - protected DapAttribute parseattr(Node node) throws ParseException { + protected void parseattr(Node node, DapNode parent, String prefix) throws ParseException { try { if (trace) trace("attribute.enter"); + if (isattributeset(node)) { + parseattrset(node, parent); + return; + } String name = pull(node, "name"); if (isempty(name)) throw new ParseException("Attribute: Empty attribute name"); + if (prefix != null) + name = prefix + "." + name; String type = pull(node, "type"); - if (isempty(type)) - type = DEFAULTATTRTYPE; - else if ("Byte".equalsIgnoreCase(type)) + if ("Byte".equalsIgnoreCase(type)) type = "UInt8"; // Convert type to basetype DapType basetype = (DapType) this.root.lookup(type, DapSort.ENUMERATION, DapSort.ATOMICTYPE); @@ -998,44 +989,47 @@ else if ("Byte".equalsIgnoreCase(type)) values.set(i, ds); } attr.setValues(values.toArray(new String[values.size()])); + recordattr(attr, parent); scopestack.pop(); if (trace) trace("attribute.exit"); - return attr; + return; } catch (DapException e) { throw new ParseException(e); } } - protected DapAttributeSet parseattrset(Node node) throws ParseException { + // Attributes in an attributeset are flattened + protected void parseattrset(Node node, DapNode parent) throws ParseException { + parseattrset(node, parent, null); + } + + protected void parseattrset(Node node, DapNode parent, String prefix) throws ParseException { try { if (trace) trace("attrset.enter"); - String name = pull(node, "name"); - if (isempty(name)) - throw new ParseException("AttributeSet: Empty attribute name"); List nslist = parsenamespaces(node); - DapAttributeSet attrset = (DapAttributeSet) makeAttribute(DapSort.ATTRIBUTESET, name, null, nslist); - scopestack.push(attrset); + String setname = pull(node, "name"); + if (isempty(setname)) + throw new ParseException("Attribute: Empty attribute set name"); + String nextprefix = (prefix == null ? setname : prefix + "." + setname); List nodes = getSubnodes(node); for (int i = 0; i < nodes.size(); i++) { Node n = nodes.get(i); DapSort sort = nodesort(n); switch (sort) { case ATTRIBUTE: - recordattr(parseattr(n), attrset); - break; - case ATTRIBUTESET: - recordattr(parseattrset(n), attrset); + if (isattributeset(n)) + parseattrset(node, parent, nextprefix); + else + parseattr(n, parent, nextprefix); break; default: throw new ParseException("Unexpected attribute set element: " + n); } } - scopestack.pop(); if (trace) trace("attributeset.exit"); - return attrset; } catch (DapException e) { throw new ParseException(e); } diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/Dap4Parser.java b/dap4/src/main/java/dap4/core/dmr/parser/Dap4Parser.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/parser/Dap4Parser.java rename to dap4/src/main/java/dap4/core/dmr/parser/Dap4Parser.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/ParseException.java b/dap4/src/main/java/dap4/core/dmr/parser/ParseException.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/parser/ParseException.java rename to dap4/src/main/java/dap4/core/dmr/parser/ParseException.java diff --git a/dap4/d4core/src/main/java/dap4/core/dmr/parser/ParseUtil.java b/dap4/src/main/java/dap4/core/dmr/parser/ParseUtil.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/dmr/parser/ParseUtil.java rename to dap4/src/main/java/dap4/core/dmr/parser/ParseUtil.java diff --git a/dap4/src/main/java/dap4/core/interfaces/ArrayScheme.java b/dap4/src/main/java/dap4/core/interfaces/ArrayScheme.java new file mode 100644 index 0000000000..0f59e60f63 --- /dev/null +++ b/dap4/src/main/java/dap4/core/interfaces/ArrayScheme.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.core.interfaces; + + +import dap4.core.dmr.DapType; +import dap4.core.dmr.DapVariable; + +/** + * Track kinds of Arrays + */ + +public enum ArrayScheme { + ATOMIC, STRUCTARRAY, STRUCTURE, SEQARRAY, SEQUENCE, RECORD; + + ////////////////////////////////////////////////// + // Static methods + + static public ArrayScheme schemeFor(DapVariable field) { + DapType ftype = field.getBaseType(); + ArrayScheme scheme = null; + boolean isscalar = field.getRank() == 0; + if (ftype.getTypeSort().isAtomic()) + scheme = ArrayScheme.ATOMIC; + else { + if (ftype.getTypeSort().isStructType()) + scheme = ArrayScheme.STRUCTARRAY; + else if (ftype.getTypeSort().isSeqType()) + scheme = ArrayScheme.SEQARRAY; + } + return scheme; + } +} + diff --git a/dap4/src/main/java/dap4/core/util/ChecksumMode.java b/dap4/src/main/java/dap4/core/util/ChecksumMode.java new file mode 100644 index 0000000000..48f88f50dd --- /dev/null +++ b/dap4/src/main/java/dap4/core/util/ChecksumMode.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.core.util; + +/** + * Define possible checksum modes: + * + */ +public enum ChecksumMode { + NONE, // => dap4.checksum was not specified + FALSE, // => dap4.checksum=false + TRUE; // => dap4.checksum=true + + static public final ChecksumMode dfalt = TRUE; // Must be TRUE|FALSE + + static final String[] trues = new String[] {"true", "on", "yes", "1"}; + static final String[] falses = new String[] {"false", "off", "no", "0"}; + + static public String toString(ChecksumMode mode) { + if (mode == null) + mode = ChecksumMode.dfalt; + switch (mode) { + case NONE: + return toString(ChecksumMode.FALSE); + case FALSE: + return "false"; + case TRUE: + return "true"; + } + return ChecksumMode.toString(dfalt); + } + + static public ChecksumMode modeFor(String s) { + if (s == null || s.length() == 0) + return null; + for (String f : falses) { + if (f.equalsIgnoreCase(s)) + return FALSE; + } + for (String t : trues) { + if (t.equalsIgnoreCase(s)) + return TRUE; + } + return null; + } + + /** + * force mode to be TRUE or FALSE + * + * @param mode + * @return TRUE|FALSE + */ + static public ChecksumMode asTrueFalse(ChecksumMode mode) { + if (mode == null || mode == NONE) + mode = dfalt; + return mode; + } + +} diff --git a/dap4/d4core/src/main/java/dap4/core/util/ConversionException.java b/dap4/src/main/java/dap4/core/util/ConversionException.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/ConversionException.java rename to dap4/src/main/java/dap4/core/util/ConversionException.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/Convert.java b/dap4/src/main/java/dap4/core/util/Convert.java similarity index 99% rename from dap4/d4core/src/main/java/dap4/core/util/Convert.java rename to dap4/src/main/java/dap4/core/util/Convert.java index 8bbf6ef2ce..c0661008d5 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/Convert.java +++ b/dap4/src/main/java/dap4/core/util/Convert.java @@ -304,6 +304,7 @@ else if (lvalues != null) for (int i = 0; i < count; i++) { fresult[i] = (float) dvalues[i]; } + result = fresult; break; case Float64: if (svalues != null) diff --git a/dap4/d4core/src/main/java/dap4/core/util/CoreTypeFcns.java b/dap4/src/main/java/dap4/core/util/CoreTypeFcns.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/CoreTypeFcns.java rename to dap4/src/main/java/dap4/core/util/CoreTypeFcns.java diff --git a/dap4/src/main/java/dap4/core/util/DapConstants.java b/dap4/src/main/java/dap4/core/util/DapConstants.java new file mode 100644 index 0000000000..d0e88c89c3 --- /dev/null +++ b/dap4/src/main/java/dap4/core/util/DapConstants.java @@ -0,0 +1,72 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.core.util; + +import dap4.core.dmr.*; +import java.io.*; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Deque; +import java.util.List; + +/** + * DAP4 Related Constants both client and server side. + */ + +public abstract class DapConstants { + ////////////////////////////////////////////////// + // Constants + + // Default http protocol + // Default http protocol + public static final String HTTPSCHEME = "http:"; + + // XML Tags for DAP4 + public static final String X_DAP_SERVER = "TDS-5"; + public static final String X_DAP_VERSION = "4.0"; + public static final String X_DMR_VERSION = "1.0"; + public static final String X_DAP_NS = "http://xml.opendap.org/ns/DAP/4.0#"; + + // Known dap4 specific query tags + public static final String CONSTRAINTTAG = "dap4.ce"; + public static final String CHECKSUMTAG = "dap4.checksum"; // May also be in fragment + + // Define the Serialization Constants common to servlet and client + + // Use Bit flags to avoid heavyweight enumset + public static final int CHUNK_DATA = 0; // bit 0 : value 0 + public static final int CHUNK_END = 1; // bit 0 : value 1 + public static final int CHUNK_ERROR = 2; // bit 1 : value 1 + public static final int CHUNK_LITTLE_ENDIAN = 4; // bit 2: value 1 + + // Construct the union of all flags + public static final int CHUNK_ALL = CHUNK_DATA | CHUNK_ERROR | CHUNK_END | CHUNK_LITTLE_ENDIAN; + public static final int COUNTSIZE = 8; // databuffer as specified by the DAP4 spec + public static final int CHECKSUMSIZE = 4; // bytes if CRC32 + public static final String DIGESTER = "CRC32"; + public static final String CHECKSUMATTRNAME = "_DAP4_Checksum_CRC32"; + public static final String LITTLEENDIANATTRNAME = "_DAP4_Little_Endian"; + public static final String CEATTRNAME = "_" + CONSTRAINTTAG; + + + ////////////////////////////////////////////////// + // Constants via Enumerations + + public enum ChecksumSource { + LOCAL, REMOTE + }; + + ////////////////////////////////////////////////// + // Dap4 Annotations + + public static final String DAP4ENDIANTAG = "ucar.littleendian"; // value = 1 | 0 + // public static final String DAP4TESTTAG = "ucar.testing"; // value = NONE|DAP|DMR|ALL + +} diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapContext.java b/dap4/src/main/java/dap4/core/util/DapContext.java similarity index 67% rename from dap4/d4core/src/main/java/dap4/core/util/DapContext.java rename to dap4/src/main/java/dap4/core/util/DapContext.java index 0edcad7b16..98d89ada3f 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/DapContext.java +++ b/dap4/src/main/java/dap4/core/util/DapContext.java @@ -5,6 +5,7 @@ package dap4.core.util; +import java.util.List; import java.util.Map; /** @@ -19,6 +20,14 @@ public DapContext() { super(); } + public DapContext insert(Map map, boolean override) { + for (Map.Entry entry : map.entrySet()) { + if (!super.containsKey(entry.getKey()) || override) + super.put(entry.getKey(), entry.getValue()); + } + return this; + } + public String toString() { StringBuilder buf = new StringBuilder("DapContext{"); boolean first = true; @@ -26,11 +35,11 @@ public String toString() { if (!first) buf.append(","); buf.append("|"); - buf.append(entry.getKey().toString()); + buf.append(DapUtil.stringable(entry.getKey()).toString()); buf.append("|"); buf.append("="); buf.append("|"); - buf.append(entry.getValue().toString()); + buf.append(DapUtil.stringable(entry.getValue()).toString()); buf.append("|"); first = false; } diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapDump.java b/dap4/src/main/java/dap4/core/util/DapDump.java similarity index 74% rename from dap4/d4core/src/main/java/dap4/core/util/DapDump.java rename to dap4/src/main/java/dap4/core/util/DapDump.java index 4b08734729..5f0db41c57 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/DapDump.java +++ b/dap4/src/main/java/dap4/core/util/DapDump.java @@ -23,7 +23,7 @@ public abstract class DapDump { ////////////////////////////////////////////////// // Provide a simple dump of binary data - public static void dumpbytes(ByteBuffer buf0, boolean skipdmr) { + static public void dumpbytesbuf(ByteBuffer buf0, boolean skipdmr) { int savepos = buf0.position(); int limit0 = buf0.limit(); int skipcount = 0; @@ -48,7 +48,7 @@ public static void dumpbytes(ByteBuffer buf0, boolean skipdmr) { System.err.println("order=" + buf0.order()); ByteBuffer buf = ByteBuffer.wrap(bytes).order(buf0.order()); - dumpbytes(buf); + dumpbytesbuf(buf); } /** @@ -56,7 +56,7 @@ public static void dumpbytes(ByteBuffer buf0, boolean skipdmr) { * * @param buf0 byte buffer to dump */ - public static void dumpbytes(ByteBuffer buf0) { + static public void dumpbytesbuf(ByteBuffer buf0) { int stop = buf0.limit(); int size = stop + 8; int savepos = buf0.position(); @@ -70,6 +70,8 @@ public static void dumpbytes(ByteBuffer buf0) { buf.limit(size); int i = 0; try { + System.err.printf("[pos] X U S C\t I UI XI Sh USh%n"); + System.err.println("-------------------------------------------------------------------------------------"); for (i = 0; buf.position() < stop; i++) { savepos = buf.position(); int iv = buf.getInt(); @@ -91,9 +93,9 @@ else if (c == '\n') s = "\\n"; else if (c < ' ' || c >= 0x7f) s = "?"; - System.err.printf("[%03d] %02x %03d %4d '%s'", i, ub, ub, ib, s); - System.err.printf("\t%12d 0x%08x", iv, uiv); - System.err.printf("\t%5d\t0x%04x", sv, usv); + System.err.printf("[%03d] 0x%02x %03d %04d '%s'", i, ub, ub, ib, s); + System.err.printf("\t%12d %12d 0x%08x", iv, uiv, uiv); + System.err.printf(" %8d %8d", sv, usv); System.err.println(); System.err.flush(); } @@ -107,27 +109,27 @@ else if (c < ' ' || c >= 0x7f) } } - public static void dumpbytestream(OutputStream stream, ByteOrder order, String tag) { + static public void dumpbytesstream(OutputStream stream, ByteOrder order, String tag) { if (stream instanceof ByteArrayOutputStream) { byte[] content = ((ByteArrayOutputStream) stream).toByteArray(); - dumpbytestream(content, order, tag); + dumpbytesraw(content, order, tag); } } - public static void dumpbytestream(ByteBuffer buf, ByteOrder order, String tag) { - dumpbytestream(buf.array(), 0, buf.position(), order, tag); + static public void dumpbytesrawbuf(ByteBuffer buf, ByteOrder order, String tag) { + dumpbytesraw(buf.array(), 0, buf.limit(), order, tag); } - public static void dumpbytestream(byte[] content, ByteOrder order, String tag) { - dumpbytestream(content, 0, content.length, order, tag); + static public void dumpbytesraw(byte[] content, ByteOrder order, String tag) { + dumpbytesraw(content, 0, content.length, order, tag); } - public static void dumpbytestream(byte[] content, int start, int len, ByteOrder order, String tag) { + static public void dumpbytesraw(byte[] content, int start, int len, ByteOrder order, String tag) { System.err.println("++++++++++ " + tag + " ++++++++++ "); ByteBuffer tmp = ByteBuffer.wrap(content).order(order); tmp.position(start); tmp.limit(len); - DapDump.dumpbytes(tmp); + DapDump.dumpbytesbuf(tmp); System.err.println("++++++++++ " + tag + " ++++++++++ "); System.err.flush(); } diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapException.java b/dap4/src/main/java/dap4/core/util/DapException.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/DapException.java rename to dap4/src/main/java/dap4/core/util/DapException.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapIterator.java b/dap4/src/main/java/dap4/core/util/DapIterator.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/DapIterator.java rename to dap4/src/main/java/dap4/core/util/DapIterator.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapSort.java b/dap4/src/main/java/dap4/core/util/DapSort.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/DapSort.java rename to dap4/src/main/java/dap4/core/util/DapSort.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/DapUtil.java b/dap4/src/main/java/dap4/core/util/DapUtil.java similarity index 69% rename from dap4/d4core/src/main/java/dap4/core/util/DapUtil.java rename to dap4/src/main/java/dap4/core/util/DapUtil.java index 11f985b584..c2013147fd 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/DapUtil.java +++ b/dap4/src/main/java/dap4/core/util/DapUtil.java @@ -6,6 +6,7 @@ package dap4.core.util; import dap4.core.dmr.*; + import java.io.*; import java.math.BigInteger; import java.nio.ByteBuffer; @@ -15,6 +16,8 @@ import java.util.ArrayList; import java.util.Deque; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Misc. Utility methods @@ -25,43 +28,24 @@ public abstract class DapUtil // Should only contain static methods ////////////////////////////////////////////////// // Constants - public static final BigInteger BIG_UMASK64 = new BigInteger("FFFFFFFFFFFFFFFF", 16); - public static final Charset UTF8 = Charset.forName("UTF-8"); + static public final BigInteger BIG_UMASK64 = new BigInteger("FFFFFFFFFFFFFFFF", 16); + static public final Charset UTF8 = Charset.forName("UTF-8"); // Define the Serialization Constants common to servlet and client - public static final ByteOrder NETWORK_ORDER = ByteOrder.BIG_ENDIAN; - public static final ByteOrder NATIVE_ORDER = ByteOrder.nativeOrder(); - - // Use Bit flags to avoid heavyweight enumset - public static final int CHUNK_DATA = 0; // bit 0 : value 0 - public static final int CHUNK_END = 1; // bit 0 : value 1 - public static final int CHUNK_ERROR = 2; // bit 1 : value 1 - public static final int CHUNK_LITTLE_ENDIAN = 4; // bit 2: value 1 - public static final int CHUNK_NOCHECKSUM = 8; // bit 2: value 1 - - // Construct the union of all flags - public static final int CHUNK_ALL = CHUNK_DATA | CHUNK_ERROR | CHUNK_END | CHUNK_LITTLE_ENDIAN; - - public static final String LF = "\n"; - public static final String CRLF = "\r\n"; - public static final int CRLFSIZE = 2; - - // static final public int CHECKSUMSIZE = 16; // bytes if MD5 - // static final public String DIGESTOR = "MD5"; + static public final ByteOrder NETWORK_ORDER = ByteOrder.BIG_ENDIAN; + static public final ByteOrder NATIVE_ORDER = ByteOrder.nativeOrder(); - public static final int CHECKSUMSIZE = 4; // bytes if CRC32 - public static final String DIGESTER = "CRC32"; - public static final String CHECKSUMATTRNAME = "_DAP4_Checksum_CRC32"; - public static final String LITTLEENDIANATTRNAME = "_DAP4_Little_Endian"; - public static final String CEATTRNAME = "_dap4.ce"; + static public final String LF = "\n"; + static public final String CRLF = "\r\n"; + static public final int CRLFSIZE = 2; - public static final String DRIVELETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + static public Pattern DAP4EXT_RE = Pattern.compile("^.*(.dmr|.dap|.dsr|.xml|.html)$"); ////////////////////////////////////////////////// // return last name part of an fqn; result will be escaped. - public static String fqnSuffix(String fqn) { + static public String fqnSuffix(String fqn) { int structindex = fqn.lastIndexOf('.'); int groupindex = fqn.lastIndexOf('/'); if (structindex >= 0) @@ -71,7 +55,7 @@ public static String fqnSuffix(String fqn) { } // return prefix name part of an fqn; result will be escaped. - public static String fqnPrefix(String fqn) { + static public String fqnPrefix(String fqn) { int structindex = fqn.lastIndexOf('.'); int groupindex = fqn.lastIndexOf('/'); if (structindex >= 0) @@ -89,7 +73,7 @@ public static String fqnPrefix(String fqn) { * @return a List of strings (all with escaping still intact) * representing s split at unescaped instances of sep. */ - public static List backslashSplit(String s, char sep) { + static public List backslashSplit(String s, char sep) { List path = new ArrayList(); int len = s.length(); StringBuilder piece = new StringBuilder(); @@ -109,7 +93,7 @@ public static List backslashSplit(String s, char sep) { return path; } - public static Integer stringToInteger(String s) { + static public Integer stringToInteger(String s) { try { return Integer.parseInt(s); } catch (NumberFormatException e) { @@ -117,7 +101,7 @@ public static Integer stringToInteger(String s) { } } - public static boolean hasSequence(DapNode node) { + static public boolean hasSequence(DapNode node) { switch (node.getSort()) { case SEQUENCE: return true; @@ -154,7 +138,7 @@ public static boolean hasSequence(DapNode node) { * false if we are looking for a file * @return absolute path of the file or null */ - public static String locateFile(String filename, String abspath, boolean wantdir) { + static public String locateFile(String filename, String abspath, boolean wantdir) { Deque q = new ArrayDeque(); // clean up the path and filename filename = filename.trim().replace('\\', '/'); @@ -201,7 +185,7 @@ public static String locateFile(String filename, String abspath, boolean wantdir * false if we are looking for a file * @return absolute path of the file|dir wrt to abspath */ - public static String locateRelative(String relpath, String abspath, boolean wantdir) { + static public String locateRelative(String relpath, String abspath, boolean wantdir) { // clean up the path and filename relpath = relpath.trim().replace('\\', '/'); if (relpath.charAt(0) == '/') @@ -231,7 +215,7 @@ public static String locateRelative(String relpath, String abspath, boolean want * @param path convert this path * @return canonicalized version */ - public static String canonicalpath(String path) { + static public String canonicalpath(String path) { if (path == null) return null; path = path.trim(); @@ -240,7 +224,7 @@ public static String canonicalpath(String path) { path = path.substring(0, path.length() - 1); boolean abs = (path.length() > 0 && path.charAt(0) == '/'); if (abs) - path = path.substring(1); // temporary + path = path.substring(1); // temporarily remove leading '/' if (DapUtil.hasDriveLetter(path)) { // As a last step, lowercase the drive letter, if any path = path.substring(0, 1).toLowerCase() + path.substring(1); @@ -249,8 +233,11 @@ public static String canonicalpath(String path) { return path; } - public static String relativize(String path) { - if (path != null) { + static public String relativize(String path) { + if (path == null) + return path; + path = path.replace('\\', '/'); + if (path.length() > 0) { if (path.startsWith("/")) path = path.substring(1); if (hasDriveLetter(path)) @@ -259,13 +246,13 @@ public static String relativize(String path) { return path; } - public static String absolutize(String path) { + static public String absolutize(String path) { if (path != null && !path.startsWith("/") && !hasDriveLetter(path)) path = "/" + path; return path; } - public static boolean checkFixedSize(DapVariable var) { + static public boolean checkFixedSize(DapVariable var) { DapType dt = var.getBaseType(); switch (dt.getTypeSort()) { case Structure: @@ -289,7 +276,7 @@ public static boolean checkFixedSize(DapVariable var) { * as defined by the buffer limit. * @return The byte array contents of the buffer */ - public static byte[] extract(ByteBuffer buf) { + static public byte[] extract(ByteBuffer buf) { int len = buf.limit(); byte[] bytes = new byte[len]; buf.rewind(); @@ -297,7 +284,7 @@ public static byte[] extract(ByteBuffer buf) { return bytes; } - public static byte[] readbinaryfile(InputStream stream) throws IOException { + static public byte[] readbinaryfile(InputStream stream) throws IOException { // Extract the stream into a bytebuffer ByteArrayOutputStream bytes = new ByteArrayOutputStream(); byte[] tmp = new byte[1 << 16]; @@ -315,7 +302,35 @@ public static byte[] readbinaryfile(InputStream stream) throws IOException { return bytes.toByteArray(); } - public static String readtextfile(InputStream stream) throws IOException { + /** + * Read a limited number of bytes from a stream + * + * @param stream + * @param buffer into which to read + * @parm offset place to start read into buffer + * @param count amount to read; <= |buffer| + * @return amount actually read + * @throws IOException + */ + static public int readbinaryfilepartial(InputStream stream, byte[] buffer, int count) throws IOException { + try { + // Extract the stream into a bytebuffer + int offset = 0; + int remainder = count; + while (remainder > 0) { + int red = stream.read(buffer, offset, remainder); + if (red <= 0) + break; + remainder -= red; + offset += red; + } + return offset; + } catch (IOException ioe) { + throw new dap4.core.util.DapException(ioe); + } + } + + static public String readtextfile(InputStream stream) throws IOException { StringBuilder buf = new StringBuilder(); InputStreamReader rdr = new InputStreamReader(stream, UTF8); for (;;) { @@ -332,7 +347,7 @@ public static String readtextfile(InputStream stream) throws IOException { * top-level variable to and including the given variable * such that all but the last element is a structure. */ - public static List getStructurePath(DapVariable var) { + static public List getStructurePath(DapVariable var) { List path = var.getPath(); List structpath = new ArrayList(); for (int i = 0; i < path.size(); i++) { @@ -357,21 +372,31 @@ public static List getStructurePath(DapVariable var) { * @param path * @return path or "" */ - public static String denullify(String path) { + static public String denullify(String path) { return (path == null ? "" : path); } + /** + * Convert null objects to "" + * + * @param obj + * @return obj or "" + */ + static public Object stringable(Object obj) { + return (obj == null ? "" : obj); + } + /** * Convert "" paths to null * * @param path * @return path or null */ - public static String nullify(String path) { + static public String nullify(String path) { return (path != null && path.length() == 0 ? null : path); } - public static long[] getDimSizes(List dims) { + static public long[] getDimSizes(List dims) { long[] sizes = new long[dims.size()]; for (int i = 0; i < dims.size(); i++) { sizes[i] = dims.get(i).getSize(); @@ -379,7 +404,7 @@ public static long[] getDimSizes(List dims) { return sizes; } - public static long dimProduct(List dimset) // dimension crossproduct + static public long dimProduct(List dimset) // dimension crossproduct { long count = 1; for (DapDimension dim : dimset) { @@ -421,7 +446,7 @@ public static long dimProduct(List dimset) // dimension crossprodu * @param dimset the list of DapDimension * @return true if slices is whole wrt dimset; false otherwise */ - public static boolean isWhole(List slices, List dimset) { + static public boolean isWhole(List slices, List dimset) { if (slices.size() != dimset.size()) return false; for (int i = 0; i < slices.size(); i++) { @@ -433,7 +458,7 @@ public static boolean isWhole(List slices, List dimset) { return true; } - public static long sliceProduct(List slices) // another crossproduct + static public long sliceProduct(List slices) // another crossproduct { long count = 1; if (slices != null) @@ -443,7 +468,7 @@ public static long sliceProduct(List slices) // another crossproduct return count; } - public static boolean hasStrideOne(List slices) { + static public boolean hasStrideOne(List slices) { for (Slice slice : slices) { if (slice.getStride() != 1) return false; @@ -462,7 +487,7 @@ public static boolean hasStrideOne(List slices) { * @param upto end point for join (exclusive) * @return the join */ - public static String join(String[] array, String sep, int from, int upto) { + static public String join(String[] array, String sep, int from, int upto) { if (sep == null) sep = ""; if (from < 0 || upto > array.length) @@ -485,22 +510,30 @@ public static String join(String[] array, String sep, int from, int upto) { * @param path * @return Relativized path */ - public static String xrelpath(String path) { + static public String xrelpath(String path) { return DapUtil.canonicalpath(path); } /** - * return true if this path appears to start with a windows drive letter + * Return true if this path appears to start with a windows drive letter + * This tests the patterns "/x:/" and "x:/" * * @param path * @return true, if path has drive letter */ - public static boolean hasDriveLetter(String path) { - boolean hasdr = false; - if (path != null && path.length() >= 2) { - hasdr = (DRIVELETTERS.indexOf(path.charAt(0)) >= 0 && path.charAt(1) == ':'); - } - return hasdr; + static public boolean hasDriveLetter(String path) { + return XURI.hasDriveLetter(path); + } + + /** + * Convert a path of the form "/x:/" to "x:/" to expose drive letter; + * otherwise leave unchanged + * + * @param path + * @return repaired path + */ + static public String repairPath(String path) { + return XURI.hideDriveLetter(path); } /** @@ -510,7 +543,7 @@ public static boolean hasDriveLetter(String path) { * @param breakpoint return the index past last protocol * @return list of leading protocols without the trailing : */ - public static List getProtocols(String url, int[] breakpoint) { + static public List getProtocols(String url, int[] breakpoint) { // break off any leading protocols; // there may be more than one. // Watch out for Windows paths starting with a drive letter. @@ -540,7 +573,7 @@ public static List getProtocols(String url, int[] breakpoint) { return allprotocols; } - public static String merge(String[] pieces, String sep) { + static public String merge(String[] pieces, String sep) { if (pieces == null) return ""; StringBuilder buf = new StringBuilder(); @@ -573,12 +606,12 @@ static String multiSliceString(List> slices) { /** * Re-throw run-time exceptions */ - public static void checkruntime(Exception e) { + static public void checkruntime(Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; } - public static String canonjoin(String prefix, String suffix) { + static public String canonjoin(String prefix, String suffix) { StringBuilder result = new StringBuilder(); if (prefix == null) prefix = ""; @@ -587,13 +620,19 @@ public static String canonjoin(String prefix, String suffix) { prefix = DapUtil.canonicalpath(prefix); suffix = DapUtil.canonicalpath(suffix); result.append(prefix); - if (!prefix.endsWith("/")) - result.append("/"); - result.append(suffix.startsWith("/") ? suffix.substring(1) : suffix); + result.append("/"); + result.append(suffix); + // Remove // occurrences + while (true) { + int pos = result.indexOf("//"); + if (pos < 0) + break; + result.deleteCharAt(pos); + } return result.toString(); } - public static boolean hasWindowsDrive(final String path) { + static public boolean hasWindowsDrive(final String path) { if (path != null && path.length() >= 2 && path.charAt(1) == ':') { final char c = path.charAt(0); return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); @@ -601,94 +640,35 @@ public static boolean hasWindowsDrive(final String path) { return false; } - public static boolean isAbsolutePath(final String path) { + static public boolean isAbsolutePath(final String path) { return path != null && (hasWindowsDrive(path) || path.charAt(0) == '/' || path.charAt(0) == '\\'); } - public static String canonFileURL(String url) { + static public String canonFileURL(String url) { if (url == null || url.startsWith("file:")) return url; return "file:" + absolutize(url); } - ////////////////////////////////////////////////// - - /** - * Helper functions for reading - */ - - /** - * Provide a helper function to convert an Index object to - * a slice list. - * - * @param indices indicate value to read - * @param template variable template - * @return corresponding List - * @throws DapException - */ - - public static List indexToSlices(Index indices, DapVariable template) throws dap4.core.util.DapException { - List dims = template.getDimensions(); - List slices = indexToSlices(indices, dims); - return slices; - } - - public static List indexToSlices(Index indices, List dimset) throws dap4.core.util.DapException { - List slices = indexToSlices(indices); - return slices; - } - - /** - * Provide a helper function to convert an offset to - * a slice list. - * - * @param offset offset - * @param template variable template - * - * @return slices - * @throws DapException - */ - public static List offsetToSlices(long offset, DapVariable template) throws DapException { - List dims = template.getDimensions(); - long[] dimsizes = DapUtil.getDimSizes(dims); - return indexToSlices(offsetToIndex(offset, dimsizes), template); + static public String stripDap4Extensions(String path) { + for (;;) { + Matcher m = DAP4EXT_RE.matcher(path); + if (!m.matches()) + break; + String match = m.group(1); + int pathlen = path.length(); + path = path.substring(0, pathlen - match.length()); + } + return path; } - /** - * Given an offset (single index) and a set of dimensions - * compute the set of dimension indices that correspond - * to the offset. - */ - public static Index offsetToIndex(long offset, long[] dimsizes) { - // offset = d3*(d2*(d1*(x1))+x2)+x3 - long[] indices = new long[dimsizes.length]; - for (int i = dimsizes.length - 1; i >= 0; i--) { - indices[i] = offset % dimsizes[i]; - offset = (offset - indices[i]) / dimsizes[i]; - } - return new Index(indices, dimsizes); - } + ////////////////////////////////////////////////// /** - * Given an offset (single index) and a set of dimensions - * compute the set of dimension indices that correspond - * to the offset. + * Helper functions for reading */ - public static List indexToSlices(Index indices) throws DapException { - // short circuit the scalar case - if (indices.getRank() == 0) - return Slice.SCALARSLICES; - // offset = d3*(d2*(d1*(x1))+x2)+x3 - List slices = new ArrayList<>(indices.rank); - for (int i = 0; i < indices.rank; i++) { - long isize = indices.indices[i]; - slices.add(new Slice(isize, isize + 1, 1, indices.dimsizes[i])); - } - return slices; - } - /** * Test if a set of slices represent a contiguous region * This is equivalent to saying all strides are one @@ -696,7 +676,7 @@ public static List indexToSlices(Index indices) throws DapException { * @param slices * @return true, if contiguous */ - public static boolean isContiguous(List slices) { + static public boolean isContiguous(List slices) { for (Slice sl : slices) { if (sl.getStride() != 1) return false; @@ -710,7 +690,7 @@ public static boolean isContiguous(List slices) { * @param slices * @return true, if single position */ - public static boolean isSinglePoint(List slices) { + static public boolean isSinglePoint(List slices) { for (Slice sl : slices) { if (sl.getCount() != 1) return false; @@ -718,29 +698,8 @@ public static boolean isSinglePoint(List slices) { return true; } - /** - * If a set of slices refers to a single position, - * then return the corresponding Index. Otherwise, - * throw Exception. - * - * @param slices - * @return Index corresponding to slices - * @throws DapException - */ - public static Index slicesToIndex(List slices) throws DapException { - long[] positions = new long[slices.size()]; - long[] dimsizes = new long[slices.size()]; - for (int i = 0; i < positions.length; i++) { - Slice s = slices.get(i); - if (s.getCount() != 1) - throw new DapException("Attempt to convert non-singleton sliceset to index"); - positions[i] = s.getFirst(); - dimsizes[i] = s.getMax(); - } - return new Index(positions, dimsizes); - } - public static List dimsetToSlices(List dimset) throws dap4.core.util.DapException { + static public List dimsetToSlices(List dimset) throws dap4.core.util.DapException { if (dimset == null || dimset.size() == 0) return Slice.SCALARSLICES; List slices = new ArrayList(dimset.size()); @@ -752,12 +711,25 @@ public static List dimsetToSlices(List dimset) throws dap4. return slices; } - public static boolean isScalarSlices(List slices) { + static public boolean isScalarSlices(List slices) { if (slices == null || slices.size() != 1) return false; Slice s = slices.get(0); return (s.getFirst() == 0 && s.getStop() == 1); } + static public long[] longvector(int[] iv) { + long[] lv = new long[iv.length]; + for (int i = 0; i < iv.length; i++) + lv[i] = (long) iv[i]; + return lv; + } + + static public int[] intvector(long[] lv) { + int[] iv = new int[lv.length]; + for (int i = 0; i < lv.length; i++) + iv[i] = (int) lv[i]; + return iv; + } } diff --git a/dap4/d4core/src/main/java/dap4/core/util/Escape.java b/dap4/src/main/java/dap4/core/util/Escape.java similarity index 99% rename from dap4/d4core/src/main/java/dap4/core/util/Escape.java rename to dap4/src/main/java/dap4/core/util/Escape.java index 80c3c470d0..872d0e0a34 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/Escape.java +++ b/dap4/src/main/java/dap4/core/util/Escape.java @@ -57,6 +57,9 @@ public static String entityEscape(String s, String wrt) { StringBuilder escaped = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); + // XML cannot handle nul char so just suppress it altogether + if (c == 0) + continue; int index = wrt.indexOf(c); if (index < 0) escaped.append(c); @@ -82,9 +85,6 @@ public static String entityEscape(String s, String wrt) { case '\n': escaped.append(c); // These are the only legal control chars break; - case '\0': - // What to do about nul? currrently we suppress it - break; default: if (c >= ' ') escaped.append(c); diff --git a/dap4/d4core/src/main/java/dap4/core/util/IndentWriter.java b/dap4/src/main/java/dap4/core/util/IndentWriter.java similarity index 95% rename from dap4/d4core/src/main/java/dap4/core/util/IndentWriter.java rename to dap4/src/main/java/dap4/core/util/IndentWriter.java index ff3bec0ed9..42cc4c63f0 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/IndentWriter.java +++ b/dap4/src/main/java/dap4/core/util/IndentWriter.java @@ -114,11 +114,17 @@ public void pop() { // Margin cognizant print functions public void eol() { - super.println(""); + super.print("\r\n"); + } + + @Override + public void println() { + eol(); } public void marginPrintln(String text) { - marginPrint(text + "\n"); + marginPrint(text); + println(); } public void marginPrintln() { diff --git a/dap4/d4core/src/main/java/dap4/core/util/MultiSlice.java b/dap4/src/main/java/dap4/core/util/MultiSlice.java similarity index 97% rename from dap4/d4core/src/main/java/dap4/core/util/MultiSlice.java rename to dap4/src/main/java/dap4/core/util/MultiSlice.java index 716c3895c6..f5916d01de 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/MultiSlice.java +++ b/dap4/src/main/java/dap4/core/util/MultiSlice.java @@ -22,7 +22,7 @@ public class MultiSlice extends Slice { protected List subslices; // cache some values - protected long count = -1; + protected int count = -1; ////////////////////////////////////////////////// // Constructor(s) @@ -78,7 +78,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - long accum = 0; + int accum = 0; for (int i = 0; i < this.subslices.size(); i++) { Slice s = this.subslices.get(i); accum += s.hashCode() * i; @@ -166,12 +166,12 @@ public Slice getSubSlice(int i) { @Override - public long getCount() { + public int getCount() { return this.count; } @Override - public Slice setMaxSize(long size) throws DapException { + public Slice setMaxSize(int size) throws DapException { for (int i = 0; i < this.subslices.size(); i++) { this.subslices.get(i).setMaxSize(size); } diff --git a/dap4/d4core/src/main/java/dap4/core/util/PowerSet.java b/dap4/src/main/java/dap4/core/util/PowerSet.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/PowerSet.java rename to dap4/src/main/java/dap4/core/util/PowerSet.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/ResponseFormat.java b/dap4/src/main/java/dap4/core/util/ResponseFormat.java similarity index 57% rename from dap4/d4core/src/main/java/dap4/core/util/ResponseFormat.java rename to dap4/src/main/java/dap4/core/util/ResponseFormat.java index 740a528766..85ee220644 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/ResponseFormat.java +++ b/dap4/src/main/java/dap4/core/util/ResponseFormat.java @@ -10,14 +10,20 @@ * Define the enum for the possible Response/Response modes */ public enum ResponseFormat { - TEXT("txt"), XML("xml"), HTML("html"), NONE(null); + TEXT("text", "txt"), XML("xml", "xml"), HTML("html", "html"), NONE("none", null); + private String id; private String format; - ResponseFormat(String format) { + ResponseFormat(String id, String format) { + this.id = id; this.format = format; } + public String id() { + return id; + } + public String format() { return format; } @@ -32,8 +38,18 @@ public static ResponseFormat formatFor(String s) { return null; } + public static ResponseFormat idFormat(String id) { + if (id == null) + return null; + for (ResponseFormat format : ResponseFormat.values()) { + if (id.equalsIgnoreCase(format.id)) + return format; + } + return null; + } + public String toString() { - return format; + return id; } } diff --git a/dap4/d4core/src/main/java/dap4/core/util/Slice.java b/dap4/src/main/java/dap4/core/util/Slice.java similarity index 84% rename from dap4/d4core/src/main/java/dap4/core/util/Slice.java rename to dap4/src/main/java/dap4/core/util/Slice.java index b0b5a2f558..aa2ccc71c7 100644 --- a/dap4/d4core/src/main/java/dap4/core/util/Slice.java +++ b/dap4/src/main/java/dap4/core/util/Slice.java @@ -20,6 +20,9 @@ * Note that first cannot be undefined because it always defaults to zero; * similarly stride defaults to one. * Slice Supports iteration. + * + * Note that a slice is quite similar to a scalar DataIndex. + * * Modifiied 10/15/2016 to support zero sized slices. */ @@ -32,20 +35,19 @@ public class Slice { // its "last" value is the UNDEFINED value). // This will primarily be used in the constraint expression parser - // static public final long UNDEFINED = 0x7FFFFFFFFFFFFFFFL; - public static final long UNDEFINED = -1L; + static public final int UNDEFINED = -1; // Define maximum legal dimension based on the spec - public static final long MAXLENGTH = 0x3FFFFFFFFFFFFFFFL; + static public final int MAXLENGTH = 0x3FFFFFFF; - public static enum Sort { + static public enum Sort { Single, Multi; } // Define a set of slices indicating the canonical scalar set - public static List SCALARSLICES; - public static Slice SCALARSLICE; + static public List SCALARSLICES; + static public Slice SCALARSLICE; static { try { @@ -66,22 +68,22 @@ public static enum Sort { /** * First index */ - long first = UNDEFINED; + int first = UNDEFINED; /** * Last+1 index; (stop - first) should be size of the slice. */ - long stop = UNDEFINED; + int stop = UNDEFINED; /** * Stride */ - long stride = UNDEFINED; + int stride = UNDEFINED; /** * Max size (typically the size of the underlying dimension) */ - long maxsize = MAXLENGTH; + int maxsize = MAXLENGTH; /** * Indicate if this is known to be a whole slice @@ -103,11 +105,11 @@ public static enum Sort { public Slice() {} - public Slice(long first, long stop, long stride) throws DapException { + public Slice(int first, int stop, int stride) throws DapException { this(first, stop, stride, UNDEFINED); } - public Slice(long first, long stop, long stride, long maxsize) throws DapException { + public Slice(int first, int stop, int stride, int maxsize) throws DapException { this(); setIndices(first, stop, stride, maxsize); } @@ -121,7 +123,7 @@ public Slice(Slice s) throws DapException { public Slice(DapDimension dim) throws DapException { this(); - setIndices(0, dim.getSize(), 1, dim.getSize()); + setIndices(0, (int) dim.getSize(), 1, (int) dim.getSize()); setWhole(true); setConstrained(false); } @@ -178,41 +180,45 @@ public Sort getSort() { return this.sort; } - public long getFirst() { + public int getFirst() { return this.first; } - public long getStop() { + public int getStop() { return this.stop; } - public long getLast() { + public int getLast() { return ((this.stop - this.first) == 0 ? 0 : this.stop - 1); } - public long getStride() { + public int getStride() { return this.stride; } - public long getSize() // not same as getcount and not same as maxsize + public int getSize() // not same as getcount and not same as maxsize { return (this.stop - this.first); } - public long getMax() // not same as getcount and not same as maxsize + public int getMax() // not same as getcount and not same as maxsize { return this.maxsize; } - public Slice setMaxSize(long size) throws DapException { + public boolean isScalar() { + return this.getSize() <= 1; + } + + public Slice setMaxSize(int size) throws DapException { return setIndices(this.first, this.stop, this.stride, size); } - public Slice setIndices(long first, long stop, long stride) throws DapException { + public Slice setIndices(int first, int stop, int stride) throws DapException { return setIndices(first, stop, stride, UNDEFINED); } - public Slice setIndices(long first, long stop, long stride, long maxsize) throws DapException { + public Slice setIndices(int first, int stop, int stride, int maxsize) throws DapException { this.first = first; this.stop = stop; this.stride = stride; @@ -246,9 +252,9 @@ public Slice setConstrained(Boolean tf) { * the slice. Note that this is different from * getStop() because stride is taken into account. */ - public long getCount() { + public int getCount() { assert this.first != UNDEFINED && this.stride != UNDEFINED && this.stop != UNDEFINED; - long count = (this.stop) - this.first; + int count = (this.stop) - this.first; count = (count + this.stride - 1); count /= this.stride; return count; @@ -330,11 +336,11 @@ public String toConstraintString() throws DapException { * @return new, composed Range * @throws DapException */ - public static Slice compose(Slice target, Slice src) throws DapException { - long sr_stride = target.getStride() * src.getStride(); - long sr_first = MAP(target, src.getFirst()); - long lastx = MAP(target, src.getLast()); - long sr_last = (target.getLast() < lastx ? target.getLast() : lastx); // min(last(),lastx) + static public Slice compose(Slice target, Slice src) throws DapException { + int sr_stride = target.getStride() * src.getStride(); + int sr_first = MAP(target, src.getFirst()); + int lastx = MAP(target, src.getLast()); + int sr_last = (target.getLast() < lastx ? target.getLast() : lastx); // min(last(),lastx) return new Slice(sr_first, sr_last + 1, sr_stride, sr_last + 1).finish(); } @@ -346,7 +352,7 @@ public static Slice compose(Slice target, Slice src) throws DapException { * @return the i-th element of a range * @throws DapException if index is invalid */ - static long MAP(Slice target, long i) throws DapException { + static int MAP(Slice target, int i) throws DapException { if (i < 0) throw new DapException("Slice.compose: i must be >= 0"); if (i > target.getStop()) diff --git a/dap4/d4core/src/main/java/dap4/core/util/SliceConstraint.java b/dap4/src/main/java/dap4/core/util/SliceConstraint.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/SliceConstraint.java rename to dap4/src/main/java/dap4/core/util/SliceConstraint.java diff --git a/dap4/d4core/src/main/java/dap4/core/util/SliceIterator.java b/dap4/src/main/java/dap4/core/util/SliceIterator.java similarity index 100% rename from dap4/d4core/src/main/java/dap4/core/util/SliceIterator.java rename to dap4/src/main/java/dap4/core/util/SliceIterator.java diff --git a/dap4/src/main/java/dap4/core/util/XURI.java b/dap4/src/main/java/dap4/core/util/XURI.java new file mode 100644 index 0000000000..039bcbdf85 --- /dev/null +++ b/dap4/src/main/java/dap4/core/util/XURI.java @@ -0,0 +1,554 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.core.util; + +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Provide an extended form of URI parser with the following features: + * 1. can parse the query and fragment parts. + * 2. supports multiple protocols + * 3. supports modification of the URI path. + * 4. supports url -> string as controlled by flags + */ + +public class XURI { + + ////////////////////////////////////////////////// + // Constants + static final char QUERYSEP = '&'; + static final char FRAGMENTSEP = QUERYSEP; + static final char ESCAPECHAR = '\\'; + static final char PAIRSEP = '='; + + // static final String DRIVELETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + static protected final Pattern drivelettertest = Pattern.compile("^([/]?)[a-zA-Z][:]"); + static protected final Pattern filedrivelettertest = Pattern.compile("^(file://)([a-zA-Z][:].*)"); + + // Define assembly flags + + public static enum Parts { + SCHEME, // base protocol(s) + PWD, // including user + HOST, // including port + PATH, QUERY, FRAG; + } + + // Mnemonics + public static final EnumSet URLONLY = EnumSet.of(Parts.SCHEME, Parts.PWD, Parts.HOST, Parts.PATH); + public static final EnumSet URLALL = + EnumSet.of(Parts.SCHEME, Parts.PWD, Parts.HOST, Parts.PATH, Parts.QUERY, Parts.FRAG); + public static final EnumSet URLQUERY = + EnumSet.of(Parts.SCHEME, Parts.PWD, Parts.HOST, Parts.PATH, Parts.QUERY); + + ////////////////////////////////////////////////// + // Instance variables + + // Unfortunately, URI is final and so cannot be used as super class + // Rather we use delegation. + URI parent; // Does the bulk of the parsing + + // protected String originaluri = null; + protected boolean isfile = false; + + protected List nonleadschemes = new ArrayList<>(); // all schemes after the first + + protected Map queryfields // decomposed query + = null; + protected Map fragfields // decomposed fragment + = null; + + ////////////////////////////////////////////////// + // Constructor(s) + + public XURI(String xu) throws URISyntaxException { + xu = XURI.canonical(xu); + if (xu == null) + throw new URISyntaxException("null", "null valued URI string"); + xu = fixURI(xu); + parent = new URI(xu); // this should be correct + this.isfile = "file".equalsIgnoreCase(getScheme()); + } + + /** + * This makes an incoming url parseable by URI + * Fix various issues such as: + * -- multiple schemes + * -- windows drive letters in path + */ + String fixURI(String xu) throws URISyntaxException { + // Extract all schemes + String[] schemes = allSchemes(xu); + if (schemes.length == 0) + return xu; // no schemes at all + int iremainder = xu.indexOf("//"); + xu = schemes[0] + ":" + xu.substring(iremainder); // remove all but lead scheme + nonleadschemes.addAll(Arrays.asList(schemes).subList(1, schemes.length)); + // Look for windows drive letter + Matcher m = filedrivelettertest.matcher(xu); + if (m.lookingAt()) { + String prefix = m.group(1); + String pathplus = m.group(2); + // rebuild + xu = prefix + hideDriveLetter(pathplus); + } + return xu; + } + + // Pull off all the schemes into schemelist + // return the uri string with just the leading scheme + String parseSchemes(String xu, List schemelist) throws URISyntaxException { + int iremainder = xu.indexOf("//"); + if (iremainder <= 0) + throw new URISyntaxException(xu, "URI has no scheme"); + String[] schemes = xu.substring(0, iremainder).split(":"); + String lead = schemes[0]; + xu = lead + ":" + xu.substring(iremainder, xu.length()); + schemelist.clear(); + for (int i = 1; i < schemes.length; i++) + schemelist.add(schemes[i]); + return xu; + } + + public XURI(URL xu) throws URISyntaxException { + this.parent = new URI(xu.getProtocol().toLowerCase(), xu.getUserInfo(), xu.getHost(), xu.getPort(), xu.getFile(), + xu.getQuery(), xu.getRef()); + // this.originaluri = this.toString(); // save the original uri + } + + public XURI(URI xu) throws URISyntaxException { + this.parent = new URI(xu.getScheme().toLowerCase(), xu.getUserInfo(), xu.getHost(), xu.getPort(), xu.getPath(), + xu.getQuery(), xu.getFragment()); + // this.originaluri = this.toString(); // save the original uri + } + + ////////////////////////////////////////////////// + // Delegation + + // Getters + public String getUserInfo() { + return parent.getUserInfo(); + } + + public String getHost() { + return parent.getHost(); + } + + public int getPort() { + return parent.getPort(); + } + + public String getPath() { + return parent.getPath(); + } + + /** + * Return a path that can be used to open a file + * + * @return + */ + public String getRealPath() { + return truePath(getPath()); + } + + public String getQuery() { + return parent.getQuery(); + } + + public String getFragment() { + return parent.getFragment(); + } + + public String getScheme() { + return parent.getScheme(); + } // return lead protocol + + public List getSchemes() { // return lead scheme + nonleadschemes + if (parent.getScheme() == null) + return null; + List allschemes = new ArrayList<>(); + allschemes.add(parent.getScheme()); + allschemes.addAll(nonleadschemes); + return allschemes; // return lead scheme + } + + // Setters + public void setScheme(String xscheme) { + try { + this.parent = new URI(xscheme.toLowerCase(), parent.getUserInfo(), parent.getHost(), parent.getPort(), + parent.getPath(), parent.getQuery(), parent.getFragment()); + } catch (URISyntaxException use) { + throw new AssertionError("URI.setScheme: Internal error: malformed URI", use); + } + } + + public void setUserInfo(String xuserinfo) { + try { + this.parent = new URI(parent.getScheme(), xuserinfo, parent.getHost(), parent.getPort(), parent.getPath(), + parent.getQuery(), parent.getFragment()); + } catch (URISyntaxException use) { + throw new AssertionError("URI.setUserInfo: Internal error: malformed URI", use); + } + } + + public void setHost(String xhost) { + try { + this.parent = new URI(parent.getScheme(), parent.getUserInfo(), xhost, parent.getPort(), parent.getPath(), + parent.getQuery(), parent.getFragment()); + } catch (URISyntaxException use) { + throw new AssertionError("URI.setHost: Internal error: malformed URI", use); + } + } + + public void setPort(int xport) { + try { + this.parent = new URI(parent.getScheme(), parent.getUserInfo(), parent.getHost(), xport, parent.getPath(), + parent.getQuery(), parent.getFragment()); + } catch (URISyntaxException use) { + throw new AssertionError("URI.setPort: Internal error: malformed URI", use); + } + } + + public void setPath(String xpath) { + try { + if (hasDriveLetter(xpath) && xpath.charAt(0) != '/') + xpath = "/" + xpath; // make it URI parseable + this.parent = new URI(parent.getScheme(), parent.getUserInfo(), parent.getHost(), parent.getPort(), xpath, + parent.getQuery(), parent.getFragment()); + } catch (URISyntaxException use) { + throw new AssertionError("URI.setPath: Internal error: malformed URI", use); + } + } + + public void setQuery(String xquery) { + try { + this.parent = new URI(parent.getScheme(), parent.getUserInfo(), parent.getHost(), parent.getPort(), + parent.getPath(), xquery, parent.getFragment()); + this.queryfields = null; + } catch (URISyntaxException use) { + throw new AssertionError("URI.setQuery: Internal error: malformed URI", use); + } + } + + public void setFragment(String xfragment) { + try { + this.parent = new URI(parent.getScheme(), parent.getUserInfo(), parent.getHost(), parent.getPort(), + parent.getPath(), parent.getQuery(), xfragment); + this.fragfields = null; + } catch (URISyntaxException use) { + throw new AssertionError("URI.setFragment: Internal error: malformed URI", use); + } + } + + public String toString() { + return assemble(URLALL); + } + + /** + * Allow queryfields to be inserted + * + * @param key + * @param newval + * @return previous value or this value if key not set + */ + public void insertQueryField(String key, String newval) { + // Watch out in case there is no query + this.queryfields = insertAmpField(key, newval, parent.getQuery()); + rebuildQuery(); + } + + /** + * Allow queryfields to be removed + * + * @param key + * @return previous value (may be null) + */ + public void removeQueryField(String key) { + // Watch out in case there is no query + this.queryfields = removeAmpField(key, parent.getQuery()); + rebuildQuery(); + } + + /** + * Rebuild query from current queryfields + */ + protected void rebuildQuery() { + if (queryfields == null) + return; + StringBuffer query = new StringBuffer(); + boolean first = true; + for (Map.Entry entry : queryfields.entrySet()) { + if (!first) + query.append("&"); + query.append(Escape.urlEncodeQuery((String) entry.getKey())); + query.append("="); + query.append(Escape.urlEncodeQuery((String) entry.getValue())); + first = false; + } + String newquery = null; + if (query.length() > 0) + newquery = query.toString(); + setQuery(newquery); + } + + ////////////////////////////////////////////////// + // Accessors (other than delegations) + + // public String getOriginal() { + // return originaluri; + // } + + public boolean isFile() { + return this.isfile; + } + + public Map getQueryFields() { + if (this.queryfields == null) + parseQuery(); + return this.queryfields; + } + + public Map getFragFields() { + if (this.fragfields == null) + parseFragment(); + return this.fragfields; + } + + protected void parseQuery() { + this.queryfields = parseAmpList(getQuery(), QUERYSEP, ESCAPECHAR); + } + + protected void parseFragment() { + this.fragfields = parseAmpList(getFragment(), FRAGMENTSEP, ESCAPECHAR); + } + + protected Map insertAmpField(String key, String value, String query) { + Map fields = parseAmpList(query, '&', '\\'); + fields.put(key, value); + return fields; + } + + protected Map removeAmpField(String key, String query) { + Map fields = parseAmpList(query, '&', '\\'); + fields.remove(key); + return fields; + } + + protected Map parseAmpList(String s, char sep, char escape) { + Map map = new HashMap<>(); + List pieces; + if (s == null) + s = ""; + pieces = escapedsplit(s, sep, escape); + for (String piece : pieces) { + int plen = piece.length(); + // Split on first '=' + int index = findunescaped(piece, 0, PAIRSEP, escape, plen); + if (index < 0) + index = plen; + String key = piece.substring(0, index); + String value = (index >= plen ? "" : piece.substring(index + 1, plen)); + key = Escape.urlDecode(key); + key = key.toLowerCase(); // for consistent lookup + value = Escape.urlDecode(value); + map.put(key, value); + } + return map; + } + + /* + * Split s into pieces as separated by separator and taking + * escape characters into account. + */ + protected List escapedsplit(String s, char sep, char escape) { + List pieces = new ArrayList<>(); + int len = s.length(); + int from = 0; + while (from < len) { + int index = findunescaped(s, from, sep, escape, len); + if (index < 0) + index = len; + pieces.add(s.substring(from, index)); + from = index + 1; + } + return pieces; + } + + /* + * It is probably possible to do this with regexp patterns, + * but I do not know how. + * + * The goal is to find next instance of unescaped separator character. + * Leave any escape characters in place. + * Return index of next separator starting at start. + * If not found, then return -1; + */ + protected int findunescaped(String s, int start, char sep, char escape, int len) { + int i; + for (i = start; i < len; i++) { + char c = s.charAt(i); + if (c == escape) { + i++; + } else if (c == sep) { + return i; + } + } + return -1; /* not found */ + } + + ////////////////////////////////////////////////// + // API + + /** + * Reassemble the url using the specified parts + * + * @param parts to include + * @return the assembled uri + */ + + public String assemble(EnumSet parts) { + StringBuilder uri = new StringBuilder(); + if (parts.contains(Parts.SCHEME) && this.getScheme() != null) { + uri.append(this.getScheme()); + for (int i = 0; i < nonleadschemes.size(); i++) { + uri.append(':'); + uri.append(nonleadschemes.get(i)); + } + uri.append("://"); + } + if (parts.contains(Parts.PWD) && this.getUserInfo() != null) { + uri.append(this.getUserInfo()); + uri.append("@"); + } + if (parts.contains(Parts.HOST) && this.getHost() != null) { + uri.append(this.getHost()); + if (this.getPort() > 0) { + uri.append(":"); + uri.append(this.getPort()); + } + } + if (parts.contains(Parts.PATH) && this.getPath() != null) { + uri.append(this.getPath()); + } + if (parts.contains(Parts.QUERY) && this.getQuery() != null) { + uri.append("?"); + uri.append(this.getQuery()); + } + if (parts.contains(Parts.FRAG) && this.getFragment() != null) { + uri.append("#"); + uri.append(this.getFragment()); + } + return uri.toString(); + } + + + // if the url is file:// and the path part has a windows drive letter, then the parent URL will not recognize this + // correctly. + public String fixdriveletter(URI uri) throws URISyntaxException { + if (!uri.getScheme().equalsIgnoreCase("file")) + return uri.toString(); + String tmp = uri.getHost(); // we use host because this is how URI parses such urls + if (!hasDriveLetter(tmp)) + return uri.toString(); // Original file url did not a have Windows drive letter + // rebuild the original URI (ugh!) + StringBuilder newxu = new StringBuilder(); + newxu.append(uri.getScheme()); + newxu.append("://"); + if (uri.getUserInfo() != null) { + newxu.append(uri.getUserInfo()); + newxu.append("@"); + } + newxu.append("/"); + newxu.append(uri.getHost()); // that's where the drive letter ends up + newxu.append(":"); + newxu.append(uri.getPath()); + if (uri.getQuery() != null) { + newxu.append("?"); + newxu.append(uri.getQuery()); + } + if (uri.getFragment() != null) { + newxu.append("#"); + newxu.append(uri.getFragment()); + } + return newxu.toString(); + } + + //////////////////////////////////////////////// + /** + * Canonicalize a part of a URL + * + * @param s part of the url + */ + static public String canonical(String s) { + if (s != null) { + s = s.trim(); + if (s.length() == 0) + s = null; + } + return s; + } + + /** + * return true if this path appears to start with a windows drive letter + * including those hidden by leading '/' + * + * @param path + * @return true, if path has drive letter + */ + static public boolean hasDriveLetter(String path) { + Matcher m = drivelettertest.matcher(path); + return m.lookingAt(); + } + + /** + * Return a path with possible windows drive letter hidden by '/'. + * Repair => convert "x:/" to "/x:/" where x is a drive letter + * + * @return repaired path + */ + static public String hideDriveLetter(String path) { + Matcher m = drivelettertest.matcher(path); + if (m.lookingAt()) { + if (m.group(1).equals("")) + path = "/" + path; + } + return path; + } + + /** + * Extract all schemes at front of a url. + * + * @parem xu url string + * @return vector of schemes + */ + static public String[] allSchemes(String xu) { + int endschemes = xu.indexOf("//"); + if (endschemes < 0) + return new String[0]; + String[] schemes = xu.substring(0, endschemes).split(":"); + return schemes; + } + + /** + * return repaired path; if this path appears to start with a windows drive letter + * hidden by leading '/', then the leading '/' is removed + * + * @param path + * @return repaired path + */ + static public String truePath(String path) { + // Check for a windows drive and repair + Matcher m = drivelettertest.matcher(path); + if (m.lookingAt() && m.group(1) != null) + path = path.substring(1); + return path; + } +} diff --git a/dap4/src/main/java/dap4/dap4lib/D4Array.java b/dap4/src/main/java/dap4/dap4lib/D4Array.java new file mode 100644 index 0000000000..bed89c73a6 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/D4Array.java @@ -0,0 +1,94 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.dmr.*; +import dap4.core.interfaces.ArrayScheme; +import ucar.ma2.Array; + +/** + * Wrap an Array representing a variables' data, where the variable + * is top-level or a field. The wrapper contains some additional + * information beside the Array. + */ + +public class D4Array { + + ////////////////////////////////////////////////// + // Mnemonics + static final long NULLOFFSET = -1; + + static final int D4LENSIZE = 8; + + ////////////////////////////////////////////////// + // Instance Variables + + protected D4DSP dsp; + protected ArrayScheme scheme; // Roughly, what kind of array + protected DapNode template; + protected Array array = null; // the Array object for the variable + protected Object storage = null; // The storage underlying Array + + ////////////////////////////////////////////////// + // Constructor(s) + + public D4Array(ArrayScheme scheme, D4DSP dsp, DapVariable template) { + this.scheme = scheme; + this.template = template; + this.dsp = dsp; + } + + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append(getScheme().toString()); + if (getScheme() == ArrayScheme.STRUCTARRAY || getScheme() == ArrayScheme.SEQARRAY) + buf.append("[]"); + buf.append(":"); + buf.append(getTemplate().toString()); + return buf.toString(); + } + + ////////////////////////////////////////////////// + // set/get + + public D4DSP getDSP() { + return this.dsp; + } + + public ArrayScheme getScheme() { + return this.scheme; + } + + public DapNode getTemplate() { + return this.template; + } + + public Array getArray() { + return this.array; + } + + public Object getStorage() { + return this.storage; + } + + public boolean isScalar() { + return ((DapVariable) getTemplate()).getRank() == 0; + } + + public D4Array setArray(Array a) { + this.array = a; + return this; + } + + public D4Array setStorage(Object store) { + this.storage = store; + return this; + } + + +} + + diff --git a/dap4/src/main/java/dap4/dap4lib/D4DSP.java b/dap4/src/main/java/dap4/dap4lib/D4DSP.java new file mode 100644 index 0000000000..e6f1edc533 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/D4DSP.java @@ -0,0 +1,401 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.dmr.*; +import dap4.core.dmr.parser.DOM4Parser; +import dap4.core.dmr.parser.Dap4Parser; +import dap4.core.util.ChecksumMode; +import dap4.core.util.*; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static dap4.core.util.DapConstants.*; + +/** + * This Class takes a DAP4 serialization (as chunked input) stream + * and exports access to a compiled DMR, a compiled DAP4 data stream, + * and various parameters such as byteorder of the data stream. + * + * Most of the work is done by this class. Its subclasses need + * only provide a raw byte stream to DAP4 chunked data taken + * from e.g. a raw data file or an HTTP connection. + * + * It cannot be used standalone. + */ + +public abstract class D4DSP { + + ////////////////////////////////////////////////// + // Constants + + public static boolean DEBUG = false; + protected static final boolean PARSEDEBUG = true; + + ////////////////////////////////////////////////// + // Instance variables + + protected String dmrtext = null; + protected DapDataset dmr = null; + protected String location = null; + + // Input stream + protected DeChunkedInputStream stream = null; + protected boolean streamclosed = false; + + protected XURI xuri = null; + + // Exported information + protected ByteOrder remoteorder = null; + protected ChecksumMode checksummode = null; + protected RequestMode mode = null; + + // DAP stream compilation + D4DataCompiler d4compiler = null; + + protected Map datamap = new HashMap<>(); + + ////////////////////////////////////////////////// + // Constructor(s) + + public D4DSP() {} + + ////////////////////////////////////////////////// + + /** + * "open" a reference to a data source and return the DSP wrapper. + * + * @param location - Object that defines the data source + * @param cmode + * @return = wrapping dsp + * @throws DapException + */ + public D4DSP open(String location, ChecksumMode cmode) throws DapException { + this.location = location; + this.checksummode = cmode; + parseURL(location); + return this; + } + + + ////////////////////////////////////////////////// + // Accessors + + public DeChunkedInputStream getStream() { + return this.stream; + } + + public ChecksumMode getChecksumMode() { + return this.checksummode; + } + + public Map getVariableDataMap() { + return this.datamap; + } + + public Map getChecksumMap(ChecksumSource src) { + if (src == ChecksumSource.LOCAL) + return this.d4compiler.localchecksummap; + else + return this.d4compiler.remotechecksummap; + } + + protected D4DSP setStream(InputStream input, RequestMode mode) throws IOException { + this.mode = mode; + this.stream = new DeChunkedInputStream(input, mode); // side effect: read DMR &/or error + this.streamclosed = false; + if (this.stream.getState() == DeChunkedInputStream.State.ERROR) + reportError(this.stream.getErrorText()); + this.dmrtext = this.stream.getDMRText(); + // This is the definitive remote byte order + this.remoteorder = this.stream.getRemoteOrder(); + return this; + } + + protected void addVariableData(DapVariable var, D4Array cursor) { + this.datamap.put(var, cursor); + } + + public DapDataset getDMR() { + return this.dmr; + } + + protected void setDMR(DapDataset dmr) { + this.dmr = dmr; + if (this.dmr != null) { + // Add some canonical attributes to the + this.dmr.setDataset(this.dmr); + this.dmr.setDapVersion(DapConstants.X_DAP_VERSION); + this.dmr.setDMRVersion(DapConstants.X_DMR_VERSION); + this.dmr.setNS(DapConstants.X_DAP_NS); + } + } + + /* + * public static String printDMR(DapDataset dmr) { + * StringWriter sw = new StringWriter(); + * PrintWriter pw = new PrintWriter(sw); + * DMRPrinter printer = new DMRPrinter(dmr, pw); + * try { + * printer.print(); + * pw.close(); + * sw.close(); + * } catch (IOException e) { + * } + * return sw.toString(); + * } + */ + + ////////////////////////////////////////////////// + // Subclass defined + + /** + * Determine if a path refers to an object processable by this DSP + * + * @param path + * @param context + * @return true if this path can be processed by an instance of this DSP + */ + abstract public boolean dspMatch(String path, DapContext context); + + ////////////////////////////////////////////////// + // Compilation + + /** + * Extract the DMR from available dechunked data + * + * @throws DapException + */ + public void loadDMR() throws IOException { + String document = readDMR(); + DapDataset dmr = parseDMR(document); + setDMR(dmr); + if (this.mode == RequestMode.DMR) { + assert !this.streamclosed; + this.stream.close(); // no longer needed + this.streamclosed = true; + } + } + + public void loadDAP() throws IOException { + try { + // "Compile" the databuffer section of the server response + d4compiler = new D4DataCompiler(this, this.checksummode, this.remoteorder); + d4compiler.compile(); + assert !this.streamclosed; + this.stream.close(); // no longer needed + this.streamclosed = true; + } catch (IOException ioe) { + throw new DapException(ioe); + } + } + + public void loadContext(DapContext cxt, RequestMode mode) { + switch (mode) { + case DMR: + break; + case DAP: + cxt.put(ChecksumSource.REMOTE, d4compiler.getChecksumMap(ChecksumSource.REMOTE)); + cxt.put(ChecksumSource.LOCAL, d4compiler.getChecksumMap(ChecksumSource.LOCAL)); + cxt.put(D4Array.class, getVariableDataMap()); + break; + } + } + + protected String readDMR() throws IOException { + // Get and clean up dmr + String dmrtext = this.stream.getDMRText(); + dmrtext = dmrtext.trim(); + if (dmrtext.length() == 0) + throw new DapException("Empty DMR"); + StringBuilder buf = new StringBuilder(dmrtext); + // remove any trailing '\n' + int len = buf.length(); + if (buf.charAt(len - 1) == '\n') + buf.setLength(--len); + // Make sure it has trailing \r" + if (buf.charAt(len - 1) != '\r') + buf.append('\r'); + // Make sure it has trailing \n" + buf.append('\n'); + return buf.toString(); + } + + ////////////////////////////////////////////////// + // Misc. Utilities + + protected void parseURL(String url) throws DapException { + try { + this.xuri = new XURI(url); + } catch (URISyntaxException use) { + throw new DapException(use); + } + } + + protected String getMethodUrl(RequestMode mode, ChecksumMode csum) throws DapException { + xuri.removeQueryField(DapConstants.CHECKSUMTAG); + csum = ChecksumMode.asTrueFalse(csum); + String scsum = ChecksumMode.toString(csum); + xuri.insertQueryField(DapConstants.CHECKSUMTAG, scsum); + String corepath = DapUtil.stripDap4Extensions(xuri.getPath()); + // modify url to read the dmr|dap + if (mode == RequestMode.DMR) + xuri.setPath(corepath + ".dmr.xml"); + else if (mode == RequestMode.DAP) + xuri.setPath(corepath + ".dap"); + else + throw new DapException("Unexpected mode: " + mode); + String methodurl = xuri.assemble(XURI.URLQUERY); + return methodurl; + } + + /** + * It is common to want to parse a DMR text to a DapDataset, + * so provide this utility. + * + * @param document the dmr to parse + * @return the parsed dmr + * @throws DapException on parse errors + */ + + protected DapDataset parseDMR(String document) throws DapException { + // Parse the dmr + Dap4Parser parser; + // if(USEDOM) + parser = new DOM4Parser(null); + // else + // parser = new DOM4Parser(new DefaultDMRFactory()); + if (PARSEDEBUG) + parser.setDebugLevel(1); + try { + if (!parser.parse(document)) + throw new DapException("DMR Parse failed"); + } catch (SAXException se) { + throw new DapException(se); + } + if (parser.getErrorResponse() != null) + throw new DapException("Error Response Document not supported"); + DapDataset result = parser.getDMR(); + processAttributes(result); + processMaps(result); + return result; + } + + /** + * Some attributes that are added by the NetcdfDataset + * need to be kept out of the DMR. This function + * defines that set. + * + * @param attrname + * @return true if the attribute should be suppressed, false otherwise. + */ + protected boolean suppressAttributes(String attrname) { + if (attrname.startsWith("_Coord")) + return true; + if (attrname.equals("_Unsigned")) + return true; + return false; + } + + void getEndianAttribute(DapDataset dataset) { + DapAttribute a = dataset.findAttribute(DapConstants.LITTLEENDIANATTRNAME); + if (a == null) + return; + Object v = a.getValues(); + int len = java.lang.reflect.Array.getLength(v); + if (len == 0) + this.remoteorder = ByteOrder.LITTLE_ENDIAN; + else { + String onezero = java.lang.reflect.Array.get(v, 0).toString(); + int islittle = 1; + try { + islittle = Integer.parseInt(onezero); + } catch (NumberFormatException e) { + islittle = 1; + } + if (islittle == 0) + this.remoteorder = ByteOrder.BIG_ENDIAN; + else + this.remoteorder = ByteOrder.LITTLE_ENDIAN; + } + } + + /** + * Walk the dataset tree and remove selected attributes + * such as _Unsigned + * + * @param dataset + */ + protected void processAttributes(DapDataset dataset) throws DapException { + List nodes = dataset.getNodeList(); + for (DapNode node : nodes) { + switch (node.getSort()) { + case GROUP: + case DATASET: + case VARIABLE: + Map attrs = node.getAttributes(); + if (attrs.size() > 0) { + List suppressed = new ArrayList<>(); + for (DapAttribute dattr : attrs.values()) { + if (suppressAttributes(dattr.getShortName())) + suppressed.add(dattr); + } + for (DapAttribute dattr : suppressed) { + node.removeAttribute(dattr); + } + } + break; + default: + break; /* ignore */ + } + } + // Try to extract the byte order + getEndianAttribute(dataset); + } + + /** + * Walk the dataset tree and link nodes = dataset.getNodeList(); + for (DapNode node : nodes) { + switch (node.getSort()) { + case MAP: + DapMap map = (DapMap) node; + String targetname = map.getTargetName(); + DapVariable target; + target = (DapVariable) dataset.findByFQN(targetname, DapSort.VARIABLE, DapSort.SEQUENCE, DapSort.STRUCTURE); + if (target == null) + throw new DapException("Mapref: undefined target variable: " + targetname); + // Verify that this is a legal map => + // 1. it is outside the scope of its parent if the parent + // is a structure. + DapNode container = target.getContainer(); + if ((container.getSort() == DapSort.STRUCTURE || container.getSort() == DapSort.SEQUENCE)) + throw new DapException("Mapref: map target variable not in outer scope: " + targetname); + map.setVariable(target); + break; + default: + break; /* ignore */ + } + } + } + + protected void reportError(String errmsg) throws IOException { + throw new DapException(errmsg); + } + +} diff --git a/dap4/src/main/java/dap4/dap4lib/D4DataCompiler.java b/dap4/src/main/java/dap4/dap4lib/D4DataCompiler.java new file mode 100644 index 0000000000..459b5d6b44 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/D4DataCompiler.java @@ -0,0 +1,500 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + + +package dap4.dap4lib; + +import dap4.core.util.ChecksumMode; +import dap4.core.dmr.*; +import dap4.core.util.*; +import dap4.dap4lib.cdm.CDMTypeFcns; +import dap4.dap4lib.cdm.CDMUtil; +import dap4.dap4lib.cdm.nc2.D4StructureDataIterator; +import ucar.ma2.*; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static dap4.core.interfaces.ArrayScheme.*; + +public class D4DataCompiler { + + public static boolean DEBUG = false; + + ////////////////////////////////////////////////// + // Constants + + ////////////////////////////////////////////////// + // Instance variables + + protected DapDataset dmr = null; + + protected ChecksumMode checksummode = null; + protected ByteOrder remoteorder = null; + + protected D4DSP dsp; + protected DeChunkedInputStream stream = null; + + // Checksum information + // We have two checksum maps: one for the remotely calculated value + // and one for the locally calculated value. + protected Map localchecksummap = new HashMap<>(); + protected Map remotechecksummap = new HashMap<>(); + + ////////////////////////////////////////////////// + // Constructor(s) + + /** + * Constructor + * + * @param dsp the D4DSP + * @param checksummode + * @param remoteorder + */ + + public D4DataCompiler(D4DSP dsp, ChecksumMode checksummode, ByteOrder remoteorder) throws DapException { + this.dsp = dsp; + this.dmr = this.dsp.getDMR(); + this.stream = this.dsp.getStream(); + this.checksummode = ChecksumMode.asTrueFalse(checksummode); + this.remoteorder = remoteorder; + } + + ////////////////////////////////////////////////// + // Accessors + + public Map getChecksumMap(DapConstants.ChecksumSource src) { + switch (src) { + case LOCAL: + return this.localchecksummap; + case REMOTE: + return this.remotechecksummap; + } + return null; + } + + protected void setChecksum(DapConstants.ChecksumSource src, DapVariable dvar, Long csum) { + switch (src) { + case LOCAL: + this.localchecksummap.put(dvar, csum); + case REMOTE: + this.remotechecksummap.put(dvar, csum); + } + } + + ////////////////////////////////////////////////// + // DataCompiler API + + /** + * The goal here is to process the serialized + * databuffer and pull out top-level variable positions + * in the serialized databuffer. + * In some cases -- String, Sequence, Structure -- + * significant transforms are applied to the data + * to make it usable with ucar.ma2.Array. + * + * @throws DapException + */ + public void compile() throws IOException { + assert (this.dmr != null && this.stream != null); + // iterate over the variables represented in the databuffer + for (DapVariable vv : this.dmr.getTopVariables()) { + Object storage = compileVar(vv); + D4Array data = new D4Array(schemeFor(vv), this.dsp, vv).setStorage(storage); + assert data.getArray() == null; + data.setArray(createArray(vv, data.getStorage())); + this.dsp.addVariableData(vv, data); + } + } + + /** + * Return a compiled version of the data for this variable. + * Possible return values are: + * 1. String - String[] + * 2. Opaque - Bytebuffer[] + * 3. Fixed atomic - [] + * 4. Structure - Object[][nfields] + * 5. Sequence - Object[][nfields] + */ + protected Object compileVar(DapVariable dapvar) throws IOException { + Object data = null; + DapType type = dapvar.getBaseType(); + if (dapvar.isTopLevel() && this.checksummode == ChecksumMode.TRUE) + this.stream.startChecksum(); + if (type.isAtomic()) + data = compileAtomicVar(dapvar); + else if (type.isStructType()) { + data = compileStructureArray(dapvar); + } else if (type.isSeqType()) { + data = compileSequenceArray(dapvar); + } + if (dapvar.isTopLevel() && this.checksummode == ChecksumMode.TRUE) { + // Save the locally computed checksum + long localcrc32 = this.stream.endChecksum(); // extract the remotechecksum from databuffer src, + setChecksum(DapConstants.ChecksumSource.LOCAL, dapvar, localcrc32); + // Save the checksum sent by the server + long remotecrc32 = extractChecksum(); + setChecksum(DapConstants.ChecksumSource.REMOTE, dapvar, remotecrc32); + } + return data; + } + + /** + * Compile fixed-sized atomic types + * Storage = [] + * + * @param var + * @return data + * @throws DapException + */ + protected Object compileAtomicVar(DapVariable var) throws IOException { + DapType daptype = var.getBaseType(); + + // special cases + if (daptype.isStringType()) // string or URL + return compileStringVar(var); + if (daptype.isOpaqueType()) + return compileOpaqueVar(var); + + // All other fixed-size atomic types + long dimproduct = var.getCount(); + long total = dimproduct * daptype.getSize(); + byte[] bytes = new byte[(int) total]; // total space required + int red = this.stream.read(bytes); + if (red <= 0) + throw new IOException("D4DataCompiler: read failure"); + if (red < total) + throw new DapException("D4DataCompiler: short read"); + // Convert to vector of required type + Object storage = CDMTypeFcns.bytesAsTypeVec(daptype, bytes); + CDMTypeFcns.decodebytes(this.remoteorder, daptype, bytes, storage); + return storage; + } + + /** + * Read and convert a string typed array + * + * @param var + * @return cursor + * @throws DapException + */ + protected Object compileStringVar(DapVariable var) throws IOException { + DapType daptype = var.getBaseType(); + assert daptype.isStringType(); + long dimproduct = var.getCount(); // == # strings + String[] storage = new String[(int) dimproduct]; + int count = 0; + // read each string + for (int i = 0; i < dimproduct; i++) { + int strsize = getCount(); + byte[] sbytes = new byte[strsize]; + int red = this.stream.read(sbytes); + assert red == strsize; + storage[count] = new String(sbytes, DapUtil.UTF8); + count++; + } + return storage; + } + + /** + * Read and convert an opaque typed array + * + * @param var + * @return cursor + * @throws DapException + */ + protected Object compileOpaqueVar(DapVariable var) throws IOException { + DapType daptype = var.getBaseType(); + assert daptype.isOpaqueType(); + long dimproduct = var.getCount(); // == # opaque objects + ByteBuffer[] storage = new ByteBuffer[(int) dimproduct]; + int count = 0; + // read each string + for (int i = 0; i < dimproduct; i++) { + int osize = getCount(); + byte[] obytes = new byte[osize]; + int red = this.stream.read(obytes); + assert red == osize; + storage[count] = ByteBuffer.wrap(obytes); + count++; + } + return storage; + } + + /** + * Compile a structure array. + * Since we are using ArrayStructureMA, we need to capture + * Our storage is Object[dimproduct]; this will be + * converted properly when the D4Cursor Array is created. + * + * @param var the template + * @return a StructureData[dimproduct] for the data for this struct. + * @throws DapException + */ + protected Object compileStructureArray(DapVariable var) throws IOException { + DapStructure dapstruct = (DapStructure) var.getBaseType(); + long dimproduct = var.getCount(); + Object[] storage = new Object[(int) dimproduct]; + Index idx = Index.factory(CDMUtil.computeEffectiveShape(var.getDimensions())); + long idxsize = idx.getSize(); + for (int offset = 0; (offset < idxsize); offset++) { + Object instance = compileStructure(dapstruct); + storage[offset] = instance; + } + return storage; + } + + /** + * Compile a structure instance. + * Storage is Object[dapstruct.getFields().size()]; + * + * @param dapstruct The template + * @return A DataStructure for the databuffer for this struct. + * @throws DapException + */ + protected Object compileStructure(DapStructure dapstruct) throws IOException { + List dfields = dapstruct.getFields(); + Object[] storage = new Object[dfields.size()]; + for (int m = 0; m < dfields.size(); m++) { + DapVariable dfield = dfields.get(m); + Object dvfield = compileVar(dfield); + storage[m] = dvfield; + } + return storage; + } + + /** + * Compile a sequence array. + * Our storage is Object[dimproduct] + * + * @param var the template + * @return Object[recordcount] + * @throws DapException + */ + protected Object compileSequenceArray(DapVariable var) throws IOException { + DapSequence dapseq = (DapSequence) var.getBaseType(); + long dimproduct = var.getCount(); + Object[] storage = new Object[(int) dimproduct]; + Index idx = Index.factory(CDMUtil.computeEffectiveShape(var.getDimensions())); + long idxsize = idx.getSize(); + for (int offset = 0; (offset < idxsize); offset++) { + Object seq = compileSequence(dapseq); + storage[offset] = seq; + } + return storage; + } + + /** + * Compile a sequence as a set of records. + * Our storage is Object[] where |storage| == nrecords + * + * @param dapseq + * @return sequence + * @throws DapException + */ + public Object compileSequence(DapSequence dapseq) throws IOException { + List dfields = dapseq.getFields(); + // Get the count of the number of records + long nrecs = getCount(); + Object[] records = new Object[(int) nrecs]; + for (int r = 0; r < nrecs; r++) { + Object record = compileStructure((DapStructure) dapseq); + records[r] = record; + } + return records; + } + + ////////////////////////////////////////////////// + // Utilities + + protected long extractChecksum() throws IOException { + assert this.checksummode == ChecksumMode.TRUE; + byte[] bytes = new byte[4]; // 4 == sizeof(checksum) + int red = this.stream.read(bytes); + assert red == 4; + ByteBuffer bb = ByteBuffer.wrap(bytes).order(this.remoteorder); + long csum = (int) bb.getInt(); + csum = csum & 0x00000000FFFFFFFF; + csum = csum & 0x00000000FFFFFFFFL; /* crc is 32 bits unsigned */ + return csum; + } + + protected void skip(long count) throws IOException { + for (long i = 0; i < count; i++) { + int c = this.stream.read(); + if (c < 0) + break; + } + } + + protected int getCount() throws IOException { + byte[] bytes = new byte[8]; // 8 == sizeof(long) + int red = this.stream.read(bytes); + assert red == 8; + ByteBuffer bb = ByteBuffer.wrap(bytes).order(this.remoteorder); + long count = bb.getLong(); + count = (count & 0xFFFFFFFF); + return (int) count; + } + + /** + * Compute the size in databuffer of the serialized form + * + * @param daptype + * @return type's serialized form size + */ + protected int computeTypeSize(DapType daptype) { + return LibTypeFcns.size(daptype); + } + + protected long walkByteStrings(long[] positions, ByteBuffer databuffer) throws IOException { + int count = positions.length; + long total = 0; + int savepos = databuffer.position(); + // Walk each bytestring + for (int i = 0; i < count; i++) { + int pos = databuffer.position(); + positions[i] = pos; + int size = getCount(); + total += DapConstants.COUNTSIZE; + total += size; + skip(size); + } + databuffer.position(savepos);// leave position unchanged + return total; + } + + public Array createArray(DapVariable var, Object storage) { + Array array = null; + switch (schemeFor(var)) { + case ATOMIC: + array = createAtomicArray(var, storage); + break; + case STRUCTARRAY: + array = createStructureArray(var, storage); + break; + case SEQARRAY: + array = createSequenceArray(var, storage); + break; + case STRUCTURE: + case SEQUENCE: + default: + assert false; + } + return array; + } + + protected Array createAtomicArray(DapVariable var, Object storage) { + DapType dtype = var.getBaseType(); + if (dtype.isEnumType()) { + // Coverity[FB.BC_UNCONFIRMED_CAST] + dtype = ((DapEnumeration) (var.getBaseType())); + } + DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dtype); + int[] shape = CDMUtil.computeEffectiveShape(var.getDimensions()); + Array array = Array.factory(cdmtype, shape, storage); + return array; + } + + protected Array createStructureArray(DapVariable var, Object storage) { + DapType dtype = var.getBaseType(); + StructureMembers members = computemembers(var); + int[] shape = CDMUtil.computeEffectiveShape(var.getDimensions()); + Object[] instances = (Object[]) storage; + StructureData[] structdata = new StructureData[instances.length]; + for (int i = 0; i < instances.length; i++) { + Object[] fields = (Object[]) instances[i]; + StructureDataW sdw = new StructureDataW(members); + for (int f = 0; f < members.getMembers().size(); f++) { + StructureMembers.Member fm = sdw.getMembers().get(f); + DapVariable d4field = ((DapStructure) dtype).getField(f); + Object fielddata = fields[f]; + Array fieldarray = createArray(d4field, fielddata); + sdw.setMemberData(fm, fieldarray); + } + structdata[i] = sdw; + } + ArrayStructureW array = new ArrayStructureW(members, shape, structdata); + return array; + } + + /** + * Create an Array object for a DAP4 Sequence. + * Unfortunately, the whole CDM Sequence/VLEN mechanism + * is completely hosed, with no hope of a simple fix. + * It appears that the only thing we can do is support scalar sequences. + * However in useless hope, the code is written as if arrays of sequences + * can be supported. + * + * @param var + * @param storage + * @return + */ + protected Array createSequenceArray(DapVariable var, Object storage) { + DapType dtype = var.getBaseType(); + StructureMembers members = computemembers(var); + int[] shape = CDMUtil.computeEffectiveShape(var.getDimensions()); + Object[] allinstancedata = (Object[]) storage; + int ninstances = allinstancedata.length; + if (ninstances != 1) // enforce scalar assumption + throw new IndexOutOfBoundsException("Non-scalar Dap4 Sequences not supported"); + Array[] allinstances = new Array[ninstances]; + for (int i = 0; i < ninstances; i++) { // iterate over all sequence instances array + Object[] ithelemdata = (Object[]) allinstancedata[i]; + int nrecords = ithelemdata.length; + StructureData[] allrecords = new StructureData[nrecords]; // for creating the record iterator + for (int r = 0; r < nrecords; r++) { // iterate over the records of one sequence + Object[] onerecorddata = (Object[]) ithelemdata[r]; + StructureDataW onerecord = new StructureDataW(members); + for (int f = 0; f < members.getMembers().size(); f++) { // iterate over fields in one record + StructureMembers.Member fm = members.getMember(f); + DapVariable d4field = ((DapStructure) dtype).getField(f); + Array fieldarray = createArray(d4field, onerecorddata[f]); + onerecord.setMemberData(fm, fieldarray); + } + allrecords[r] = onerecord; + } + D4StructureDataIterator onesequence = new D4StructureDataIterator().setList(allrecords); + ArraySequence oneseq = new ArraySequence(members, onesequence, nrecords); + allinstances[i] = oneseq; + } + return allinstances[0]; // enforce scalar assumption + } + + /** + * Compute the StructureMembers object + * from a DapStructure. May need to recurse + * if a field is itself a Structure + * + * @param var The DapVariable to use to construct + * a StructureMembers object. + * @return The StructureMembers object for the given DapStructure + */ + static StructureMembers computemembers(DapVariable var) { + DapStructure ds = (DapStructure) var.getBaseType(); + StructureMembers sm = new StructureMembers(ds.getShortName()); + List fields = ds.getFields(); + for (int i = 0; i < fields.size(); i++) { + DapVariable field = fields.get(i); + DapType dt = field.getBaseType(); + DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt); + StructureMembers.Member m = + sm.addMember(field.getShortName(), "", null, cdmtype, CDMUtil.computeEffectiveShape(field.getDimensions())); + m.setDataParam(i); // So we can index into various lists + // recurse if this field is itself a structure + if (dt.getTypeSort().isStructType()) { + StructureMembers subsm = computemembers(field); + m.setStructureMembers(subsm); + } + } + return sm; + } + +} + diff --git a/dap4/src/main/java/dap4/dap4lib/D4Index.java b/dap4/src/main/java/dap4/dap4lib/D4Index.java new file mode 100644 index 0000000000..ad3b1b294b --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/D4Index.java @@ -0,0 +1,152 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.util.DapException; +import dap4.core.util.Slice; +import ucar.ma2.Index; + +import java.util.ArrayList; +import java.util.List; + +public class D4Index extends ucar.ma2.Index { + + public static final D4Index SCALAR = new D4Index(0); + + ////////////////////////////////////////////////// + // Static methods + + /** + * Given an offset (single index) and a set of dimensions + * compute the set of dimension indices that correspond + * to the offset. + */ + static public Index offsetToIndex(int offset, int[] shape) { + // offset = d3*(d2*(d1*(x1))+x2)+x3 + int[] indices = new int[shape.length]; + for (int i = shape.length - 1; i >= 0; i--) { + indices[i] = offset % shape[i]; + offset = (offset - indices[i]) / shape[i]; + } + return new Index(indices, shape); + } + + /** + * Convert ucar.ma2.Index to list of slices + * + * @param indices to convert + * @return list of corresponding slices + */ + + static public List indexToSlices(ucar.ma2.Index indices) throws DapException { + // short circuit the scalar case + int rank = indices.getRank(); + if (rank == 0) + return Slice.SCALARSLICES; + List slices = new ArrayList<>(rank); + int[] counter = indices.getCurrentCounter(); + for (int i = 0; i < rank; i++) { + int isize = counter[i]; + slices.add(new Slice(isize, isize + 1, 1, indices.getShape(i))); + } + return slices; + } + + /** + * If a set of slices refers to a single position, + * then return the corresponding Index. Otherwise, + * throw Exception. + * + * @param slices + * @return Index corresponding to slices + * @throws DapException + */ + static public D4Index slicesToIndex(List slices) throws DapException { + int[] positions = new int[slices.size()]; + int[] dimsizes = new int[slices.size()]; + for (int i = 0; i < positions.length; i++) { + Slice s = slices.get(i); + if (s.getCount() != 1) + throw new DapException("Attempt to convert non-singleton sliceset to index"); + positions[i] = s.getFirst(); + dimsizes[i] = s.getMax(); + } + D4Index result = new D4Index(dimsizes); + result.set(positions); + return result; + } + + ////////////////////////////////////////////////// + // Constructor(s) + + public D4Index(int rank) { + super(rank); + } + + public D4Index(int[] _shape) { + super(_shape); + } + + public D4Index(D4Index index) { + this(index.getRank()); + if (this.rank > 0) { + System.arraycopy(index.getCurrentCounter(), 0, this.current, 0, this.rank); + System.arraycopy(index.getShape(), 0, this.getShape(), 0, this.rank); + } + } + + public D4Index(int[] indices, int[] dimsizes) { + super(dimsizes); + if (this.rank > 0) { + System.arraycopy(indices, 0, this.current, 0, this.rank); + } + } + + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append('['); + for (int i = 0; i < this.rank; i++) { + if (i > 0) + buf.append(','); + buf.append(this.current[i]); + buf.append('/'); + buf.append(this.shape[i]); + } + buf.append("]("); + buf.append(this.index()); + buf.append(")"); + return buf.toString(); + } + + /** + * Compute the linear index + * from the current odometer indices. + * Not quite the same as super.currentElement(), + * which does not use shape[], but does use the super's + * "unexpected" notion of stride, although result may be same. + */ + public int index() { + int offset = this.offset; + int[] cur = getCurrentCounter(); + int[] sh = getShape(); + for (int i = 0; i < cur.length; i++) { + offset *= sh[i]; + offset += cur[i]; + } + return offset; + } + + public int getCurrentCounter(int i) { + if (i < 0 || i >= this.rank) + throw new IllegalArgumentException(); + return getCurrentCounter()[i]; + } + + public boolean isScalar() { + return (rank == 0 && getCurrentCounter().length == 1 && index() == 1); + } + +} diff --git a/dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java b/dap4/src/main/java/dap4/dap4lib/DSPRegistry.java similarity index 85% rename from dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java rename to dap4/src/main/java/dap4/dap4lib/DSPRegistry.java index 24b228cc8d..bdc920a2e6 100644 --- a/dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java +++ b/dap4/src/main/java/dap4/dap4lib/DSPRegistry.java @@ -3,7 +3,7 @@ * See the LICENSE file for more information. */ -package dap4.core.data; +package dap4.dap4lib; import dap4.core.util.DapContext; import dap4.core.util.DapException; @@ -25,10 +25,10 @@ public class DSPRegistry { // Type Decls protected static class Registration { - Class dspclass; - DSP matcher; + Class dspclass; + D4DSP matcher; - public Registration(Class cl) { + public Registration(Class cl) { this.dspclass = cl; try { this.matcher = dspclass.newInstance(); @@ -83,7 +83,7 @@ public static void setLoader(ClassLoader ldr) { */ public synchronized void register(String className, boolean last) throws DapException { try { - Class klass = (Class) loader.loadClass(className); + Class klass = (Class) loader.loadClass(className); register(klass, last); } catch (ClassNotFoundException e) { throw new DapException(e); @@ -99,7 +99,7 @@ public synchronized void register(String className, boolean last) throws DapExce * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassCastException if class doesnt implement DSP interface. */ - public synchronized void register(Class klass, boolean last) { + public synchronized void register(Class klass, boolean last) { // is this already defined? if (registered(klass)) return; @@ -115,7 +115,7 @@ public synchronized void register(Class klass, boolean last) { * @param klass Class for which to search */ - public synchronized boolean registered(Class klass) { + public synchronized boolean registered(Class klass) { for (Registration r : registry) { if (r.dspclass == klass) return true; @@ -128,7 +128,7 @@ public synchronized boolean registered(Class klass) { * * @param klass Class for which to search */ - public synchronized void unregister(Class klass) { + public synchronized void unregister(Class klass) { for (int i = 0; i < registry.size(); i++) { if (registry.get(i).dspclass == klass) { registry.remove(i); @@ -143,13 +143,13 @@ public synchronized void unregister(Class klass) { * @throws DapException */ - public synchronized DSP findMatchingDSP(String path, DapContext cxt) throws DapException { + public synchronized D4DSP findMatchingDSP(String path, DapContext cxt) throws DapException { for (int i = 0; i < registry.size(); i++) { try { Registration tester = registry.get(i); boolean ismatch = (Boolean) tester.matcher.dspMatch(path, cxt); if (ismatch) { - DSP dsp = (DSP) tester.dspclass.newInstance(); + D4DSP dsp = (D4DSP) tester.dspclass.newInstance(); return dsp; } } catch (Exception e) { diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DapCodes.java b/dap4/src/main/java/dap4/dap4lib/DapCodes.java similarity index 100% rename from dap4/d4lib/src/main/java/dap4/dap4lib/DapCodes.java rename to dap4/src/main/java/dap4/dap4lib/DapCodes.java diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DapLog.java b/dap4/src/main/java/dap4/dap4lib/DapLog.java similarity index 100% rename from dap4/d4lib/src/main/java/dap4/dap4lib/DapLog.java rename to dap4/src/main/java/dap4/dap4lib/DapLog.java diff --git a/dap4/src/main/java/dap4/dap4lib/DapProtocol.java b/dap4/src/main/java/dap4/dap4lib/DapProtocol.java new file mode 100644 index 0000000000..b94bcb7250 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/DapProtocol.java @@ -0,0 +1,164 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.util.ResponseFormat; +import dap4.core.util.XURI; + +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Store protocol related constants + */ + +public abstract class DapProtocol implements DapCodes { + + ////////////////////////////////////////////////// + // Constants + + // protected static final String DAPVERSION = "4.0"; + // protected static final String DMRVERSION = "1.0"; + + protected static final String DAP4PROTO = "dap4"; + + ////////////////////////////////////////////////// + // Static variables + + static protected final Set DAP4EXTENSIONS; + static protected final Set DAP4QUERYMARKERS; + static protected final Set DAP4SCHEMES; + + static { + DAP4EXTENSIONS = new HashSet(); + DAP4EXTENSIONS.add("dmr"); + DAP4EXTENSIONS.add("dap"); + DAP4EXTENSIONS.add("dst"); + + DAP4QUERYMARKERS = new HashSet(); + DAP4QUERYMARKERS.add("dap4.checksum"); + DAP4QUERYMARKERS.add("dap4.ce"); + + DAP4SCHEMES = new HashSet(); + DAP4SCHEMES.add("dap4"); + DAP4SCHEMES.add("http"); + DAP4SCHEMES.add("https"); + // Note that file: is missing + }; + + + // Map RequestMode X ResponseFormat => ContentType + public static Map contenttypes; + + static public String contentKey(RequestMode mode, ResponseFormat format) { + return mode.id() + "." + format.id(); + } + + static { + // Map request x response -> (contentype,mimetype) + // If response is none, then this indicates the default + contenttypes = new HashMap(); + contenttypes.put(contentKey(RequestMode.NONE, ResponseFormat.NONE), new ContentType(RequestMode.DSR, + ResponseFormat.XML, "application/vnd.opendap.dap4.dataset-services+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.DMR, ResponseFormat.NONE), new ContentType(RequestMode.DMR, + ResponseFormat.XML, "application/vnd.opendap.dap4.dataset-metadata+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.DMR, ResponseFormat.XML), new ContentType(RequestMode.DMR, + ResponseFormat.XML, "application/vnd.opendap.dap4.dataset-metadata+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.DAP, ResponseFormat.NONE), new ContentType(RequestMode.DAP, + ResponseFormat.NONE, "application/vnd.opendap.dap4.data", "application/octet-stream")); + contenttypes.put(contentKey(RequestMode.DSR, ResponseFormat.NONE), new ContentType(RequestMode.DSR, + ResponseFormat.HTML, "application/vnd.opendap.dap4.dataset-services+html", "text/html")); + contenttypes.put(contentKey(RequestMode.DSR, ResponseFormat.XML), new ContentType(RequestMode.DSR, + ResponseFormat.XML, "application/vnd.opendap.dap4.dataset-services+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.DSR, ResponseFormat.HTML), new ContentType(RequestMode.DSR, + ResponseFormat.HTML, "application/vnd.opendap.dap4.dataset-services+html", "text/html")); + contenttypes.put(contentKey(RequestMode.CAPABILITIES, ResponseFormat.NONE), new ContentType( + RequestMode.CAPABILITIES, ResponseFormat.HTML, "application/vnd.opendap.dap4.capabilities+html", "text/html")); + contenttypes.put(contentKey(RequestMode.CAPABILITIES, ResponseFormat.XML), new ContentType(RequestMode.CAPABILITIES, + ResponseFormat.XML, "application/vnd.opendap.dap4.capabilities+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.CAPABILITIES, ResponseFormat.HTML), new ContentType( + RequestMode.CAPABILITIES, ResponseFormat.HTML, "application/vnd.opendap.dap4.capabilities+html", "text/html")); + contenttypes.put(contentKey(RequestMode.ERROR, ResponseFormat.NONE), + new ContentType(RequestMode.ERROR, ResponseFormat.XML, "application/vnd.opendap.dap4.error+xml", "text/xml")); + contenttypes.put(contentKey(RequestMode.ERROR, ResponseFormat.XML), + new ContentType(RequestMode.ERROR, ResponseFormat.XML, "application/vnd.opendap.dap4.error+xml", "text/xml")); + // Everything else is an error + } + + ////////////////////////////////////////////////// + + public static class ContentType { + public RequestMode mode; + public ResponseFormat format; + public String contenttype; + public String mimetype; + + public ContentType(RequestMode mode, ResponseFormat format, String contenttype, String mimetype) { + this.mode = mode; + this.format = format; + this.contenttype = contenttype; + this.mimetype = mimetype; + } + } + + ////////////////////////////////////////////////// + // Definitive test if a url looks like it is a DAP4 url + + /** + * A path is a DAP4 path if at least one of the following is true. + * 1. it has "dap4:" as its leading protocol + * 2. it has protocol=dap4 | mode=dap4 | dap4 in its fragment + * 3. it has dmr|dsr|dap as its request extension + * 4. it has dap4|d4ts in its path + * + * @param xuri parsed uri + * @return true if this uri appears to be processible by DAP4 + */ + static public boolean isDap4URI(XURI xuri) { + boolean found = false; + // This is definitive + if ("dap4".equalsIgnoreCase(xuri.getScheme())) + return true; + // Necessary but not sufficient + if (!DAP4SCHEMES.contains(xuri.getScheme().toLowerCase())) + return false; + for (Map.Entry entry : xuri.getQueryFields().entrySet()) { + if (DAP4QUERYMARKERS.contains(entry.getKey())) + return true; // definitive + } + // Fragment checking is a bit more complex + String d4 = xuri.getFragFields().get("dap4"); + if (d4 != null) + return true; // definitive + String p = xuri.getFragFields().get("protocol"); + if (p != null) { + if (p.equalsIgnoreCase("dap4")) + return true; // definitive + } + String modes = xuri.getFragFields().get("mode"); + if (modes != null) { + String[] modelist = modes.split("[,]"); + for (String mode : modelist) { + if (mode.equalsIgnoreCase("dap4")) + return true; // definitive + } + } + return false; + } + + static public boolean isDap4URI(String uri) { + try { + XURI xuri = new XURI(uri); + return isDap4URI(xuri); + } catch (URISyntaxException use) { + return false; + } + } + +} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/DapStartLog.java b/dap4/src/main/java/dap4/dap4lib/DapStartLog.java similarity index 100% rename from dap4/d4lib/src/main/java/dap4/dap4lib/DapStartLog.java rename to dap4/src/main/java/dap4/dap4lib/DapStartLog.java diff --git a/dap4/src/main/java/dap4/dap4lib/DeChunkedInputStream.java b/dap4/src/main/java/dap4/dap4lib/DeChunkedInputStream.java new file mode 100644 index 0000000000..c11b509c06 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/DeChunkedInputStream.java @@ -0,0 +1,333 @@ +/* + * Copyright 2012, UCAR/Unidmodeata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + + +import dap4.core.util.DapConstants; +import dap4.core.util.DapException; +import dap4.core.util.DapUtil; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.zip.Checksum; + +/** + * This class transforms a chunked input stream to a de-chunked input stream. + * Given the input stream, produce a ByteBuffer with all chunking information removed. + * There are two special cases. + * 1. Error chunk -- cache the error chunk as text and provide accessors to obtain it. + * 2. DMR -- cache the DMR, whatever the mode, and provide accessors. + * + */ + +public class DeChunkedInputStream extends InputStream { + + ////////////////////////////////////////////////// + // Constants + + static final int DFALTCHUNKSIZE = 0x00FFFFFF; + + static final byte CR8 = DapUtil.extract(DapUtil.UTF8.encode("\r"))[0]; + static final byte LF8 = DapUtil.extract(DapUtil.UTF8.encode("\n"))[0]; + + static final int HDRSIZE = 4; // bytes + + ////////////////////////////////////////////////// + // Types + + static protected class Chunk { // Could we use ByteBuffer? + public byte[] chunk; + public int size; // note that chunk.length > size is possible + public int avail; + public int pos; + public int flags; // from last chunk header + + public Chunk() { + chunk = null; + size = 0; + avail = 0; + pos = 0; + flags = 0; + } + } + + static public enum State { + INITIAL, MORE, END, ERROR; + } + + ////////////////////////////////////////////////// + // Fields + + InputStream source = null; + + protected RequestMode mode = RequestMode.NONE; + + protected ByteOrder remoteorder = null; + protected State state = State.INITIAL; + protected Chunk chunk = null; // the whole current chunk + + protected Checksum crc32alg = new java.util.zip.CRC32(); + protected long crc32 = 0; + protected boolean checksumming = false; + + // Cache two special chunks + protected String errortext = null; + protected String dmrtext = null; + + ////////////////////////////////////////////////// + // Constructor(s) + + public DeChunkedInputStream(InputStream src, RequestMode mode) throws IOException { + this.source = src; + this.chunk = new Chunk(); + this.mode = mode; + readDMR(this.chunk); + if (state == State.ERROR) + throw new DapException("DeChunkedInputStream: cannot read DMR"); + } + + ////////////////////////////////////////////////// + // InputStream Defining Methods + + public int available() throws IOException { + throw new UnsupportedOperationException(); + } + + public void close() throws IOException { + this.source.close(); + } + + public void mark(int readlimit) { + throw new UnsupportedOperationException(); + } + + public void reset() throws IOException { + source.reset(); + } + + public boolean markSupported() { + return false; + } + + public int read() throws IOException { + if (this.chunk.avail == 0) { + int red = readChunk(this.chunk); // read next chunk + if (red <= 0) + return red; + } + assert this.chunk.avail > 0; + int c = this.chunk.chunk[this.chunk.pos]; + this.chunk.pos++; + this.chunk.avail--; + if (checksumming) + computeChecksum(c); + return c; + } + + // Reads some number of bytes from the input stream and stores them + // into the buffer array b. + public int read(byte[] b) throws IOException { + return read(b, 0, b.length); + } + + // Reads up to len bytes of data from the input stream into an array of bytes. + public int read(byte[] b, int off, int len) throws IOException { + if (b.length < off + len) + throw new DapException("DeChunkedInputStream: illegal arguments: len+offset > |b|"); // avoid overflow + int remainder = len; // track # of bytes to read + int pos = off; // read point in b + while (remainder > 0) { + if (this.chunk.avail == 0) { + int red = readChunk(this.chunk); // read next chunk + if (red <= 0) + throw new IOException("DeChunkedInputStream: IO error"); + assert this.chunk.avail == red; + } + assert this.chunk.avail > 0; + int avail = this.chunk.avail; + int toread = avail; // max readable + if (avail > remainder) + toread = remainder; // only read what we need + System.arraycopy(this.chunk.chunk, this.chunk.pos, b, pos, toread); // transfer what we can + this.chunk.pos += toread; // track source availability + this.chunk.avail -= toread; + pos += toread; // track dest availability + remainder -= toread; + } + if (checksumming) + computeChecksum(b, off, len); + return len; + } + + public long skip(long n) throws IOException { + long count = n; + while (count > 0) { + if (this.chunk.avail == 0) { + int red = readChunk(this.chunk); // read next chunk + if (red <= 0) + return (n - count); + assert this.chunk.avail == red; + } + assert this.chunk.avail > 0; + if (count <= this.chunk.avail) { + this.chunk.pos += count; + this.chunk.avail -= count; + count = n; // we read n bytes + break; + } else { + this.chunk.pos += this.chunk.avail; + this.chunk.avail -= this.chunk.avail; + count -= this.chunk.avail; + } + } + return count; + } + + ////////////////////////////////////////////////// + // Accessors + + public State getState() { + return this.state; + } + + public String getErrorText() { + return this.errortext; + } + + public String getDMRText() { + return this.dmrtext; + } + + // Primarily to access DMR and ERROR chunks + public byte[] getCurrentChunk() throws IOException { + if (this.state == State.INITIAL) + this.readChunk(this.chunk); // prime pump + byte[] truechunk = new byte[this.chunk.size]; + System.arraycopy(this.chunk.chunk, 0, truechunk, 0, this.chunk.size); + return truechunk; + }; + + public ByteOrder getRemoteOrder() { + return this.remoteorder; + } + + ////////////////////////////////////////////////// + // Methods + + protected int readChunk(Chunk chunk) throws IOException { + assert this.mode == RequestMode.DAP; + switch (state) { + case INITIAL: + case MORE: + if (!readHeader(this.chunk)) + throw new DapException("Malformed chunked source"); + if (state == State.INITIAL) + this.remoteorder = (this.chunk.flags & DapConstants.CHUNK_LITTLE_ENDIAN) == 0 ? ByteOrder.BIG_ENDIAN + : ByteOrder.LITTLE_ENDIAN; + // Figure out the next state + if ((this.chunk.flags & DapConstants.CHUNK_ERROR) == 1) + state = State.ERROR; + else if ((this.chunk.flags & DapConstants.CHUNK_END) == 1) + state = State.END; + else + state = State.MORE; + // Now read the chunk + if (this.chunk.chunk == null || this.chunk.size > this.chunk.chunk.length) + this.chunk.chunk = new byte[this.chunk.size]; // reallocate + this.chunk.pos = 0; + this.chunk.avail = this.chunk.size; + // read the whole chunk + int red = DapUtil.readbinaryfilepartial(source, this.chunk.chunk, this.chunk.size); + assert (red == this.chunk.size); + // If we are in an error state, then throw exception + if (this.state == State.ERROR) + throw new DapException("DeChunkedInputStream: Error chunk encountered"); + break; + case END: + case ERROR: + throw new DapException("Illegal chunk state"); + } + return this.chunk.size; + } + + protected int readDMR(Chunk chunk) throws IOException { + assert (this.state == State.INITIAL); + switch (this.mode) { + case DMR: + this.remoteorder = ByteOrder.nativeOrder(); // do not really know + this.chunk.chunk = DapUtil.readbinaryfile(source); // read whole input stream as DMR + this.chunk.size = this.chunk.chunk.length; + if (this.chunk.size > 0) { + this.dmrtext = new String(this.chunk.chunk, DapUtil.UTF8); + // Make sure the state looks correct + this.chunk.pos = this.chunk.size; + this.chunk.avail = 0; + this.state = State.END; + this.remoteorder = ByteOrder.nativeOrder(); // do not really know + } else { + this.state = State.ERROR; + throw new DapException("DeChunkedInputStream: Error chunk encountered when reading DMR"); + } + break; + case DAP: + this.remoteorder = ByteOrder.nativeOrder(); // do not really know + readChunk(this.chunk); + this.dmrtext = new String(this.chunk.chunk, DapUtil.UTF8); + this.skip(this.chunk.size); + break; + default: + throw new DapException("Illegal request mode"); + } + return this.chunk.size; + } + + /** + * Read the size+flags header from the input source and use it to + * initialize the chunk state + * + * @return true if header read false if immediate eof encountered or chunk is too short + */ + + protected boolean readHeader(Chunk chunk) throws IOException { + byte[] bytehdr = new byte[HDRSIZE]; + int red = this.source.read(bytehdr); + if (red < HDRSIZE) + return false; + int flags = ((int) bytehdr[0]) & 0xFF; // Keep unsigned + bytehdr[0] = 0; + ByteBuffer buf = ByteBuffer.wrap(bytehdr).order(ByteOrder.BIG_ENDIAN); + int size = buf.getInt(); + this.chunk.size = size; + this.chunk.flags = flags; + return true; + } + + public void startChecksum() { + this.checksumming = true; + crc32alg.reset(); + } + + public void computeChecksum(byte[] b, int offset, int extent) { + // Slice out the part on which to compute the CRC32 and compute CRC32 + crc32alg.update(b, offset, extent); + } + + public void computeChecksum(int b) { + // Slice out the part on which to compute the CRC32 and compute CRC32 + crc32alg.update(b); + } + + public long endChecksum() { + this.crc32 = crc32alg.getValue(); // get the digest value + this.crc32 = this.crc32 & 0x00000000FFFFFFFFL; /* crc is 32 bits unsigned */ + this.checksumming = false; + return this.crc32; + } + + +} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/ErrorException.java b/dap4/src/main/java/dap4/dap4lib/ErrorException.java similarity index 100% rename from dap4/d4lib/src/main/java/dap4/dap4lib/ErrorException.java rename to dap4/src/main/java/dap4/dap4lib/ErrorException.java diff --git a/dap4/src/main/java/dap4/dap4lib/HttpDSP.java b/dap4/src/main/java/dap4/dap4lib/HttpDSP.java new file mode 100644 index 0000000000..b028eaebab --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/HttpDSP.java @@ -0,0 +1,179 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.util.ChecksumMode; +import dap4.core.dmr.DapDataset; +import dap4.core.util.*; +import dap4.dap4lib.D4DSP; +import dap4.dap4lib.D4DataCompiler; +import org.apache.http.HttpStatus; +import ucar.httpservices.*; +import ucar.nc2.NetcdfFile; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.ByteBuffer; +import java.util.Map; + +/** + * Make a request to a server and convert the reply + * to a DapDataset from the returned bytes. + */ + +public class HttpDSP extends D4DSP { + + ////////////////////////////////////////////////// + // Constants + + protected static final boolean DEBUG = false; + + protected static final int DFALTPRELOADSIZE = 50000; // databuffer + + ////////////////////////////////////////////////// + // Static methods + + static public void setHttpDebug() { + HTTPIntercepts.setGlobalDebugInterceptors(true); + } + + ////////////////////////////////////////////////// + // Instance variables + + protected boolean allowCompression = true; + protected int status = HttpStatus.SC_OK; // response + + ////////////////////////////////////////////////// + // Constructor(s) + + public HttpDSP() { + super(); + } + + ////////////////////////////////////////////////// + // DSP API + + public D4DSP open(String fileurl, ChecksumMode cmode) throws DapException { + super.open(fileurl, cmode); + return this; + } + + /** + * @param url + * @param context Any parameters that may help to decide. + * @return true if this url appears to be processible by this DSP + */ + public boolean dspMatch(String url, DapContext context) { + return DapProtocol.isDap4URI(url); + } + + ///////////////////////////////////////// + // AbstractDSP extensions + + /* + * @Override + * public String getPath() + * { + * return this.originalurl; + * } + */ + + ////////////////////////////////////////////////// + // Load methods + + public void loadDMR() throws DapException { + String methodurl = getMethodUrl(RequestMode.DMR, this.checksummode); + try { + InputStream stream = makeRequest(methodurl); // close later + setStream(stream, RequestMode.DMR); + super.loadDMR(); + } catch (IOException e) { + throw new DapException(e); + } + } + + /** + * This will be called lazily when trying to read data. + * + * @throws DapException + */ + public void loadDAP() throws DapException { + String methodurl = getMethodUrl(RequestMode.DAP, this.checksummode); + try (InputStream stream = makeRequest(methodurl)) { + // Extract and "compile" the server response, ignoring the leading DMR + setStream(stream, RequestMode.DAP); + super.loadDAP(); + } catch (IOException ioe) { + throw new DapException(ioe); + } + } + + ////////////////////////////////////////////////// + // Request/Response methods + + /** + * Open a connection and make a request for the (possibly constrained) DMR|DAP + * (choice is made by url extension) + * + * @throws DapException + */ + + protected InputStream makeRequest(String methodurl) throws DapException { + // Assume mode is consistent with the url. + InputStream stream; + // Make the request and return the input stream for accessing the databuffer + URI uri; + try { + uri = HTTPUtil.parseToURI(methodurl); + } catch (URISyntaxException mue) { + throw new DapException("Malformed url: " + methodurl); + } + long start = System.currentTimeMillis(); + long stop = 0; + this.status = 0; + HTTPMethod method = null; // Implicitly passed out to caller via stream + try { // Note that we cannot use try with resources because we export the method stream, so method + // must not be closed. + method = HTTPFactory.Get(methodurl); + if (allowCompression) + method.setCompression("deflate,gzip"); + this.status = method.execute(); + if (this.status != HttpStatus.SC_OK) { + String msg = method.getResponseAsString(); + throw new DapException("Request failure: " + status + ": " + methodurl).setCode(status); + } + // Get the response body stream => do not close the method + return method.getResponseAsStream(); + } catch (HTTPException e) { + if (method != null) + method.close(); + throw new DapException(e); + } + } + + ////////////////////////////////////////////////// + // Utilities + + protected static String buildURL(String baseurl, String suffix, DapDataset template, String ce) { + StringBuilder methodurl = new StringBuilder(); + methodurl.append(baseurl); + if (suffix != null) { + methodurl.append('.'); + methodurl.append(suffix); + } + if (ce != null && ce.length() > 0) { + methodurl.append("?"); + methodurl.append(DapConstants.CONSTRAINTTAG); + methodurl.append('='); + methodurl.append(ce); + } + return methodurl.toString(); + } + +} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/LibTypeFcns.java b/dap4/src/main/java/dap4/dap4lib/LibTypeFcns.java similarity index 100% rename from dap4/d4lib/src/main/java/dap4/dap4lib/LibTypeFcns.java rename to dap4/src/main/java/dap4/dap4lib/LibTypeFcns.java diff --git a/dap4/src/main/java/dap4/dap4lib/RawDSP.java b/dap4/src/main/java/dap4/dap4lib/RawDSP.java new file mode 100644 index 0000000000..70ffe9bb1b --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/RawDSP.java @@ -0,0 +1,109 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib; + +import dap4.core.dmr.parser.DOM4Parser; +import dap4.core.dmr.parser.Dap4Parser; +import dap4.core.util.*; + +import java.io.*; +import java.net.URISyntaxException; + +/** + * Provide a DSP interface to raw data + */ + +public class RawDSP extends D4DSP { + ////////////////////////////////////////////////// + // Constants + + protected static final String[] EXTENSIONS = new String[] {".dap", ".raw"}; + + ////////////////////////////////////////////////// + // Instance variables + + ////////////////////////////////////////////////// + // Constructor(s) + + public RawDSP() {} + + ////////////////////////////////////////////////// + // D4DSP API + + // Note that there is no point in delaying the compilation of the + // DMR and DAP since we are reading the whole DAP anyway + @Override + public D4DSP open(String fileurl, ChecksumMode cmode) throws DapException { + mode = RequestMode.DAP; // force it + super.open(fileurl, cmode); + String methodurl = getMethodUrl(mode, this.checksummode); + parseURL(methodurl); // reparse + String realpath = this.xuri.getRealPath(); + try { + FileInputStream stream = new FileInputStream(realpath); + setStream(stream, RequestMode.DAP); + } catch (IOException ioe) { + throw new DapException(ioe).setCode(DapCodes.SC_INTERNAL_SERVER_ERROR); + } + return this; + } + + /** + * A path is file if it has no base protocol or is file: + * + * @param location file:/ or possibly an absolute path + * @param context Any parameters that may help to decide. + * @return true if this path appears to be processible by this DSP + */ + public boolean dspMatch(String location, DapContext context) { + try { + XURI xuri = new XURI(location); + if (xuri.isFile()) { + String path = xuri.getPath(); + for (String ext : EXTENSIONS) { + if (path.endsWith(ext)) + return true; + } + } + } catch (URISyntaxException use) { + return false; + } + return false; + } + + ////////////////////////////////////////////////// + // Load Operations + + /** + * LoadDMR actually loads DAP since we know that we will need that eventually. + * + * @throws DapException + */ + + public void loadDMR() throws DapException { + String methodurl = getMethodUrl(mode, this.checksummode); + parseURL(methodurl); // reparse + String realpath = this.xuri.getRealPath(); + try { + FileInputStream stream = new FileInputStream(realpath); + setStream(stream, RequestMode.DAP); + super.loadDMR(); + } catch (IOException ioe) { + throw new DapException(ioe).setCode(DapCodes.SC_INTERNAL_SERVER_ERROR); + } + } + + /** + * loadDMR will have already loaded the DAP stream, + * so all that is left is to compile the data stream, + * + * @throws DapException + */ + public void loadDAP() throws IOException { + super.loadDAP(); + } + +} diff --git a/dap4/d4lib/src/main/java/dap4/dap4lib/RequestMode.java b/dap4/src/main/java/dap4/dap4lib/RequestMode.java similarity index 56% rename from dap4/d4lib/src/main/java/dap4/dap4lib/RequestMode.java rename to dap4/src/main/java/dap4/dap4lib/RequestMode.java index 7cb64b5051..a650d3b0f3 100644 --- a/dap4/d4lib/src/main/java/dap4/dap4lib/RequestMode.java +++ b/dap4/src/main/java/dap4/dap4lib/RequestMode.java @@ -10,14 +10,21 @@ * Define the enum for the possible Request/Response modes */ public enum RequestMode { - DMR("dmr"), DAP("dap"), DSR("dsr"), CAPABILITIES(null), ERROR(null); + DMR("dmr", "dmr"), DAP("dap", "dap"), DSR("dsr", "dsr"), CAPABILITIES("capabilities", ""), ERROR("error", + null), NONE("none", null); + private String id; private String extension; - RequestMode(String extension) { + RequestMode(String id, String extension) { + this.id = id; this.extension = extension; } + public String id() { + return id; + } + public String extension() { return extension; } @@ -30,8 +37,16 @@ public static RequestMode modeFor(String s) { return null; } + public static RequestMode idMode(String id) { + for (RequestMode mode : RequestMode.values()) { + if (mode.id() != null && id.equalsIgnoreCase(mode.id)) + return mode; + } + return null; + } + public String toString() { - return extension; + return id; } } diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/CDMTypeFcns.java b/dap4/src/main/java/dap4/dap4lib/cdm/CDMTypeFcns.java similarity index 91% rename from dap4/d4cdm/src/main/java/dap4/cdm/CDMTypeFcns.java rename to dap4/src/main/java/dap4/dap4lib/cdm/CDMTypeFcns.java index 535fca567c..7e02d6ef3d 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/CDMTypeFcns.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/CDMTypeFcns.java @@ -3,7 +3,7 @@ * See the LICENSE file for more information. */ -package dap4.cdm; +package dap4.dap4lib.cdm; import dap4.core.dmr.DapEnumeration; import dap4.core.dmr.DapType; @@ -16,9 +16,12 @@ import ucar.ma2.DataType; import ucar.ma2.ForbiddenConversionException; import ucar.nc2.EnumTypedef; +import ucar.nc2.Sequence; +import ucar.nc2.Structure; + import java.math.BigDecimal; import java.math.BigInteger; -import java.nio.ByteBuffer; +import java.nio.*; import java.util.ArrayList; import java.util.List; @@ -40,46 +43,46 @@ public abstract class CDMTypeFcns { // Static Methods /* Needed to implement Array.getElement() */ - public static Class cdmElementClass(DataType dt) { + static public Class cdmElementClass(DataType dt) { switch (dt) { case BOOLEAN: - return boolean.class; + return Boolean.class; case ENUM1: case BYTE: - return byte.class; + return Byte.class; case CHAR: - return char.class; + return Character.class; case ENUM2: case SHORT: - return short.class; + return Short.class; case ENUM4: case INT: - return int.class; + return Integer.class; case LONG: - return long.class; + return Long.class; case FLOAT: - return float.class; + return Float.class; case DOUBLE: - return double.class; + return Double.class; case STRING: return String.class; case OPAQUE: return ByteBuffer.class; case UBYTE: - return byte.class; + return Byte.class; case USHORT: - return short.class; + return Short.class; case UINT: - return int.class; + return Integer.class; case ULONG: - return long.class; + return Long.class; default: break; } return null; } - public static Object createVector(DataType type, long count) { + static public Object createVector(DataType type, long count) { int icount = (int) count; Object vector = null; switch (type) { @@ -126,13 +129,17 @@ public static Object createVector(DataType type, long count) { return vector; } - public static Object createVector(DapType type, long count) { + static public boolean signify(DapType type) { + return daptype2cdmtype(type).isUnsigned(); + } + + static public Object createVector(DapType type, long count) { if (type.getAtomicType() == TypeSort.Enum) return createVector(((DapEnumeration) type).getBaseType(), count); return CoreTypeFcns.createVector(type.getTypeSort(), count); } - public static DataType enumTypeFor(DapType type) { + static public DataType enumTypeFor(DapType type) { switch (type.getTypeSort()) { case Char: case Int8: @@ -157,7 +164,7 @@ public static DataType enumTypeFor(DapType type) { return null; } - public static DapType cdmtype2daptype(DataType datatype) { + static public DapType cdmtype2daptype(DataType datatype) { switch (datatype) { case CHAR: return DapType.CHAR; @@ -203,7 +210,7 @@ public static DapType cdmtype2daptype(DataType datatype) { return null; } - public static DataType daptype2cdmtype(DapType type) { + static public DataType daptype2cdmtype(DapType type) { assert (type != null); switch (type.getTypeSort()) { case Char: @@ -265,7 +272,6 @@ public static DataType daptype2cdmtype(DapType type) { return null; } - /** * Conmpute the size, in databuffer, * of the daptype wrt to a serialization; @@ -274,7 +280,7 @@ public static DataType daptype2cdmtype(DapType type) { * @param atomtype The type of interest * @return the size, in databuffer */ - public static int daptypeSize(TypeSort atomtype) { + static public int daptypeSize(TypeSort atomtype) { switch (atomtype) { case Char: // remember serial size is 1, not 2. case UInt8: @@ -297,7 +303,7 @@ public static int daptypeSize(TypeSort atomtype) { return 0; } - public static long extract(TypeSort sort, Object value) { + static public long extract(TypeSort sort, Object value) { long lvalue = 0; switch (sort) { case Int8: @@ -338,7 +344,7 @@ public static long extract(TypeSort sort, Object value) { return lvalue; } - public static Object convert(TypeSort dstsort, TypeSort srcsort, Object src) { + static public Object convert(TypeSort dstsort, TypeSort srcsort, Object src) { Object result = null; long lval; boolean ok = true; @@ -1121,7 +1127,7 @@ public static Object convert(TypeSort dstsort, TypeSort srcsort, Object src) { } - public static void vectorcopy(DapType datatype, Object src, Object dst, long srcoffset, long dstoffset) + static public void vectorcopy(DapType datatype, Object src, Object dst, long srcoffset, long dstoffset) throws DapException { switch (datatype.getTypeSort()) { case UInt8: @@ -1179,7 +1185,7 @@ public static void vectorcopy(DapType datatype, Object src, Object dst, long src * @param o * @return parsed attribute */ - public static Object attributeParse(DataType cdmtype, EnumTypedef en, Object o) { + static public Object attributeParse(DataType cdmtype, EnumTypedef en, Object o) { String so = o.toString(); if (en != null) { switch (cdmtype) { @@ -1287,7 +1293,7 @@ public static Object attributeParse(DataType cdmtype, EnumTypedef en, Object o) return o; } - public static boolean isPrimitiveVector(DataType type, Object o) { + static public boolean isPrimitiveVector(DataType type, Object o) { Class c = o.getClass(); if (!c.isArray()) return false; @@ -1326,7 +1332,7 @@ public static boolean isPrimitiveVector(DataType type, Object o) { return false; } - public static Array arrayify(DataType datatype, Object o) { + static public Array arrayify(DataType datatype, Object o) { // 1. o is a constant if (!o.getClass().isArray()) { Object ovec = createVector(datatype, 1); @@ -1337,13 +1343,13 @@ public static Array arrayify(DataType datatype, Object o) { return Array.factory(datatype, shape, o); } - public static Array arrayify(DapType type, Object o) { + static public Array arrayify(DapType type, Object o) { if (type.getAtomicType() == TypeSort.Enum) return arrayify(((DapEnumeration) type).getBaseType(), o); return arrayify(CDMTypeFcns.daptype2cdmtype(type), o); } - public static List listify(Object vector) { + static public List listify(Object vector) { List list = new ArrayList(); int icount = java.lang.reflect.Array.getLength(vector); for (int i = 0; i < icount; i++) { @@ -1352,24 +1358,87 @@ public static List listify(Object vector) { return list; } + static public Object bytesAsTypeVec(DapType daptype, byte[] bytes) { + TypeSort tsort = daptype.getTypeSort(); + int count = (bytes.length / daptype.getSize()); + switch (tsort) { + case Char: + return new char[count]; + case Int8: + case UInt8: + return new byte[count]; + case Int16: + case UInt16: + return new short[count]; + case Int32: + case UInt32: + return new int[count]; + case Int64: + case UInt64: + return new long[count]; + case Float32: + return new float[count]; + case Float64: + return new double[count]; + case Enum: + // Coverity[FB.BC_UNCONFIRMED_CAST] + return bytesAsTypeVec(((DapEnumeration) daptype).getBaseType(), bytes); + default: + break; + } + return null; + } + + static public void decodebytes(ByteOrder remoteorder, DapType daptype, byte[] bytes, Object vector) { + TypeSort tsort = daptype.getTypeSort(); + ByteBuffer bb = ByteBuffer.wrap(bytes).order(remoteorder); + switch (tsort) { + case Char: + String cb = new String(bytes, DapUtil.UTF8); + char[] cv = (char[]) vector; + for (int i = 0; i < cv.length; i++) + cv[i] = cb.charAt(i); + break; + case Int8: + case UInt8: + bb.get((byte[]) vector); + break; + case Int16: + case UInt16: + ShortBuffer sb = bb.asShortBuffer(); + short[] sv = (short[]) vector; + sb.get(sv); + break; + case Int32: + case UInt32: + IntBuffer ib = bb.asIntBuffer(); + int[] iv = (int[]) vector; + ib.get(iv); + break; + case Int64: + case UInt64: + LongBuffer lb = bb.asLongBuffer(); + long[] lv = (long[]) vector; + lb.get(lv); + break; + case Float32: + FloatBuffer fb = bb.asFloatBuffer(); + float[] fv = (float[]) vector; + fb.get(fv); + break; + case Float64: + DoubleBuffer db = bb.asDoubleBuffer(); + double[] dv = (double[]) vector; + db.get(dv); + break; + case Enum: + // Coverity[FB.BC_UNCONFIRMED_CAST] + decodebytes(remoteorder, ((DapEnumeration) daptype).getBaseType(), bytes, vector); + break; + default: + break; + } + + } - /* - * static public Array - * arraysection(Array a, List slices) - * { - * int rank = slices.size(); - * int[] origin = new int[rank]; - * int[] subshape = new int[rank]; - * for(int i = 0; i < rank; i++) { - * origin[i] = 0; - * subshape[i] = (int) index.get(i); - * } - * subshape[rank - 1] = 1; // remove vlen dimension - * Array records; - * try { - * records = seqarray.section(origin, subshape, null); - * } catch (InvalidRangeException e) { - * throw new DapException("Illegal index", e); - * } - */ } diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/CDMUtil.java b/dap4/src/main/java/dap4/dap4lib/cdm/CDMUtil.java similarity index 50% rename from dap4/d4cdm/src/main/java/dap4/cdm/CDMUtil.java rename to dap4/src/main/java/dap4/dap4lib/cdm/CDMUtil.java index 9e3677ca64..3f7b4152b3 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/CDMUtil.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/CDMUtil.java @@ -3,16 +3,15 @@ * See the LICENSE file for more information. */ -package dap4.cdm; +package dap4.dap4lib.cdm; -import dap4.core.data.DataCursor; import dap4.core.dmr.DapDimension; import dap4.core.dmr.DapType; import dap4.core.dmr.TypeSort; import dap4.core.util.DapException; -import dap4.core.util.Index; import dap4.core.util.Slice; import ucar.ma2.ForbiddenConversionException; +import ucar.ma2.Index; import ucar.ma2.InvalidRangeException; import ucar.ma2.Range; import ucar.nc2.CDMNode; @@ -32,6 +31,8 @@ public abstract class CDMUtil { static final String hexchars = "0123456789abcdef"; + static final public Index SCALAR = new Index(new int[0], new int[0]); + /** * Convert a list of ucar.ma2.Range to a list of Slice * More or less the inverst of create CDMRanges @@ -153,27 +154,6 @@ public static List createCDMRanges(List slices) throws Da * @return the lowest level Variable instance */ public static Variable unwrap(Variable var) { - /* - * for(;;) { - * if(var instanceof VariableDS) { - * VariableDS vds = (VariableDS) var; - * var = vds.getOriginalVariable(); - * if(var == null) { - * var = vds; - * break; - * } - * } else if(var instanceof StructureDS) { - * StructureDS sds = (StructureDS) var; - * var = sds.getOriginalVariable(); - * if(var == null) { - * var = sds; - * break; - * } - * } else - * break; - * } - * return var; - */ return (Variable) CDMNode.unwrap(var); } @@ -243,117 +223,6 @@ public static int[] computeEffectiveShape(List dimset) { return shape; } - /* - * static public int - * computeVariableSize(View view, DapVariable var, boolean scalar) - * { - * DapType dt = var.getBaseType(); - * ViewVariable annotation = view.getAnnotation(var); - * int dimproduct = (scalar ? 1 : computeDimProduct(annotation.getSlices())); - * int elementsize = 0; - * switch (dt.getTypeSort()) { - * default: // atomic variable - * // This does not work for String or Opaque. - * elementsize = CDMUtil.daptypeSize(dt.getTypeSort()); - * break; - * case STRUCTURE: - * case SEQUENCE: - * for(DapVariable field : ((DapStructure) dt).getFields()) { - * elementsize += computeVariableSize(dataset, field, false); - * } - * break; - * - * default: - * break; - * } - * return dimproduct * elementsize; - * } - */ - - /** - * Extract, as an object, value from a (presumably) - * atomic typed array of values; dataset position - * is presumed correct. - * - * @param atomtype type of object to extract ; must not be Enum - * @param dataset Data containing the objects - * @param index Which element of dataset to read - * @return resulting value as an Object; value does not necessarily conform - * to Convert.ValueClass. - */ - - /** - * Extract, as a long, value from a (presumably) - * atomic typed array of values; dataset position - * is presumed correct. - * - * @param atomtype type of object to extract - * @param dataset Data containing the objects - * @param index Which element of dataset to read - * @return resulting value as a long - * @throws ForbiddenConversionException if cannot convert to long - */ - - public static long extractLongValue(TypeSort atomtype, DataCursor dataset, Index index) throws DapException { - Object result; - result = dataset.read(index); - long lvalue = CDMTypeFcns.extract(atomtype, result); - return lvalue; - } - - /** - * Extract, as a double, value from a (presumably) - * atomic typed array of values; dataset position - * is presumed correct. - * - * @param atomtype type of object to extract - * @param dataset Data containing the objects - * @param index Which element of dataset to read - * @return resulting value as a double - * @throws ForbiddenConversionException if cannot convert to double - */ - - public static double extractDoubleValue(TypeSort atomtype, DataCursor dataset, Index index) throws DapException { - Object result; - result = dataset.read(index); - double dvalue = 0.0; - if (atomtype.isIntegerType() || atomtype.isEnumType()) { - long lvalue = extractLongValue(atomtype, dataset, index); - dvalue = (double) lvalue; - } else if (atomtype == TypeSort.Float32) { - dvalue = (double) ((Float) result).floatValue(); - } else if (atomtype == TypeSort.Float64) { - dvalue = ((Double) result).doubleValue(); - } else - throw new ForbiddenConversionException(); - return dvalue; - } - - /** - * Extract, as an object, n consecutive values - * of an atomic typed array of values - * - * @param dataset Data containing the objects - * @param index Starting element to read - * @param count Number of elements to read - * @return resulting array of values as an object - */ - - /* - * static public Object - * extractVector(DataAtomic dataset, long index, long count, long offset) - * throws DapException - * { - * Object vector = createVector(dataset.getType().getPrimitiveType(),count); - * try { - * dataset.read(index, count, vector, offset); - * } catch (IOException ioe) { - * throw new DapException(ioe); - * } - * return vector; - * } - */ - /** * Convert an array of one type of values to another type * @@ -381,68 +250,6 @@ public static Object convertVector(DapType dsttype, DapType srctype, Object src) return result; } - /** - * Given an arbitrary Array (including ArrayStructure), produce - * a new Array that represents the slice defined by the - * section. For now, we create a simple array of the relevant - * type and fill it by extracting the values specified by the - * section. - *

- * param array the array from which the section is extracted - * param section determines what to extract - * throws DapException - * returns the slice array - */ - /* - * static public ucar.ma2.Array - * arraySlice(ucar.ma2.Array array, Section section) - * throws DapException - * { - * // Case it out. - * if(!dapvar.getBaseType().isStructType()) { // =>Atomic type - * if(dapvar.isTopLevel()) { - * // Simplest case: use createview, but watch out for final VLEN - * List ranges = section.getRanges(); - * try { - * if(CDMUtil.hasVLEN(ranges)) - * return array.section(ranges.subList(0, ranges.size() - 2)); - * else - * return array.section(ranges); - * } catch (InvalidRangeException ire) { - * throw new DapException(ire); - * } - * } else - * throw new UnsupportedOperationException(); // same as other cdm - * } else { // struct type - * assert (array instanceof CDMArrayStructure); - * CDMArrayStructure struct = (CDMArrayStructure) array; - * if(dapvar.isTopLevel()) { - * // Build a new ArrayStructure containing - * // the relevant instances. - * int[] shape = section.getShape(); - * StructureMembers sm = new StructureMembers(struct.getStructureMembers()); - * ArrayStructureMA slice = new ArrayStructureMA(sm, shape); - * CDMOdometer odom = new CDMOdometer(dapvar.getDimensions(), section.getRanges()); - * // Compute the number of structuredata instances we need - * long totalsize = section.computeSize(); - * List mlist = sm.getMembers(); - * StructureData[] newdata = new StructureData[(int) totalsize]; - * for(int i = 0;odom.hasNext();odom.next(), i++) { - * long recno = odom.index(); - * StructureDataW clone = new StructureDataW(sm); - * newdata[i] = clone; - * StructureData record = struct.getStructureData((int) recno); - * for(int j = 0;j < mlist.size();j++) { - * StructureMembers.Member m = mlist.get(j); - * clone.setMemberData(m, record.getArray(m)); - * } - * } - * return slice; - * } else - * throw new UnsupportedOperationException(); // same as other cdm - * } - * } - */ public static String getChecksumString(byte[] checksum) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < checksum.length; i++) { @@ -453,47 +260,6 @@ public static String getChecksumString(byte[] checksum) { return buf.toString(); } - /** - * Convert a Section + variable to a constraint - *

- *

- * static public View - * sectionToView(CDMDSP dsp, Variable v, Section section) - * throws DapException - * { - * if(section == null || section.getRank() == 0) - * return null; - * // Get the corresponding DapNode - * DapVariable dv = (DapVariable) dsp.getNode().get(v); - * if(dv == null) - * throw new DapException("Variable has no corresponding dap node: " + v.getFullName()); - * // Get the structure path wrt DapDataset for dv - * // and use path plus the Section to construct a constraint - * List structpath = DapUtil.getStructurePath(dv); - * List ranges = section.getRanges(); - * View view = new View(dmr); - * int next = 0; - * for(int i = 0;i < structpath.size();i++) { - * dv = structpath.get(i); - * int rank = dv.getRank(); - * ViewVariable vv = new ViewVariable(dv); - * List slices = new ArrayList(rank); - * for(int j = 0;j < rank;j++, next++) { - * if(next >= ranges.size()) - * throw new DapException("Range::Rank mismatch"); - * Range range = ranges.get(next); - * Slice slice = new Slice(range.first(), range.last(), range.stride()).validate(); - * slices.add(slice); - * } - * vv.setSlices(slices); - * view.put(dv, vv); - * } - * view.validate(View.EXPAND); - * return view; - * } - */ - - public static List dimsetToRanges(List dimset) throws dap4.core.util.DapException { if (dimset == null) return null; @@ -521,27 +287,56 @@ public static List shapeToSlices(int[] shape) throws dap4.core.util.DapEx return slices; } - public static dap4.core.util.Index cdmIndexToIndex(ucar.ma2.Index cdmidx) { - int rank = cdmidx.getRank(); - int[] shape = cdmidx.getShape(); - long[] indices = new long[shape.length]; - for (int i = 0; i < rank; i++) { - indices[i] = shape[i]; - } - dap4.core.util.Index dapidx = new dap4.core.util.Index(indices, indices); + public static Index cdmIndexToIndex(ucar.ma2.Index cdmidx) { + Index dapidx = new Index(cdmidx.getCurrentCounter(), cdmidx.getShape()); return dapidx; } - public static ucar.ma2.Index indexToCcMIndex(dap4.core.util.Index d4) { - int rank = d4.getRank(); - int[] shape = new int[rank]; - int[] indices = new int[rank]; + public static ucar.ma2.Index indexToCcMIndex(Index d4) { + return (Index) d4; + } + + /** + * Convert DataIndex to list of slices + * + * @param indices to convert + * @return list of corresponding slices + */ + + static public List indexToSlices(Index indices) throws DapException { + // short circuit the scalar case + int rank = indices.getRank(); + if (rank == 0) + return Slice.SCALARSLICES; + // offset = d3*(d2*(d1*(x1))+x2)+x3 + List slices = new ArrayList<>(rank); for (int i = 0; i < rank; i++) { - indices[i] = (int) d4.get(i); - shape[i] = (int) d4.getSize(i); + int isize = indices.getCurrentCounter()[i]; + slices.add(new Slice(isize, isize + 1, 1, indices.getShape(i))); + } + return slices; + } + + /** + * If a set of slices refers to a single position, + * then return the corresponding Index. Otherwise, + * throw Exception. + * + * @param slices + * @return Index corresponding to slices + * @throws DapException + */ + static public Index slicesToIndex(List slices) throws DapException { + int[] positions = new int[slices.size()]; + int[] dimsizes = new int[slices.size()]; + for (int i = 0; i < positions.length; i++) { + Slice s = slices.get(i); + if (s.getCount() != 1) + throw new DapException("Attempt to convert non-singleton sliceset to index"); + positions[i] = s.getFirst(); + dimsizes[i] = s.getMax(); } - ucar.ma2.Index cdm = ucar.ma2.Index.factory(shape); - cdm.set(indices); - return cdm; + return new Index(positions, dimsizes); } + } diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/NodeMap.java b/dap4/src/main/java/dap4/dap4lib/cdm/NodeMap.java similarity index 98% rename from dap4/d4cdm/src/main/java/dap4/cdm/NodeMap.java rename to dap4/src/main/java/dap4/dap4lib/cdm/NodeMap.java index a3c242cb5f..64a4aeed4a 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/NodeMap.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/NodeMap.java @@ -3,7 +3,7 @@ * See the LICENSE file for more information. */ -package dap4.cdm; +package dap4.dap4lib.cdm; import dap4.core.dmr.DapNode; import ucar.nc2.CDMNode; diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMCompiler.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/CDMCompiler.java similarity index 69% rename from dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMCompiler.java rename to dap4/src/main/java/dap4/dap4lib/cdm/nc2/CDMCompiler.java index e184710c24..f610c9a878 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMCompiler.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/CDMCompiler.java @@ -4,16 +4,15 @@ */ -package dap4.cdm.nc2; +package dap4.dap4lib.cdm.nc2; -import dap4.cdm.NodeMap; -import dap4.core.data.DSP; +import dap4.dap4lib.D4DSP; +import dap4.dap4lib.cdm.NodeMap; import dap4.core.dmr.DapDataset; import dap4.core.dmr.DapNode; import dap4.core.util.DapException; import ucar.ma2.Array; import ucar.nc2.CDMNode; -import ucar.nc2.Group; import ucar.nc2.NetcdfFile; import ucar.nc2.Variable; import java.util.Map; @@ -32,19 +31,21 @@ */ public class CDMCompiler { - public static boolean DEBUG = false; - ////////////////////////////////////////////////// - // Constants + public static boolean DEBUG = false; - ////////////////////////////////////////////////// - // Instance variables + /* + * //////////////////////////////////////////////// + * Constants + * + * //////////////////////////////////////////////// + * Instance variables + */ protected DapNetcdfFile ncfile = null; - protected DSP dsp = null; + protected D4DSP dsp = null; protected DapDataset dmr = null; - protected Group cdmroot = null; - protected NodeMap nodemap = null; + protected NodeMap nodemap = null; // Bi-directional protected Map arraymap = null; ////////////////////////////////////////////////// @@ -54,13 +55,13 @@ public class CDMCompiler { * Constructor * * @param ncfile the target NetcdfDataset (as yet empty) - * @param dsp the DSP to be wrapped + * @param dsp */ - public CDMCompiler(DapNetcdfFile ncfile, DSP dsp) throws DapException { + public CDMCompiler(DapNetcdfFile ncfile, D4DSP dsp) throws DapException { this.ncfile = ncfile; this.dsp = dsp; - this.dmr = dsp.getDMR(); + this.dmr = this.dsp.getDMR(); } ////////////////////////////////////////////////// @@ -78,15 +79,6 @@ public NetcdfFile getNetcdfFile() { return this.ncfile; } - ////////////////////////////////////////////////// - // Compile DMR and Data into a NetcdfDataset - - /* Package access */ - void compile() throws DapException { - compileDMR(); - compileData(); - } - ////////////////////////////////////////////////// // Compile DMR->set of CDM nodes @@ -97,7 +89,7 @@ void compile() throws DapException { * @throws DapException */ - protected void compileDMR() throws DapException { + public void compileDMR() throws DapException { // Convert the DMR to CDM metadata // and return a mapping from DapNode -> CDMNode this.nodemap = new DMRToCDM(this.ncfile, this.dsp).create(); @@ -113,10 +105,10 @@ protected void compileDMR() throws DapException { * @throws DapException */ - protected void compileData() throws DapException { - // Convert the DMR to CDM metadata + public void compileData() throws DapException { + // Convert the Data to CDM arrays // and return a mapping from Variable -> Array - this.arraymap = new DataToCDM(this.ncfile, this.dsp, this.nodemap).create(); + this.arraymap = DataToCDM.createDataMap(this.dsp, this.nodemap); } } diff --git a/dap4/src/main/java/dap4/dap4lib/cdm/nc2/D4StructureDataIterator.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/D4StructureDataIterator.java new file mode 100644 index 0000000000..eceb0e796a --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/D4StructureDataIterator.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.dap4lib.cdm.nc2; + +import ucar.ma2.StructureData; +import ucar.ma2.StructureDataIterator; + +import java.io.IOException; + +public class D4StructureDataIterator implements StructureDataIterator { + + protected StructureData[] list; + protected int position; + + public D4StructureDataIterator() { + this.list = null; + this.position = 0; + } + + ////////////////////////////////////////////////// + // Accessors + + public D4StructureDataIterator setList(StructureData[] list) { + this.list = list; + return this; + } + + ////////////////////////////////////////////////// + // StructureDataIterator Interface Implementation + + public boolean hasNext() throws IOException { + return position < list.length; + } + + public StructureData next() throws IOException { + if (position >= list.length) + throw new IOException("No next element"); + return list[position++]; + } + + public StructureDataIterator reset() { + position = 0; + return this; + } + + public int getCurrentRecno() { + return position; + } + +} diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DMRToCDM.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DMRToCDM.java similarity index 97% rename from dap4/d4cdm/src/main/java/dap4/cdm/nc2/DMRToCDM.java rename to dap4/src/main/java/dap4/dap4lib/cdm/nc2/DMRToCDM.java index 148ddd6297..16abf38398 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DMRToCDM.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DMRToCDM.java @@ -3,11 +3,12 @@ * See the LICENSE file for more information. */ -package dap4.cdm.nc2; +package dap4.dap4lib.cdm.nc2; -import dap4.cdm.CDMTypeFcns; -import dap4.cdm.NodeMap; -import dap4.core.data.DSP; +import dap4.core.util.DapContext; +import dap4.dap4lib.D4DSP; +import dap4.dap4lib.cdm.CDMTypeFcns; +import dap4.dap4lib.cdm.NodeMap; import dap4.core.dmr.*; import dap4.core.util.Convert; import dap4.core.util.DapException; @@ -28,7 +29,7 @@ public class DMRToCDM { // Instance Variables protected DapNetcdfFile ncfile; - protected DSP dsp; + protected D4DSP dsp; protected DapDataset dmr; protected NodeMap nodemap; @@ -41,10 +42,10 @@ public class DMRToCDM { * @param dsp - the DSP being wrapped */ - public DMRToCDM(DapNetcdfFile ncfile, DSP dsp) throws DapException { + public DMRToCDM(DapNetcdfFile ncfile, D4DSP dsp) throws DapException { this.ncfile = ncfile; this.dsp = dsp; - this.dmr = dsp.getDMR(); + this.dmr = this.dsp.getDMR(); this.nodemap = new NodeMap<>(); } diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFile.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFile.java similarity index 54% rename from dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFile.java rename to dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFile.java index d6dca6ee9c..22c9d7c954 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFile.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFile.java @@ -3,17 +3,15 @@ * See the LICENSE file for more information. */ -package dap4.cdm.nc2; - -import dap4.cdm.CDMUtil; -import dap4.core.data.DSP; -import dap4.core.data.DSPRegistry; -import dap4.core.util.DapContext; -import dap4.core.util.DapUtil; -import dap4.dap4lib.FileDSP; -import dap4.dap4lib.HttpDSP; -import dap4.dap4lib.XURI; +package dap4.dap4lib.cdm.nc2; + +import dap4.core.dmr.*; +import dap4.core.util.*; +import dap4.dap4lib.*; +import dap4.dap4lib.cdm.CDMUtil; +import dap4.dap4lib.cdm.NodeMap; import ucar.ma2.*; +import ucar.nc2.CDMNode; import ucar.nc2.NetcdfFile; import ucar.nc2.ParsedSectionSpec; import ucar.nc2.Variable; @@ -25,7 +23,17 @@ import java.nio.channels.WritableByteChannel; import java.util.*; + +/** + * This class is the work-horse of the client side. + * It uses a D4DSP instance to obtain access to a DMR and + * (optionally) a compiled DAP4 data stream. + * + * Given that, it constructs a translation to CDM. + */ + public class DapNetcdfFile extends NetcdfFile { + static final boolean DEBUG = false; static final boolean PARSEDEBUG = false; static final boolean MERGE = false; @@ -35,8 +43,6 @@ public class DapNetcdfFile extends NetcdfFile { ////////////////////////////////////////////////// // Constants - static final String QUERYSTART = "?"; - static final String FRAGSTART = "#"; ////////////////////////////////////////////////// // Type Declarations @@ -55,7 +61,6 @@ public void setDone(boolean done) {} public void setError(String msg) {} public void setProgress(String msg, int progress) {} - } ////////////////////////////////////////////////// @@ -69,7 +74,7 @@ public void setProgress(String msg, int progress) {} protected static DSPRegistry dspregistry = new DSPRegistry(); static { - dspregistry.register(FileDSP.class, DSPRegistry.FIRST); + dspregistry.register(RawDSP.class, DSPRegistry.FIRST); dspregistry.register(HttpDSP.class, DSPRegistry.FIRST); } @@ -78,33 +83,38 @@ public void setProgress(String msg, int progress) {} protected boolean allowCompression = true; protected boolean closed = false; - protected String location = null; // original argument passed to open + protected CancelTask cancel = null; + protected String dsplocation = null; // what is passed to DSP protected XURI xuri = null; - protected DSP dsp = null; - protected CancelTask cancel = null; + protected DapContext cxt = null; + protected D4DSP dsp = null; + // Extractions from dsp + protected DapDataset dmr = null; - // protected NodeMap nodemap = null; unused? + protected CDMCompiler cdmCompiler = null; - /** - * Originally, the array for a variable was stored - * using var.setCacheData(). However, that is illegal - * for Structures and Sequences, so (for now) - * we maintain a map variable->array. - */ - protected Map arraymap = new HashMap<>(); + protected ChecksumMode checksummode = null; - ////////////////////////////////////////////////// + protected boolean daploaded = false; // avoid multiple loads + + // Variable map + protected Map arraymap = null; + + ///////////////////////////////////////////////// // Constructor(s) /** * Open a Dap4 connection or file via a D4DSP. + * Warning: we do not use a Builder because this object is mutable over time. * * @param location URL for the request. Note that if this is * intended to send to a file oriented * DSP, then if must be converted to an absolute path. + * Note also that the URL path should not have any .dap or .dmr + * extension since using those is the purview of this class. * @param cancelTask check if task is cancelled; may be null. * @throws IOException */ @@ -118,29 +128,33 @@ public DapNetcdfFile(String location, CancelTask cancelTask) throws IOException } catch (URISyntaxException use) { throw new IOException(use); } - boolean isfile = xuri.isFile(); - if (isfile) { - this.dsplocation = DapUtil.absolutize(xuri.getPath()); - } else { // Not a file url - this.dsplocation = xuri.assemble(XURI.URLBASE); - } - DapContext cxt = new DapContext(); + this.dsplocation = xuri.assemble(XURI.URLQUERY); cancel = (cancelTask == null ? nullcancel : cancelTask); - // 1. Get and parse the constrained DMR and Data v-a-v URL - this.dsp = dspregistry.findMatchingDSP(location, cxt); // will set dsp context + + // The DapContext object is the primary means of passing information + // between various parts of the DAP4 system. + this.cxt = new DapContext(); + // Insert fragment as (key,value) pairs into the context + cxt.insert(xuri.getFragFields(), true); + // Query takes precedence over fragment + cxt.insert(xuri.getQueryFields(), true); + String csummode = (String) cxt.get(DapConstants.CHECKSUMTAG); + this.checksummode = ChecksumMode.modeFor(csummode); + this.checksummode = ChecksumMode.asTrueFalse(this.checksummode); // Fix the checksum mode to be only TRUE or FALSE + this.cxt.put(ChecksumMode.class, this.checksummode); + + // Find the D4DSP class that can process this URL location. + this.dsp = dspregistry.findMatchingDSP(this.location, cxt); // find relevant D4DSP subclass if (this.dsp == null) throw new IOException("No matching DSP: " + this.location); - this.dsp.setContext(cxt); - this.dsp.open(this.dsplocation); - - // 2. Construct an equivalent CDM tree and populate - // this NetcdfFile object. - CDMCompiler compiler = new CDMCompiler(this, this.dsp); - compiler.compile(); + this.dsp.open(this.dsplocation, this.checksummode); // side effect: get DMR + ensuredmr(); + this.dmr = this.dsp.getDMR(); // get DMR + this.cxt.put(DapDataset.class, this.dmr); // set the pseudo-location, otherwise we get a name that is full path. - setLocation(this.dsp.getDMR().getDataset().getShortName()); + setLocation(this.dmr.getDataset().getShortName()); finish(); - this.arraymap = compiler.getArrayMap(); + this.dsp.loadContext(this.cxt, RequestMode.DMR); } /** @@ -168,7 +182,6 @@ public synchronized void close() throws java.io.IOException { return; closed = true; // avoid circular calls dsp = null; - // nodemap = null; unused? } ////////////////////////////////////////////////// @@ -185,7 +198,7 @@ public String getLocation() { return location; } - public DSP getDSP() { + public D4DSP getDSP() { return this.dsp; } @@ -241,7 +254,7 @@ public Array readSection(String variableSection) throws IOException, InvalidRang } /** - * Primary read entry point. + * b * Primary read entry point. * This is the primary implementor of Variable.read. * * @param cdmvar A top-level variable @@ -259,7 +272,9 @@ protected Array readData(Variable cdmvar, Section section) throws IOException, I // takes into account any constraint used in forming the dataDMR. // We use the Section to produce a view of the underlying variable array. - assert this.dsp != null; + // Read and compile the DAP4 data + // Ensure that the DSP has data + ensuredata(); Array result = arraymap.get(cdmvar); if (result == null) throw new IOException("No data for variable: " + cdmvar.getFullName()); @@ -276,4 +291,82 @@ protected Array readData(Variable cdmvar, Section section) throws IOException, I } return result; } + + protected void loadContext() { + this.cxt.put(DapConstants.ChecksumSource.REMOTE, this.dsp.getChecksumMap(DapConstants.ChecksumSource.REMOTE)); + this.cxt.put(DapConstants.ChecksumSource.LOCAL, this.dsp.getChecksumMap(DapConstants.ChecksumSource.LOCAL)); + this.cxt.put(D4Array.class, this.dsp.getVariableDataMap()); + } + + protected void verifyChecksums() throws DapException { + ChecksumMode cmode = (ChecksumMode) this.cxt.get(ChecksumMode.class); + Map remotechecksummap = (Map) cxt.get(DapConstants.ChecksumSource.REMOTE); + Map localchecksummap = (Map) cxt.get(DapConstants.ChecksumSource.LOCAL); + + if (cmode != ChecksumMode.TRUE) + return; + for (DapVariable dvar : dmr.getTopVariables()) { + // Verify the calculated checksums + Long remotechecksum = remotechecksummap.get(dvar); + Long localchecksum = localchecksummap.get(dvar); + assert ((localchecksum != null) && (remotechecksum != null)); + if (!cxt.containsKey("hyrax")) {// Suppress the check for Hyrax, for now + if (localchecksum.longValue() != remotechecksum.longValue()) + throw new DapException("Checksum mismatch: local=" + localchecksum + " remote=" + remotechecksum); + } + // Verify the checksum Attribute, if any + DapAttribute csumattr = dvar.getChecksumAttribute(); + if (csumattr != null) { + assert (csumattr.getValues().length == 1 && csumattr.getBaseType() == DapType.INT32); + Long attrcsum = (long) 0; + try { + attrcsum = Long.parseLong(csumattr.getValues()[0]); + } catch (NumberFormatException nfe) { + throw new DapException("Illegal Checksum attribute value", nfe); + } + if (!cxt.containsKey("hyrax")) { // Suppress the check for Hyrax, for now + if (localchecksum.longValue() != attrcsum.longValue()) + throw new DapException("Checksum mismatch: local=" + localchecksum + " attribute=" + attrcsum); + } + } + } + } + + /** + * Do what is necessary to ensure that DMR and DAP compilation will work + */ + public void ensuredmr() throws IOException { + if (this.dmr == null) { // do not call twice + this.dsp.loadDMR(); + this.dmr = this.dsp.getDMR(); + if (this.cdmCompiler == null) + this.cdmCompiler = new CDMCompiler(this, this.dsp); + this.cdmCompiler.compileDMR(); + } + } + + public void ensuredata() throws IOException { + if (!this.daploaded) { // do not call twice + this.daploaded = true; + this.dsp.loadDAP(); + loadContext(); + verifyChecksums(); + this.dsp.loadContext(this.cxt, RequestMode.DAP); + if (this.cdmCompiler == null) + this.cdmCompiler = new CDMCompiler(this, this.dsp); + this.cdmCompiler.compileData(); + // Prepare the array map + assert this.arraymap == null; + this.arraymap = new HashMap(); + Map datamap = this.dsp.getVariableDataMap(); + NodeMap nodemap = this.cdmCompiler.getNodeMap(); + for (Map.Entry entry : datamap.entrySet()) { + DapVariable dv = entry.getKey(); + D4Array dc = entry.getValue(); + Variable v = (Variable) nodemap.get(entry.getKey()); + assert (dc.getArray() != null); + arraymap.put(v, dc.getArray()); + } + } + } } diff --git a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFileProvider.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFileProvider.java similarity index 96% rename from dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFileProvider.java rename to dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFileProvider.java index 6aee9b8bf5..b1d304511f 100644 --- a/dap4/d4cdm/src/main/java/dap4/cdm/nc2/DapNetcdfFileProvider.java +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DapNetcdfFileProvider.java @@ -1,4 +1,4 @@ -package dap4.cdm.nc2; +package dap4.dap4lib.cdm.nc2; import java.io.IOException; import org.slf4j.Logger; diff --git a/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DataToCDM.java b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DataToCDM.java new file mode 100644 index 0000000000..ad1a228e08 --- /dev/null +++ b/dap4/src/main/java/dap4/dap4lib/cdm/nc2/DataToCDM.java @@ -0,0 +1,77 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + + +package dap4.dap4lib.cdm.nc2; + +import dap4.dap4lib.D4Array; +import dap4.dap4lib.D4DSP; +import dap4.dap4lib.cdm.NodeMap; +import dap4.core.dmr.*; +import dap4.core.util.*; +import ucar.ma2.Array; +import ucar.nc2.Group; +import ucar.nc2.Variable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Associate the Array objects created in D4DataCompiler + * with the corresponding CDM Variable. + * Class is not intended to be instantiated + * Note: this class is rather short, so could be eliminated. + */ + +abstract public class DataToCDM { + + public static boolean DEBUG = false; + + ////////////////////////////////////////////////// + // Constants + + protected static final int COUNTSIZE = 8; // databuffer as specified by the DAP4 spec + + protected static final String LBRACE = "{"; + protected static final String RBRACE = "}"; + + ////////////////////////////////////////////////// + // Instance variables + + protected DapNetcdfFile ncfile = null; + protected D4DSP dsp = null; + // Extractions from dsp + protected DapDataset dmr = null; + protected ChecksumMode checksummode = null; + protected Map localchecksummap = null; + + protected Group cdmroot = null; + protected Map datamap = null; + protected NodeMap nodemap = null; + + ////////////////////////////////////////////////// + // Constructor(s) + + ////////////////////////////////////////////////// + // Correlate CDM Variables with ucar.ma2.Array objects + + static public Map createDataMap(D4DSP dsp, NodeMap nodemap) throws DapException { + Map datamap = dsp.getVariableDataMap(); + DapDataset dmr = dsp.getDMR(); + Map arraymap = new HashMap<>(); + // iterate over the variables represented in the nodemap + List topvars = dmr.getTopVariables(); + Map map = null; + for (DapVariable var : topvars) { + D4Array cursor = datamap.get(var); + Variable v = (Variable) nodemap.get(var); + assert cursor != null && v != null; + Array array = cursor.getArray(); + assert array != null; + arraymap.put(v, array); + } + return arraymap; + } +} diff --git a/dap4/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider b/dap4/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider new file mode 100644 index 0000000000..d5a8e8dc1c --- /dev/null +++ b/dap4/src/main/resources/META-INF/services/ucar.nc2.dataset.spi.NetcdfFileProvider @@ -0,0 +1 @@ +dap4.dap4lib.cdm.nc2.DapNetcdfFileProvider diff --git a/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.1.nc.ncdump b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.1.nc.ncdump new file mode 100644 index 0000000000..b1b145dcd5 --- /dev/null +++ b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.1.nc.ncdump @@ -0,0 +1,58 @@ +netcdf test_atomic_array.1 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d1 = 1; + d2 = 2; + d3 = 3; + d4 = 4; + d5 = 5; + variables: + ubyte vu8(d2, d3); + + short v16(d4); + + uint vu32(d2, d3); + + double vd(d2); + + char vc(d2); + + string vs(d2, d2); + + opaque vo(d1, d2); + + enum cloud_class_t primary_cloud(d5); + string primary_cloud:_FillValue = "Missing"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", " +", "Καλημέα", "abc" + } + vo = 0x0123456789abcdef, + 0xabcdef0000000000; + + primary_cloud = + {0, 2, 0, 1, 127} +} diff --git a/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.2.nc.ncdump b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.2.nc.ncdump new file mode 100644 index 0000000000..0eec0bc2e2 --- /dev/null +++ b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.2.nc.ncdump @@ -0,0 +1,58 @@ +netcdf test_atomic_array.2 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d1 = 1; + d2 = 2; + d3 = 3; + d4 = 4; + d5 = 5; + variables: + ubyte vu8(d2, d3); + + short v16(d4); + + uint vu32(d2, d3); + + double vd(d2); + + char vc(d2); + + string vs(d2, d2); + + opaque vo(d1, d2); + + enum cloud_class_t primary_cloud(d5); + string primary_cloud:_FillValue = "Missing"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", " +", "Καλημέα", "abc" + } + vo = 0x0123456789abcdef, + 0xabcdef0000000000; + + primary_cloud = + {0, 2, 0, 1, 127} +} diff --git a/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.3.nc.ncdump b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.3.nc.ncdump new file mode 100644 index 0000000000..6713fac454 --- /dev/null +++ b/dap4/src/test/data/resources/baselineconstraints/test_atomic_array.3.nc.ncdump @@ -0,0 +1,58 @@ +netcdf test_atomic_array.3 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d1 = 1; + d2 = 2; + d3 = 3; + d4 = 4; + d5 = 5; + variables: + ubyte vu8(d2, d3); + + short v16(d4); + + uint vu32(d2, d3); + + double vd(d2); + + char vc(d2); + + string vs(d2, d2); + + opaque vo(d1, d2); + + enum cloud_class_t primary_cloud(d5); + string primary_cloud:_FillValue = "Missing"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", " +", "Καλημέα", "abc" + } + vo = 0x0123456789abcdef, + 0xabcdef0000000000; + + primary_cloud = + {0, 2, 0, 1, 127} +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.raw.txt b/dap4/src/test/data/resources/baselineconstraints/test_enum_array.6.nc.ncdump similarity index 77% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.raw.txt rename to dap4/src/test/data/resources/baselineconstraints/test_enum_array.6.nc.ncdump index 0a2c146f56..57f2a0ce47 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineconstraints/test_enum_array.6.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_enum_array { +netcdf test_enum_array.6 { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; @@ -7,11 +7,12 @@ netcdf test_enum_array { variables: enum cloud_class_t primary_cloud(d5); string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0xb58a627a"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud = - {0, 2, 0, 1, 127} + + data: + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.raw.txt b/dap4/src/test/data/resources/baselineconstraints/test_one_vararray.4.nc.ncdump similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.raw.txt rename to dap4/src/test/data/resources/baselineconstraints/test_one_vararray.4.nc.ncdump index f76c579e38..f4bfee691f 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineconstraints/test_one_vararray.4.nc.ncdump @@ -1,13 +1,14 @@ -netcdf test_one_vararray { +netcdf test_one_vararray.4 { dimensions: d2 = 2; variables: int t(d2); - string t:_DAP4_Checksum_CRC32 = "0x42dfb1d0"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {17, 37} + + data: + t = + {17, 37} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dmr b/dap4/src/test/data/resources/baselineconstraints/test_one_vararray.5.nc.ncdump similarity index 56% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineconstraints/test_one_vararray.5.nc.ncdump index 5785af6152..31eab0d90e 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen5.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineconstraints/test_one_vararray.5.nc.ncdump @@ -1,13 +1,14 @@ -netcdf test_vlen5 { +netcdf test_one_vararray.5 { dimensions: d2 = 2; variables: - - Structure { - int v(*); - } v1(d2); - + int t(d2); // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + {17, 37} } diff --git a/dap4/src/test/data/resources/baselineconstraints/test_opaque_array.7.nc.ncdump b/dap4/src/test/data/resources/baselineconstraints/test_opaque_array.7.nc.ncdump new file mode 100644 index 0000000000..bcc6c0a624 --- /dev/null +++ b/dap4/src/test/data/resources/baselineconstraints/test_opaque_array.7.nc.ncdump @@ -0,0 +1,17 @@ +netcdf test_opaque_array.7 { + dimensions: + d2 = 2; + variables: + opaque vo2(d2, d2); + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vo2 = 0x0123456789abcdef, + 0xabcdef0000000000, + 0xfedcba9876543210, + 0xfedcba9999999999; + +} diff --git a/dap4/src/test/data/resources/baselineconstraints/test_struct_array.8.nc.ncdump b/dap4/src/test/data/resources/baselineconstraints/test_struct_array.8.nc.ncdump new file mode 100644 index 0000000000..6177ea4ee3 --- /dev/null +++ b/dap4/src/test/data/resources/baselineconstraints/test_struct_array.8.nc.ncdump @@ -0,0 +1,57 @@ +netcdf test_struct_array.8 { + dimensions: + dx = 4; + dy = 3; + variables: + + Structure { + int x; + string x:_CoordinateAxisType = "GeoX"; + int y; + string y:_CoordinateAxisType = "GeoY"; + } s(dx, dy); + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { x = 1 + y = -1 + } s(0) + { x = 17 + y = 37 + } s(1) + { x = -32767 + y = 32767 + } s(2) + { x = -1 + y = 3 + } s(3) + { x = -2 + y = 2 + } s(4) + { x = -3 + y = 1 + } s(5) + { x = -4 + y = 12 + } s(6) + { x = -8 + y = 8 + } s(7) + { x = -12 + y = 4 + } s(8) + { x = -5 + y = 15 + } s(9) + { x = -10 + y = 10 + } s(10) + { x = -15 + y = 5 + } s(11) +} diff --git a/dap4/src/test/data/resources/baselinehyrax/AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf.ncdump b/dap4/src/test/data/resources/baselinehyrax/AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf.ncdump new file mode 100644 index 0000000000..701d8f7096 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf.ncdump @@ -0,0 +1,213 @@ +netcdf AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf { + dimensions: + Latitude = 180; + Longitude = 360; + variables: + short TotalCounts_A(Latitude, Longitude); + TotalCounts_A:_FillValue = 0S; + string TotalCounts_A:coordinates = "Latitude Longitude"; + string TotalCounts_A:long_name = "ascending:TotalCounts_A"; + + // global attributes: + string :location.DescendingGridStartTimeUTC = "2002-11-30T13:30:00.000000Z"; + string :location.AscendingGridStartTimeUTC = "2002-12-01T01:30:00.000000Z"; + string :HDF_GLOBAL.HDFEOSVersion = "HDFEOS_V2.12"; + :location.TempPresLvlNum = 24; + :location.H2OPresLvls = 1000.0f, 925.0f, 850.0f, 700.0f, 600.0f, 500.0f, 400.0f, 300.0f, 250.0f, 200.0f, 150.0f, 100.0f; + :location.NumOfDays = 31; + string :location.AscendingGridEndTimeUTC = "2003-01-01T01:29:59.999999Z"; + :location.Month = 12; + :location.MWEmisFreqs = 23.8f, 50.3f, 89.0f; + string :location.DescendingGridEndTimeUTC = "2002-12-31T13:29:59.999999Z"; + :location.IREmisFreqs = 832.0f, 961.0f, 1203.0f, 2616.0f; + :location.Day = 1; + :location.TempPresLvls = 1000.0f, 925.0f, 850.0f, 700.0f, 600.0f, 500.0f, 400.0f, 300.0f, 250.0f, 200.0f, 150.0f, 100.0f, 70.0f, 50.0f, 30.0f, 20.0f, 15.0f, 10.0f, 7.0f, 5.0f, 3.0f, 2.0f, 1.5f, 1.0f; + :location.H2OPresLvlNum = 12; + :location.Year = 2002; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + TotalCounts_A = + { + {2, 2, 4, 0, 4, 0, 2, 2, 0, 2, 4, 4, 2, 4, 4, 4, 8, 6, 4, 12, 6, 0, 6, 8, 12, 6, 8, 10, 8, 10, 8, 4, 6, 2, 6, 6, 4, 6, 4, 2, 0, 4, 2, 2, 2, 0, 6, 4, 2, 4, 0, 0, 2, 8, 0, 6, 14, 6, 2, 2, 2, 16, 8, 4, 12, 4, 2, 10, 10, 8, 8, 4, 2, 10, 4, 2, 6, 4, 8, 4, 2, 0, 0, 2, 4, 0, 0, 4, 6, 4, 2, 4, 4, 4, 2, 6, 4, 4, 4, 4, 6, 12, 8, 6, 2, 8, 10, 14, 4, 10, 10, 8, 2, 10, 2, 2, 6, 4, 4, 8, 2, 4, 2, 0, 2, 0, 4, 0, 4, 0, 4, 0, 6, 6, 4, 2, 4, 10, 2, 6, 4, 10, 2, 4, 8, 8, 14, 8, 12, 6, 4, 6, 4, 10, 2, 4, 4, 8, 6, 2, 4, 0, 0, 2, 4, 4, 0, 6, 2, 2, 4, 0, 6, 2, 6, 4, 2, 8, 2, 8, 6, 6, 10, 10, 14, 4, 4, 4, 2, 14, 10, 10, 4, 4, 4, 2, 6, 6, 8, 6, 2, 2, 2, 2, 0, 0, 4, 0, 4, 2, 4, 4, 8, 2, 4, 2, 0, 10, 6, 8, 6, 4, 2, 6, 14, 10, 16, 2, 6, 4, 8, 4, 4, 8, 8, 2, 8, 4, 2, 2, 4, 0, 0, 6, 4, 0, 0, 2, 0, 6, 2, 0, 6, 6, 2, 6, 14, 0, 0, 4, 10, 10, 10, 10, 4, 8, 8, 6, 6, 12, 10, 4, 2, 4, 6, 6, 4, 4, 6, 4, 0, 2, 2, 2, 4, 2, 6, 2, 0, 2, 4, 2, 2, 6, 6, 6, 6, 4, 4, 8, 4, 14, 8, 10, 4, 6, 6, 10, 8, 8, 8, 2, 8, 10, 4, 4, 4, 4, 2, 6, 2, 4, 2, 0, 0, 0, 6, 0, 2, 2, 8, 4, 4, 6, 0, 4, 4, 4, 4, 14, 6, 8, 4, 8, 4, 14, 8, 8, 2, 12, 10, 4, 4, 10, 0, 2, 2, 10, 6, 4}, + {16, 22, 12, 20, 10, 4, 16, 12, 4, 20, 14, 24, 14, 6, 8, 20, 14, 22, 14, 10, 14, 0, 10, 18, 14, 10, 14, 10, 18, 12, 14, 20, 14, 12, 10, 18, 0, 8, 20, 8, 16, 18, 14, 10, 6, 18, 20, 26, 6, 10, 8, 16, 10, 4, 22, 8, 24, 4, 16, 24, 12, 8, 14, 10, 8, 14, 16, 8, 12, 6, 10, 14, 10, 24, 12, 6, 24, 16, 8, 10, 18, 10, 8, 10, 2, 18, 22, 18, 16, 8, 8, 16, 12, 20, 18, 10, 8, 6, 10, 18, 4, 20, 12, 10, 22, 10, 8, 12, 16, 6, 18, 8, 14, 6, 18, 14, 8, 18, 10, 22, 10, 20, 8, 20, 8, 8, 18, 14, 8, 4, 14, 14, 18, 14, 24, 10, 6, 18, 6, 12, 20, 14, 8, 12, 6, 8, 16, 14, 20, 12, 10, 16, 18, 10, 10, 16, 8, 12, 10, 2, 10, 22, 10, 18, 12, 18, 20, 4, 14, 18, 10, 14, 6, 12, 20, 10, 8, 14, 22, 12, 18, 22, 16, 4, 10, 18, 6, 18, 8, 14, 14, 10, 2, 18, 24, 14, 16, 14, 10, 12, 18, 4, 14, 20, 8, 10, 6, 10, 22, 28, 20, 10, 6, 12, 8, 14, 18, 20, 8, 8, 6, 14, 12, 22, 8, 10, 20, 14, 14, 8, 18, 6, 10, 14, 4, 10, 18, 14, 12, 16, 10, 32, 6, 10, 10, 18, 8, 12, 22, 14, 10, 4, 8, 18, 12, 32, 16, 16, 4, 12, 8, 10, 18, 12, 8, 8, 14, 6, 12, 24, 16, 14, 18, 8, 16, 20, 6, 12, 18, 8, 10, 12, 10, 14, 26, 14, 16, 22, 2, 12, 12, 14, 8, 20, 10, 8, 16, 10, 12, 14, 14, 22, 10, 20, 8, 8, 16, 12, 14, 8, 12, 18, 8, 16, 8, 18, 22, 14, 16, 6, 12, 10, 14, 8, 20, 20, 6, 6, 14, 4, 28, 24, 22, 0, 12, 12, 6, 10, 20, 12, 12, 8, 8, 14, 28, 12, 14, 12, 8, 24, 4, 14, 14, 10, 6, 14, 10, 14, 14, 14}, + {30, 20, 28, 14, 18, 28, 24, 34, 36, 20, 22, 30, 26, 26, 22, 28, 22, 24, 20, 24, 30, 18, 34, 26, 26, 30, 20, 26, 38, 20, 20, 22, 16, 22, 26, 26, 34, 30, 16, 24, 20, 32, 28, 26, 20, 24, 22, 28, 22, 24, 20, 28, 18, 18, 38, 36, 16, 26, 26, 24, 30, 20, 22, 30, 32, 18, 30, 20, 26, 28, 22, 26, 24, 20, 24, 22, 26, 30, 8, 28, 16, 32, 28, 36, 24, 18, 26, 30, 16, 30, 26, 12, 32, 16, 22, 38, 10, 34, 24, 22, 24, 26, 30, 30, 18, 28, 18, 26, 24, 18, 30, 28, 28, 26, 18, 28, 32, 24, 28, 20, 14, 22, 28, 24, 20, 20, 24, 26, 24, 30, 28, 34, 20, 12, 34, 22, 28, 22, 14, 36, 16, 36, 16, 36, 24, 22, 34, 20, 16, 24, 32, 22, 26, 18, 24, 20, 16, 38, 28, 36, 22, 16, 28, 20, 34, 22, 16, 22, 20, 34, 24, 22, 28, 20, 32, 18, 28, 38, 34, 14, 22, 22, 32, 28, 16, 26, 30, 34, 24, 18, 38, 34, 26, 22, 18, 26, 16, 36, 22, 26, 18, 18, 22, 24, 30, 34, 40, 14, 14, 38, 16, 34, 18, 26, 20, 30, 24, 18, 32, 28, 26, 26, 22, 22, 24, 24, 30, 22, 28, 18, 28, 20, 22, 30, 36, 22, 16, 36, 20, 30, 18, 20, 26, 18, 38, 18, 24, 22, 30, 22, 26, 20, 50, 18, 22, 22, 20, 36, 18, 26, 20, 30, 32, 16, 36, 26, 34, 24, 18, 28, 14, 24, 26, 28, 28, 22, 16, 24, 16, 34, 36, 28, 24, 18, 32, 20, 28, 24, 18, 22, 24, 22, 28, 32, 26, 28, 18, 30, 30, 18, 26, 30, 14, 34, 26, 12, 38, 12, 42, 24, 30, 20, 28, 34, 26, 12, 30, 16, 22, 30, 32, 22, 22, 18, 24, 24, 30, 36, 18, 32, 12, 24, 38, 14, 34, 20, 22, 38, 24, 34, 26, 30, 26, 22, 26, 16, 16, 32, 22, 34, 20, 22, 26, 24, 26, 28, 34, 22, 24, 20}, + {44, 34, 42, 34, 36, 40, 36, 38, 36, 44, 34, 42, 34, 50, 42, 38, 38, 46, 40, 36, 36, 46, 50, 32, 42, 34, 30, 44, 38, 36, 42, 36, 46, 40, 26, 50, 32, 40, 32, 40, 34, 34, 50, 22, 48, 40, 24, 38, 48, 44, 42, 36, 40, 36, 42, 36, 40, 36, 44, 44, 28, 52, 32, 40, 40, 38, 28, 42, 36, 54, 38, 28, 40, 34, 30, 50, 34, 34, 38, 34, 38, 34, 32, 42, 40, 34, 34, 26, 52, 38, 44, 36, 44, 36, 36, 36, 46, 40, 48, 30, 38, 40, 34, 40, 38, 38, 40, 46, 24, 40, 34, 36, 44, 28, 36, 38, 44, 42, 30, 40, 34, 36, 40, 40, 40, 40, 46, 32, 30, 42, 38, 34, 40, 40, 38, 38, 38, 50, 32, 44, 38, 38, 40, 32, 56, 44, 34, 34, 44, 34, 42, 42, 26, 38, 46, 38, 40, 34, 36, 38, 38, 32, 38, 46, 34, 36, 40, 40, 34, 42, 28, 50, 36, 44, 34, 36, 38, 44, 40, 42, 38, 38, 50, 36, 50, 34, 48, 32, 28, 40, 42, 34, 50, 32, 40, 36, 32, 44, 28, 50, 36, 36, 38, 28, 54, 28, 42, 32, 40, 36, 40, 46, 40, 48, 44, 36, 40, 44, 28, 52, 40, 46, 24, 48, 40, 34, 46, 38, 38, 38, 40, 32, 44, 40, 34, 34, 28, 42, 42, 48, 32, 36, 44, 40, 34, 28, 54, 38, 36, 36, 40, 42, 46, 34, 36, 40, 28, 54, 26, 60, 30, 44, 40, 28, 38, 44, 38, 48, 40, 30, 36, 42, 36, 38, 40, 32, 42, 38, 36, 48, 28, 38, 38, 40, 26, 48, 40, 42, 42, 46, 36, 40, 42, 36, 46, 36, 48, 30, 38, 48, 34, 42, 42, 34, 40, 48, 40, 46, 30, 36, 36, 34, 42, 40, 38, 38, 38, 44, 36, 34, 40, 40, 44, 34, 36, 42, 36, 48, 36, 38, 42, 30, 42, 38, 54, 36, 38, 40, 32, 38, 46, 38, 42, 38, 50, 24, 52, 38, 38, 38, 38, 36, 38, 42, 46, 32, 36, 38, 32, 36}, + {60, 66, 64, 52, 48, 56, 50, 58, 64, 56, 54, 52, 58, 66, 54, 56, 46, 50, 64, 60, 54, 50, 80, 54, 62, 46, 52, 62, 66, 66, 54, 50, 66, 48, 68, 58, 58, 54, 52, 66, 58, 52, 70, 42, 56, 60, 44, 54, 56, 60, 62, 56, 44, 56, 52, 60, 56, 56, 62, 50, 58, 62, 60, 70, 40, 46, 62, 64, 54, 56, 64, 50, 50, 54, 46, 62, 70, 54, 56, 44, 54, 56, 50, 70, 58, 48, 44, 58, 60, 60, 50, 46, 46, 66, 50, 48, 62, 64, 56, 64, 42, 42, 68, 54, 60, 52, 54, 54, 38, 74, 56, 62, 46, 44, 66, 68, 54, 62, 54, 60, 56, 50, 52, 54, 64, 52, 54, 52, 58, 52, 60, 56, 68, 38, 56, 52, 68, 52, 60, 42, 50, 68, 56, 50, 50, 72, 58, 50, 48, 56, 64, 60, 48, 62, 44, 68, 44, 68, 54, 62, 50, 52, 54, 70, 64, 58, 36, 62, 56, 56, 50, 52, 72, 50, 54, 60, 54, 62, 56, 58, 52, 54, 62, 50, 72, 58, 54, 56, 48, 66, 66, 64, 60, 52, 56, 50, 56, 60, 54, 70, 46, 62, 46, 66, 60, 58, 56, 62, 50, 52, 58, 68, 60, 50, 44, 52, 70, 50, 68, 50, 70, 54, 56, 52, 52, 70, 54, 52, 60, 48, 66, 44, 64, 66, 52, 58, 46, 70, 54, 72, 58, 38, 66, 52, 48, 68, 50, 58, 56, 56, 52, 62, 46, 66, 54, 60, 54, 48, 54, 76, 58, 60, 46, 48, 72, 46, 76, 48, 62, 60, 44, 60, 56, 62, 64, 40, 72, 54, 50, 58, 60, 58, 58, 50, 52, 68, 54, 70, 46, 46, 58, 60, 50, 62, 60, 66, 42, 70, 46, 64, 56, 54, 48, 64, 60, 54, 50, 72, 70, 54, 54, 52, 56, 76, 60, 58, 54, 62, 54, 42, 66, 56, 66, 40, 58, 58, 54, 58, 54, 52, 66, 52, 48, 62, 58, 68, 52, 42, 54, 66, 48, 60, 68, 58, 50, 56, 58, 54, 68, 58, 48, 60, 60, 58, 58, 60, 58, 54, 50, 56}, + {84, 78, 78, 82, 74, 80, 70, 82, 72, 88, 68, 86, 76, 74, 68, 78, 80, 84, 72, 74, 80, 64, 80, 84, 74, 80, 66, 72, 76, 64, 74, 72, 62, 78, 72, 82, 68, 80, 68, 82, 60, 84, 88, 70, 80, 64, 72, 76, 72, 90, 70, 76, 70, 82, 74, 78, 76, 70, 76, 92, 62, 82, 60, 80, 88, 62, 72, 66, 68, 70, 78, 72, 66, 68, 72, 76, 68, 82, 72, 58, 80, 76, 72, 82, 54, 82, 88, 64, 80, 70, 84, 72, 98, 72, 52, 90, 60, 82, 90, 66, 78, 60, 84, 74, 60, 74, 66, 80, 76, 60, 64, 86, 70, 68, 78, 60, 74, 90, 60, 90, 60, 76, 70, 78, 74, 82, 66, 76, 78, 82, 70, 82, 82, 62, 96, 60, 78, 72, 72, 92, 62, 82, 68, 80, 64, 78, 80, 70, 72, 64, 78, 86, 66, 80, 56, 72, 86, 62, 78, 62, 78, 78, 70, 80, 72, 80, 78, 82, 74, 64, 86, 72, 84, 76, 74, 70, 82, 74, 92, 72, 66, 76, 84, 70, 88, 60, 88, 92, 56, 74, 78, 68, 78, 70, 72, 72, 76, 58, 80, 86, 74, 78, 64, 78, 86, 70, 78, 70, 72, 84, 76, 82, 76, 76, 76, 80, 74, 78, 82, 60, 82, 78, 74, 80, 60, 80, 72, 68, 72, 70, 78, 68, 84, 72, 60, 92, 56, 84, 62, 84, 70, 82, 78, 58, 90, 66, 74, 80, 78, 78, 70, 78, 90, 70, 82, 82, 66, 86, 68, 84, 80, 66, 86, 66, 74, 76, 74, 74, 66, 76, 82, 56, 86, 70, 84, 68, 82, 54, 90, 76, 62, 98, 58, 86, 72, 68, 86, 72, 86, 76, 88, 74, 76, 80, 74, 86, 82, 70, 80, 70, 80, 80, 54, 78, 66, 78, 76, 76, 64, 86, 76, 44, 92, 72, 70, 76, 60, 88, 76, 66, 74, 70, 82, 78, 76, 72, 78, 84, 68, 82, 76, 64, 106, 68, 78, 72, 84, 76, 76, 72, 86, 76, 64, 76, 72, 78, 84, 58, 86, 80, 62, 76, 66, 82, 82, 68, 82, 70, 72, 70}, + {98, 126, 94, 80, 94, 116, 116, 86, 98, 116, 112, 92, 102, 108, 126, 100, 94, 86, 120, 114, 86, 108, 104, 106, 92, 94, 112, 104, 122, 96, 82, 116, 106, 86, 100, 108, 112, 102, 90, 86, 110, 118, 88, 90, 106, 114, 100, 98, 102, 110, 104, 98, 86, 116, 118, 100, 100, 102, 98, 96, 106, 94, 106, 124, 86, 98, 92, 130, 100, 78, 118, 100, 98, 82, 98, 118, 108, 102, 68, 104, 120, 84, 104, 90, 112, 104, 96, 102, 82, 130, 86, 84, 98, 116, 106, 86, 100, 100, 120, 86, 100, 100, 122, 104, 76, 96, 114, 126, 86, 88, 98, 120, 90, 92, 96, 118, 112, 88, 102, 102, 108, 88, 92, 104, 116, 94, 96, 70, 124, 122, 76, 100, 108, 108, 88, 108, 96, 126, 102, 102, 96, 104, 124, 86, 100, 108, 114, 90, 88, 104, 100, 120, 86, 72, 130, 98, 100, 98, 100, 112, 104, 86, 102, 106, 112, 98, 84, 104, 130, 90, 92, 112, 110, 108, 96, 94, 122, 128, 90, 92, 108, 116, 102, 96, 90, 116, 126, 80, 100, 106, 114, 118, 76, 120, 108, 100, 98, 88, 110, 102, 96, 88, 100, 128, 94, 100, 100, 110, 116, 92, 100, 122, 102, 106, 92, 82, 130, 114, 80, 110, 120, 98, 98, 98, 104, 114, 100, 94, 94, 108, 110, 84, 100, 112, 106, 88, 98, 106, 118, 120, 74, 106, 120, 100, 104, 96, 110, 104, 106, 92, 88, 140, 100, 100, 94, 94, 124, 86, 112, 98, 120, 98, 96, 104, 102, 130, 76, 100, 116, 110, 90, 86, 102, 116, 106, 88, 94, 124, 104, 96, 90, 108, 122, 90, 100, 104, 116, 106, 92, 74, 122, 140, 66, 108, 98, 110, 102, 96, 106, 116, 126, 98, 78, 110, 124, 108, 84, 114, 120, 104, 96, 86, 96, 134, 110, 78, 102, 114, 104, 94, 84, 130, 106, 90, 98, 102, 116, 108, 88, 96, 122, 100, 92, 116, 108, 120, 102, 96, 108, 124, 106, 76, 116, 114, 112, 90, 90, 108, 120, 90, 94, 90, 118, 110, 74, 116, 98, 108, 94, 96}, + {100, 140, 114, 118, 138, 120, 134, 116, 104, 158, 98, 150, 112, 122, 152, 108, 106, 152, 112, 134, 124, 120, 148, 114, 138, 124, 100, 146, 112, 136, 122, 116, 122, 110, 138, 124, 110, 132, 122, 130, 134, 112, 136, 122, 108, 132, 116, 118, 132, 104, 132, 118, 116, 136, 128, 126, 118, 136, 120, 108, 144, 118, 128, 120, 120, 136, 116, 110, 126, 104, 136, 110, 122, 120, 110, 122, 136, 110, 124, 118, 126, 126, 116, 124, 112, 120, 116, 120, 132, 116, 120, 134, 110, 118, 122, 100, 148, 118, 120, 128, 98, 136, 124, 106, 128, 114, 128, 104, 116, 132, 116, 130, 108, 114, 150, 110, 130, 106, 120, 134, 106, 104, 128, 110, 136, 124, 106, 132, 118, 118, 146, 104, 130, 114, 116, 132, 126, 126, 100, 118, 142, 106, 150, 98, 136, 142, 102, 122, 130, 104, 140, 114, 122, 128, 112, 124, 110, 114, 148, 94, 128, 126, 106, 136, 112, 112, 140, 118, 130, 112, 126, 142, 102, 140, 110, 112, 154, 104, 126, 146, 108, 144, 106, 120, 154, 114, 142, 106, 122, 148, 106, 124, 130, 110, 124, 108, 120, 140, 104, 136, 120, 126, 132, 118, 130, 130, 108, 140, 108, 134, 132, 98, 158, 106, 116, 148, 108, 130, 134, 114, 146, 112, 142, 106, 126, 120, 110, 140, 120, 114, 126, 114, 126, 136, 122, 104, 132, 116, 140, 130, 110, 132, 116, 124, 116, 122, 138, 112, 130, 110, 134, 114, 124, 138, 120, 136, 110, 128, 142, 110, 134, 126, 116, 124, 120, 128, 116, 128, 132, 116, 114, 130, 124, 128, 128, 112, 136, 128, 106, 138, 116, 138, 92, 130, 106, 122, 144, 114, 124, 142, 106, 132, 118, 116, 144, 136, 108, 140, 114, 128, 116, 114, 140, 118, 120, 110, 132, 144, 102, 146, 110, 122, 156, 108, 130, 128, 110, 146, 100, 110, 144, 108, 116, 126, 98, 156, 116, 114, 148, 102, 134, 114, 118, 140, 114, 152, 96, 120, 152, 120, 132, 110, 112, 164, 98, 132, 130, 114, 138, 112, 124, 124, 116, 128, 124, 126, 122, 122, 102, 152}, + {154, 130, 150, 136, 158, 138, 130, 160, 146, 146, 138, 138, 142, 144, 152, 130, 148, 152, 162, 138, 144, 170, 126, 162, 142, 150, 148, 142, 152, 138, 172, 142, 136, 156, 130, 162, 138, 144, 146, 144, 144, 138, 138, 146, 156, 128, 148, 146, 144, 146, 132, 154, 138, 146, 146, 138, 142, 162, 138, 144, 160, 138, 144, 146, 150, 140, 142, 162, 118, 174, 144, 126, 146, 142, 154, 146, 130, 154, 130, 156, 140, 134, 142, 148, 136, 144, 150, 136, 142, 140, 142, 146, 138, 160, 140, 140, 156, 136, 144, 140, 156, 134, 140, 138, 160, 136, 156, 136, 128, 162, 126, 160, 152, 128, 162, 138, 144, 138, 160, 140, 116, 158, 150, 146, 136, 142, 146, 142, 148, 134, 154, 144, 150, 130, 148, 158, 126, 152, 146, 132, 160, 138, 152, 146, 146, 142, 146, 146, 160, 148, 128, 156, 146, 154, 146, 160, 130, 144, 160, 126, 172, 146, 136, 158, 146, 146, 146, 140, 146, 144, 144, 136, 160, 134, 154, 132, 146, 154, 128, 166, 142, 140, 152, 168, 138, 144, 170, 144, 152, 148, 158, 148, 156, 148, 138, 148, 136, 160, 146, 144, 152, 132, 170, 134, 124, 150, 150, 144, 130, 156, 146, 156, 138, 138, 142, 150, 164, 134, 158, 150, 142, 144, 152, 150, 146, 148, 140, 144, 166, 150, 126, 152, 154, 130, 148, 130, 164, 160, 136, 146, 138, 156, 144, 130, 162, 142, 150, 130, 164, 150, 140, 152, 142, 164, 138, 160, 124, 158, 162, 128, 170, 134, 156, 156, 132, 152, 138, 180, 148, 116, 170, 148, 138, 142, 158, 134, 160, 144, 146, 136, 154, 152, 136, 152, 156, 138, 162, 124, 160, 138, 164, 148, 134, 148, 152, 134, 144, 166, 136, 142, 154, 144, 148, 130, 168, 148, 146, 164, 136, 152, 150, 146, 152, 148, 140, 152, 156, 142, 126, 158, 158, 138, 152, 150, 136, 156, 140, 128, 166, 150, 130, 134, 162, 148, 136, 152, 148, 148, 152, 164, 118, 172, 144, 142, 148, 152, 156, 130, 156, 156, 142, 158, 148, 158, 134, 164, 142, 138, 150, 148}, + {168, 176, 158, 168, 166, 168, 178, 182, 172, 174, 180, 190, 170, 166, 186, 172, 148, 212, 146, 182, 168, 172, 172, 172, 174, 160, 176, 172, 162, 178, 156, 174, 196, 164, 172, 170, 162, 176, 168, 176, 178, 150, 188, 166, 184, 172, 162, 164, 188, 152, 184, 170, 170, 166, 162, 180, 182, 152, 170, 176, 170, 164, 184, 158, 158, 182, 188, 146, 180, 158, 162, 170, 170, 162, 156, 172, 176, 148, 168, 182, 158, 168, 178, 146, 174, 184, 158, 172, 162, 180, 152, 178, 146, 176, 172, 152, 166, 176, 144, 184, 160, 166, 188, 162, 146, 188, 156, 176, 158, 152, 162, 180, 146, 174, 164, 170, 160, 186, 156, 172, 184, 156, 160, 164, 168, 176, 152, 146, 188, 154, 168, 168, 152, 192, 184, 142, 184, 162, 182, 166, 190, 150, 184, 168, 164, 164, 190, 158, 174, 158, 176, 168, 142, 180, 182, 150, 196, 144, 166, 170, 166, 172, 170, 154, 180, 162, 174, 170, 178, 164, 174, 168, 180, 186, 166, 164, 184, 178, 164, 192, 150, 182, 190, 158, 166, 180, 162, 168, 170, 178, 146, 202, 152, 174, 176, 166, 156, 170, 168, 180, 158, 168, 176, 166, 180, 186, 156, 180, 164, 176, 176, 190, 162, 170, 180, 184, 160, 174, 172, 174, 176, 166, 186, 154, 178, 172, 162, 180, 186, 148, 180, 168, 166, 170, 182, 158, 176, 174, 174, 158, 178, 170, 182, 174, 166, 162, 182, 158, 182, 168, 172, 174, 160, 164, 174, 178, 182, 158, 186, 170, 164, 184, 160, 174, 186, 170, 164, 168, 168, 180, 164, 166, 176, 172, 160, 158, 166, 194, 148, 200, 150, 154, 196, 182, 156, 160, 198, 176, 144, 188, 158, 174, 174, 180, 150, 194, 178, 162, 180, 178, 184, 164, 170, 182, 166, 172, 170, 168, 186, 164, 178, 168, 170, 174, 176, 158, 184, 170, 168, 154, 178, 158, 164, 190, 156, 152, 194, 160, 184, 166, 164, 204, 162, 164, 188, 164, 174, 166, 178, 182, 174, 170, 162, 184, 178, 158, 170, 176, 168, 166, 166, 180, 166, 174, 178, 152, 172, 174, 156, 180}, + {184, 192, 186, 178, 186, 188, 182, 190, 168, 194, 192, 166, 200, 178, 184, 190, 180, 188, 180, 190, 192, 162, 202, 188, 176, 184, 178, 200, 178, 170, 202, 162, 192, 178, 172, 206, 182, 188, 184, 174, 202, 176, 180, 194, 176, 178, 182, 176, 184, 186, 190, 194, 174, 190, 174, 188, 188, 188, 186, 176, 182, 194, 166, 182, 196, 158, 188, 176, 184, 182, 164, 202, 158, 186, 180, 178, 190, 180, 182, 186, 166, 190, 178, 172, 196, 168, 204, 186, 170, 202, 160, 196, 188, 160, 190, 160, 202, 176, 184, 178, 186, 166, 180, 160, 198, 174, 172, 190, 178, 168, 182, 178, 178, 190, 166, 198, 172, 174, 194, 168, 192, 176, 190, 178, 174, 188, 184, 186, 188, 174, 204, 172, 164, 192, 156, 216, 184, 150, 206, 156, 190, 180, 172, 194, 168, 206, 156, 178, 192, 176, 184, 170, 170, 200, 166, 172, 194, 188, 182, 186, 166, 206, 186, 170, 212, 168, 194, 190, 180, 196, 178, 170, 194, 176, 186, 170, 204, 176, 176, 202, 166, 188, 192, 160, 206, 180, 196, 190, 162, 200, 186, 176, 210, 182, 172, 176, 196, 184, 186, 196, 172, 190, 180, 174, 192, 192, 188, 182, 176, 192, 194, 174, 182, 192, 174, 204, 196, 160, 194, 178, 194, 188, 180, 184, 176, 176, 190, 168, 192, 174, 202, 178, 160, 216, 160, 200, 186, 172, 204, 178, 184, 198, 170, 182, 196, 186, 178, 186, 186, 194, 192, 176, 192, 200, 188, 170, 186, 182, 208, 166, 180, 190, 168, 188, 190, 166, 194, 198, 172, 184, 192, 174, 188, 190, 194, 182, 180, 182, 176, 186, 196, 170, 204, 154, 216, 188, 174, 206, 172, 192, 190, 170, 192, 188, 180, 184, 168, 202, 184, 178, 164, 182, 196, 168, 172, 192, 176, 214, 156, 186, 180, 186, 188, 196, 164, 210, 172, 178, 186, 186, 186, 198, 178, 194, 170, 200, 198, 172, 202, 196, 160, 190, 170, 198, 178, 174, 208, 156, 204, 180, 170, 208, 178, 182, 182, 176, 204, 162, 190, 168, 188, 188, 184, 176, 188, 184, 202, 166, 192, 192}, + {196, 226, 164, 214, 202, 180, 212, 198, 198, 194, 206, 200, 162, 226, 206, 162, 244, 172, 196, 232, 154, 218, 214, 184, 224, 192, 200, 194, 200, 202, 186, 216, 196, 178, 204, 196, 186, 208, 192, 200, 206, 178, 226, 178, 200, 192, 176, 234, 162, 206, 228, 140, 218, 200, 172, 222, 196, 188, 212, 180, 206, 190, 216, 182, 180, 236, 164, 210, 216, 148, 230, 186, 180, 214, 170, 200, 190, 184, 212, 180, 202, 204, 170, 216, 176, 180, 212, 170, 196, 208, 170, 208, 178, 210, 182, 200, 210, 158, 220, 204, 152, 232, 180, 168, 214, 190, 182, 218, 178, 208, 182, 194, 200, 192, 212, 172, 210, 190, 168, 226, 178, 182, 206, 184, 182, 190, 206, 198, 168, 220, 192, 176, 226, 180, 186, 222, 160, 224, 200, 162, 228, 190, 198, 196, 220, 198, 166, 222, 186, 190, 232, 172, 182, 216, 186, 194, 196, 192, 194, 194, 210, 178, 192, 224, 170, 198, 194, 176, 220, 172, 192, 212, 198, 198, 172, 234, 180, 194, 212, 184, 198, 230, 166, 202, 222, 186, 212, 194, 194, 206, 196, 206, 196, 214, 190, 186, 212, 184, 190, 220, 182, 208, 204, 178, 200, 204, 196, 194, 196, 222, 166, 206, 226, 146, 240, 188, 186, 236, 168, 198, 204, 190, 214, 202, 198, 178, 210, 206, 182, 200, 206, 170, 222, 184, 186, 222, 184, 210, 196, 178, 220, 164, 222, 196, 174, 222, 174, 194, 220, 182, 200, 216, 170, 206, 194, 180, 202, 202, 218, 174, 230, 198, 174, 238, 168, 210, 220, 166, 206, 202, 180, 196, 210, 196, 198, 200, 212, 184, 196, 214, 178, 222, 180, 190, 200, 186, 216, 188, 202, 204, 184, 216, 180, 204, 218, 166, 220, 216, 168, 228, 204, 166, 224, 194, 202, 200, 202, 214, 186, 222, 174, 192, 234, 160, 228, 216, 178, 212, 184, 196, 200, 204, 186, 182, 198, 216, 168, 220, 200, 164, 240, 174, 190, 222, 192, 204, 194, 206, 204, 192, 204, 162, 230, 206, 170, 222, 204, 172, 230, 188, 188, 218, 186, 206, 208, 194, 180, 184, 232, 172}, + {216, 204, 212, 194, 218, 196, 204, 218, 192, 220, 212, 192, 216, 214, 206, 202, 228, 200, 212, 224, 206, 216, 198, 220, 208, 210, 220, 196, 218, 218, 200, 200, 228, 208, 214, 206, 204, 216, 212, 194, 212, 234, 194, 186, 222, 194, 208, 208, 210, 202, 202, 208, 206, 226, 190, 212, 210, 200, 218, 192, 220, 206, 230, 210, 194, 220, 200, 196, 206, 216, 204, 192, 220, 188, 208, 218, 192, 202, 200, 202, 204, 208, 194, 216, 208, 194, 210, 192, 214, 202, 218, 196, 202, 212, 198, 196, 200, 212, 198, 188, 224, 198, 216, 198, 208, 186, 200, 220, 180, 206, 192, 232, 196, 178, 230, 200, 200, 212, 214, 194, 208, 208, 202, 212, 188, 218, 208, 190, 208, 192, 214, 188, 218, 194, 192, 214, 198, 222, 196, 224, 178, 222, 216, 200, 196, 216, 218, 192, 204, 222, 198, 214, 192, 220, 212, 206, 214, 216, 202, 194, 226, 188, 206, 224, 196, 216, 192, 222, 192, 212, 208, 196, 224, 192, 218, 210, 210, 198, 218, 200, 202, 226, 210, 206, 216, 208, 218, 198, 236, 190, 220, 228, 188, 208, 216, 224, 186, 214, 204, 210, 198, 206, 224, 214, 190, 206, 226, 196, 212, 224, 184, 230, 214, 198, 208, 214, 226, 196, 214, 216, 216, 198, 214, 218, 202, 214, 202, 220, 196, 210, 220, 198, 220, 200, 210, 190, 214, 218, 176, 248, 204, 220, 190, 202, 224, 204, 208, 202, 216, 178, 222, 232, 188, 218, 216, 222, 186, 218, 218, 204, 228, 188, 220, 216, 214, 216, 188, 242, 204, 212, 194, 208, 214, 202, 216, 190, 234, 190, 208, 214, 180, 228, 222, 198, 194, 232, 206, 194, 248, 192, 208, 212, 212, 212, 204, 222, 198, 232, 174, 236, 214, 204, 192, 202, 236, 192, 204, 220, 198, 228, 208, 212, 212, 234, 188, 194, 252, 184, 218, 208, 212, 202, 204, 206, 200, 238, 176, 220, 218, 188, 218, 210, 206, 204, 220, 204, 204, 218, 204, 220, 206, 222, 202, 200, 228, 202, 214, 204, 220, 198, 216, 208, 208, 224, 192, 234, 210, 198, 212, 196}, + {236, 202, 184, 222, 206, 220, 198, 200, 208, 216, 204, 210, 212, 210, 200, 236, 186, 220, 212, 194, 224, 206, 182, 212, 218, 204, 202, 208, 198, 216, 200, 204, 210, 204, 208, 194, 206, 212, 198, 204, 208, 198, 202, 222, 206, 202, 204, 200, 208, 236, 180, 216, 202, 198, 224, 208, 190, 220, 206, 208, 214, 182, 206, 218, 216, 190, 220, 190, 218, 212, 188, 202, 208, 196, 200, 202, 198, 214, 198, 196, 208, 196, 216, 202, 180, 218, 212, 200, 224, 200, 190, 214, 202, 194, 216, 198, 202, 210, 216, 186, 220, 196, 208, 202, 184, 208, 208, 196, 206, 194, 198, 198, 196, 224, 194, 204, 208, 208, 192, 202, 182, 208, 214, 188, 198, 222, 204, 192, 204, 218, 176, 220, 190, 216, 220, 188, 196, 226, 178, 216, 212, 198, 220, 186, 210, 218, 202, 208, 200, 198, 224, 210, 186, 194, 208, 188, 220, 192, 198, 212, 216, 194, 226, 194, 206, 222, 196, 210, 208, 202, 212, 208, 198, 206, 214, 208, 220, 194, 210, 228, 194, 200, 244, 190, 190, 226, 200, 204, 212, 200, 222, 202, 182, 224, 210, 204, 216, 190, 206, 222, 192, 208, 204, 212, 220, 204, 188, 222, 190, 204, 230, 204, 192, 244, 210, 184, 220, 202, 216, 222, 188, 200, 210, 200, 212, 198, 214, 218, 204, 196, 206, 226, 202, 202, 200, 220, 202, 192, 226, 224, 178, 214, 218, 192, 234, 184, 200, 228, 214, 202, 210, 202, 224, 220, 200, 198, 228, 198, 204, 208, 208, 196, 224, 212, 204, 206, 210, 218, 190, 206, 210, 196, 208, 212, 182, 212, 224, 202, 206, 206, 210, 224, 194, 196, 236, 182, 210, 220, 198, 208, 218, 190, 230, 208, 186, 228, 212, 192, 210, 202, 198, 226, 206, 198, 216, 202, 212, 216, 194, 226, 186, 224, 212, 200, 202, 218, 210, 194, 204, 206, 210, 208, 212, 208, 208, 190, 234, 214, 176, 232, 202, 204, 226, 194, 192, 236, 210, 192, 218, 220, 206, 224, 196, 210, 224, 202, 202, 212, 198, 212, 202, 204, 216, 194, 208, 204, 200, 214, 210, 180}, + {202, 232, 228, 212, 240, 226, 214, 220, 222, 214, 224, 216, 226, 224, 228, 226, 206, 220, 224, 234, 220, 206, 236, 228, 220, 224, 222, 216, 218, 222, 218, 200, 226, 220, 228, 244, 200, 226, 224, 220, 212, 212, 242, 214, 218, 206, 228, 218, 224, 198, 230, 196, 246, 220, 228, 230, 216, 202, 216, 232, 210, 228, 236, 194, 230, 206, 230, 212, 216, 232, 208, 198, 230, 222, 220, 200, 232, 212, 214, 208, 220, 226, 204, 232, 234, 180, 238, 218, 194, 224, 216, 224, 206, 228, 200, 212, 228, 210, 198, 220, 206, 234, 206, 220, 212, 198, 206, 230, 212, 208, 214, 240, 212, 194, 234, 224, 194, 236, 216, 202, 228, 204, 200, 234, 202, 208, 214, 222, 204, 216, 232, 214, 240, 202, 194, 234, 210, 200, 230, 216, 218, 212, 232, 206, 230, 206, 222, 216, 238, 188, 240, 206, 224, 206, 216, 234, 214, 220, 214, 196, 230, 218, 220, 216, 228, 210, 244, 204, 204, 252, 206, 216, 224, 210, 230, 220, 200, 228, 230, 236, 214, 236, 200, 226, 234, 228, 214, 230, 206, 240, 220, 208, 230, 230, 208, 208, 224, 240, 204, 230, 228, 208, 218, 228, 216, 236, 218, 202, 220, 252, 194, 238, 226, 212, 216, 244, 212, 224, 224, 212, 228, 240, 208, 230, 224, 200, 216, 224, 236, 208, 222, 218, 218, 226, 220, 212, 246, 204, 220, 232, 232, 204, 232, 228, 204, 222, 236, 204, 238, 220, 208, 222, 238, 206, 232, 222, 196, 242, 238, 200, 218, 230, 220, 216, 224, 220, 224, 220, 216, 226, 220, 232, 214, 230, 218, 216, 214, 254, 194, 238, 200, 236, 236, 208, 206, 240, 220, 234, 202, 224, 228, 220, 214, 224, 234, 214, 214, 242, 196, 240, 224, 222, 210, 220, 210, 228, 232, 226, 214, 244, 212, 216, 212, 240, 218, 226, 212, 226, 228, 208, 212, 236, 210, 202, 246, 218, 212, 226, 228, 204, 232, 244, 194, 220, 244, 204, 244, 210, 216, 220, 240, 222, 222, 216, 222, 226, 238, 206, 232, 218, 214, 216, 218, 222, 226, 238, 214, 192, 228, 242}, + {220, 218, 208, 218, 216, 208, 238, 200, 226, 236, 202, 212, 222, 220, 206, 230, 216, 214, 232, 220, 188, 238, 228, 222, 228, 194, 210, 224, 218, 226, 232, 220, 198, 214, 226, 200, 240, 234, 208, 232, 216, 188, 234, 224, 202, 212, 232, 224, 208, 222, 210, 206, 252, 190, 214, 244, 192, 232, 234, 196, 214, 214, 230, 218, 202, 230, 202, 232, 220, 192, 246, 224, 198, 212, 212, 208, 220, 230, 218, 216, 218, 198, 208, 242, 188, 236, 214, 198, 216, 214, 208, 218, 218, 210, 216, 220, 194, 218, 208, 222, 208, 226, 210, 192, 224, 198, 224, 210, 208, 212, 220, 218, 206, 216, 202, 208, 232, 196, 206, 228, 208, 212, 216, 178, 240, 222, 202, 212, 200, 202, 222, 220, 206, 208, 226, 214, 192, 222, 210, 216, 226, 202, 216, 220, 218, 206, 202, 210, 220, 220, 226, 194, 214, 216, 188, 234, 214, 202, 232, 232, 186, 210, 226, 216, 200, 242, 196, 220, 228, 202, 212, 222, 208, 234, 206, 214, 218, 212, 226, 214, 224, 202, 228, 224, 210, 206, 240, 214, 218, 230, 226, 208, 210, 228, 206, 208, 230, 208, 232, 228, 184, 228, 230, 200, 244, 202, 212, 236, 224, 176, 232, 214, 206, 224, 240, 204, 218, 238, 200, 218, 232, 208, 224, 216, 226, 196, 226, 218, 216, 230, 216, 208, 240, 204, 196, 238, 208, 222, 230, 204, 208, 228, 212, 208, 218, 232, 212, 236, 220, 186, 228, 220, 202, 238, 206, 234, 218, 222, 186, 242, 222, 216, 212, 230, 204, 218, 240, 194, 234, 224, 198, 226, 216, 222, 214, 224, 222, 216, 224, 210, 212, 224, 190, 220, 228, 206, 234, 232, 198, 206, 232, 210, 220, 216, 224, 220, 226, 188, 222, 240, 200, 216, 246, 196, 212, 224, 226, 202, 218, 236, 218, 214, 222, 210, 226, 230, 192, 232, 228, 192, 230, 210, 206, 214, 230, 210, 224, 234, 196, 214, 238, 190, 222, 238, 208, 226, 202, 234, 204, 220, 216, 232, 224, 214, 218, 220, 194, 234, 224, 214, 218, 216, 222, 206, 216, 226, 216, 224, 214, 210}, + {204, 206, 218, 220, 200, 214, 198, 204, 208, 204, 208, 214, 216, 202, 204, 216, 192, 220, 212, 182, 228, 198, 228, 196, 206, 212, 198, 230, 202, 204, 218, 214, 200, 218, 192, 212, 210, 200, 206, 212, 200, 208, 220, 216, 192, 214, 200, 212, 212, 210, 188, 222, 186, 214, 218, 188, 204, 210, 196, 206, 214, 220, 196, 216, 210, 204, 220, 198, 196, 222, 208, 212, 196, 204, 206, 204, 220, 188, 200, 218, 182, 230, 206, 182, 214, 210, 206, 194, 220, 192, 204, 218, 192, 196, 206, 214, 198, 200, 208, 194, 220, 202, 208, 208, 186, 212, 210, 200, 202, 202, 208, 192, 200, 226, 192, 220, 188, 212, 208, 222, 190, 190, 200, 208, 198, 212, 198, 216, 200, 192, 198, 204, 186, 218, 216, 198, 200, 206, 208, 204, 208, 194, 204, 210, 204, 212, 196, 198, 214, 222, 198, 208, 210, 194, 216, 210, 194, 206, 214, 216, 190, 218, 206, 212, 210, 198, 196, 224, 202, 214, 206, 198, 210, 202, 224, 188, 224, 210, 182, 228, 214, 190, 224, 228, 184, 196, 216, 214, 206, 216, 212, 200, 226, 198, 214, 214, 210, 216, 218, 188, 208, 212, 200, 224, 212, 190, 220, 220, 200, 184, 240, 202, 202, 216, 196, 208, 206, 202, 208, 188, 224, 214, 208, 216, 202, 200, 222, 198, 226, 192, 204, 228, 224, 184, 214, 200, 218, 216, 218, 196, 208, 220, 202, 204, 224, 192, 214, 206, 208, 210, 198, 218, 204, 200, 212, 206, 208, 204, 206, 212, 202, 210, 220, 192, 214, 214, 194, 228, 208, 224, 204, 212, 212, 188, 220, 208, 196, 226, 198, 212, 234, 204, 194, 212, 214, 204, 216, 200, 204, 218, 200, 202, 224, 214, 196, 238, 196, 198, 214, 206, 226, 204, 208, 208, 216, 216, 180, 210, 220, 204, 212, 218, 200, 214, 212, 206, 224, 208, 198, 230, 210, 192, 208, 218, 214, 190, 222, 192, 218, 214, 190, 210, 214, 216, 208, 224, 192, 206, 226, 200, 210, 212, 206, 214, 202, 198, 210, 226, 198, 206, 210, 218, 196, 232, 206, 186, 210, 228, 202, 208}, + {182, 188, 194, 186, 190, 222, 186, 184, 224, 170, 184, 212, 180, 200, 206, 180, 204, 190, 182, 202, 174, 210, 200, 182, 192, 200, 174, 196, 192, 198, 198, 190, 200, 214, 166, 190, 236, 180, 176, 232, 170, 194, 226, 160, 200, 208, 178, 210, 200, 170, 208, 186, 192, 208, 194, 186, 184, 200, 186, 196, 200, 188, 196, 186, 200, 180, 182, 212, 172, 194, 208, 190, 198, 206, 172, 200, 226, 162, 210, 204, 174, 208, 184, 184, 206, 194, 176, 196, 186, 184, 218, 170, 178, 212, 172, 184, 214, 166, 204, 192, 170, 194, 184, 190, 190, 176, 196, 188, 174, 206, 198, 166, 194, 194, 184, 198, 184, 174, 200, 186, 180, 218, 174, 174, 208, 178, 176, 220, 166, 176, 216, 170, 174, 204, 172, 194, 182, 188, 196, 178, 188, 206, 182, 184, 196, 168, 206, 180, 174, 194, 190, 168, 210, 170, 178, 214, 172, 182, 218, 170, 186, 206, 174, 182, 216, 174, 200, 210, 182, 188, 196, 182, 198, 200, 178, 208, 176, 180, 208, 168, 192, 196, 184, 212, 184, 176, 212, 190, 180, 202, 184, 190, 210, 178, 192, 200, 184, 180, 220, 184, 210, 202, 168, 208, 206, 164, 220, 198, 178, 206, 178, 190, 214, 182, 196, 208, 178, 194, 194, 186, 182, 194, 190, 202, 178, 200, 200, 186, 182, 218, 176, 204, 208, 158, 202, 202, 172, 210, 196, 200, 198, 192, 180, 214, 176, 194, 222, 184, 180, 204, 176, 186, 216, 184, 184, 194, 198, 204, 164, 194, 222, 186, 194, 200, 180, 194, 200, 180, 194, 202, 192, 208, 192, 188, 210, 186, 196, 208, 182, 190, 218, 182, 182, 224, 174, 194, 220, 164, 208, 206, 164, 198, 190, 182, 204, 196, 178, 210, 176, 200, 194, 180, 202, 186, 194, 206, 180, 202, 208, 196, 182, 222, 172, 200, 208, 158, 200, 214, 156, 202, 228, 156, 200, 204, 180, 202, 192, 182, 204, 194, 178, 182, 190, 186, 212, 180, 190, 192, 184, 200, 190, 184, 218, 190, 190, 200, 170, 196, 206, 166, 206, 210, 164, 212, 200, 174, 210, 186, 190, 206}, + {180, 206, 180, 186, 180, 180, 198, 198, 166, 206, 196, 162, 204, 190, 188, 202, 174, 198, 188, 190, 184, 172, 194, 206, 180, 178, 202, 178, 172, 196, 184, 170, 192, 180, 180, 194, 166, 182, 198, 172, 200, 186, 170, 206, 192, 182, 200, 184, 190, 192, 196, 174, 186, 192, 198, 178, 182, 194, 192, 154, 192, 196, 166, 204, 192, 170, 206, 180, 178, 184, 174, 188, 186, 180, 192, 178, 158, 198, 180, 182, 200, 170, 186, 188, 182, 172, 190, 190, 170, 198, 164, 196, 190, 158, 198, 186, 162, 206, 176, 166, 192, 186, 170, 182, 184, 186, 178, 166, 176, 178, 166, 196, 170, 172, 186, 174, 168, 192, 164, 174, 190, 164, 182, 184, 166, 194, 178, 166, 196, 168, 178, 198, 178, 170, 200, 178, 186, 178, 178, 184, 184, 178, 172, 186, 166, 194, 174, 168, 182, 188, 168, 202, 166, 182, 188, 184, 184, 174, 180, 196, 184, 182, 184, 182, 166, 194, 178, 176, 208, 184, 176, 206, 170, 188, 198, 168, 192, 206, 150, 186, 196, 162, 200, 172, 196, 206, 170, 184, 182, 196, 188, 190, 174, 204, 194, 176, 188, 200, 160, 204, 186, 170, 196, 180, 178, 204, 160, 198, 200, 172, 194, 188, 186, 202, 184, 176, 214, 184, 176, 208, 188, 176, 186, 186, 192, 184, 166, 180, 202, 176, 178, 184, 180, 212, 176, 176, 200, 172, 188, 188, 172, 200, 198, 192, 182, 176, 180, 204, 184, 176, 212, 178, 168, 200, 194, 172, 198, 188, 174, 200, 168, 200, 190, 168, 206, 200, 166, 192, 186, 166, 196, 186, 178, 188, 178, 176, 190, 184, 186, 182, 174, 200, 194, 158, 200, 194, 160, 212, 188, 182, 202, 182, 180, 194, 192, 186, 190, 184, 202, 176, 172, 210, 188, 172, 196, 178, 180, 184, 172, 162, 200, 182, 182, 188, 176, 186, 184, 178, 206, 192, 168, 196, 196, 166, 192, 202, 180, 182, 180, 194, 202, 178, 190, 194, 172, 210, 186, 178, 200, 180, 176, 194, 182, 174, 202, 180, 180, 188, 184, 196, 178, 176, 200, 178, 184, 186, 184, 176, 192, 188}, + {180, 184, 174, 174, 194, 162, 184, 186, 164, 174, 196, 174, 190, 174, 166, 190, 178, 176, 204, 168, 192, 200, 158, 182, 184, 166, 194, 180, 178, 186, 186, 176, 192, 174, 178, 188, 180, 166, 194, 170, 172, 200, 168, 184, 186, 162, 188, 174, 166, 204, 174, 176, 192, 156, 182, 206, 166, 184, 192, 176, 190, 180, 176, 192, 188, 174, 184, 180, 188, 184, 168, 188, 192, 154, 188, 190, 158, 188, 180, 164, 178, 180, 160, 188, 178, 170, 184, 172, 178, 204, 168, 160, 210, 172, 184, 194, 156, 196, 178, 176, 184, 168, 176, 194, 162, 172, 182, 166, 182, 190, 160, 178, 182, 164, 178, 180, 172, 174, 182, 174, 188, 166, 170, 196, 156, 182, 180, 166, 182, 178, 150, 192, 170, 170, 184, 168, 170, 198, 168, 176, 186, 166, 178, 188, 174, 170, 204, 164, 184, 178, 170, 180, 184, 170, 178, 164, 176, 192, 146, 184, 184, 152, 190, 180, 162, 202, 188, 164, 180, 180, 166, 190, 186, 166, 190, 176, 178, 202, 178, 180, 194, 170, 182, 186, 162, 198, 178, 178, 208, 160, 186, 194, 160, 174, 190, 164, 184, 190, 168, 188, 186, 168, 196, 180, 168, 188, 182, 166, 188, 164, 182, 198, 168, 190, 198, 156, 184, 186, 170, 192, 180, 180, 198, 170, 180, 204, 174, 180, 202, 156, 184, 196, 156, 180, 184, 172, 186, 182, 178, 196, 166, 176, 190, 152, 186, 184, 170, 182, 192, 166, 200, 196, 164, 196, 184, 168, 190, 172, 174, 208, 172, 170, 206, 162, 178, 192, 170, 190, 192, 178, 190, 160, 180, 190, 166, 178, 192, 160, 196, 180, 162, 182, 190, 170, 172, 200, 166, 196, 180, 162, 200, 170, 186, 206, 168, 188, 192, 162, 190, 190, 170, 190, 186, 164, 192, 176, 182, 188, 180, 178, 202, 172, 170, 196, 174, 176, 200, 166, 182, 184, 170, 186, 186, 176, 198, 162, 178, 194, 160, 184, 188, 170, 194, 172, 176, 180, 186, 184, 188, 186, 172, 196, 182, 170, 192, 176, 178, 210, 164, 166, 206, 156, 188, 194, 162, 200, 180, 176, 180, 160}, + {188, 168, 176, 198, 158, 196, 190, 148, 194, 166, 154, 198, 160, 164, 206, 160, 178, 190, 162, 178, 192, 154, 184, 194, 164, 182, 180, 166, 190, 178, 164, 206, 162, 178, 182, 166, 184, 190, 154, 192, 182, 156, 192, 174, 160, 196, 170, 172, 188, 172, 174, 202, 156, 184, 202, 160, 176, 190, 166, 182, 188, 152, 194, 176, 152, 208, 166, 174, 192, 158, 178, 188, 166, 188, 188, 166, 192, 188, 168, 186, 174, 172, 198, 168, 162, 202, 164, 170, 188, 156, 180, 198, 142, 196, 188, 152, 182, 170, 164, 192, 166, 178, 180, 158, 170, 188, 156, 174, 184, 148, 178, 188, 162, 176, 172, 162, 190, 178, 156, 192, 160, 178, 182, 160, 184, 178, 156, 184, 176, 154, 190, 168, 158, 190, 158, 162, 186, 158, 160, 190, 166, 164, 184, 154, 176, 180, 160, 182, 162, 160, 188, 170, 162, 190, 166, 178, 182, 158, 180, 184, 158, 188, 190, 156, 192, 172, 160, 176, 176, 166, 192, 166, 168, 200, 148, 182, 178, 166, 176, 178, 154, 202, 174, 162, 200, 154, 180, 188, 158, 186, 182, 158, 182, 196, 170, 184, 186, 156, 192, 180, 160, 192, 166, 166, 196, 164, 176, 188, 168, 186, 170, 166, 180, 186, 154, 186, 190, 162, 202, 176, 154, 192, 168, 184, 198, 166, 176, 186, 156, 190, 188, 154, 198, 182, 164, 196, 162, 174, 188, 160, 178, 196, 168, 186, 184, 166, 186, 186, 166, 184, 166, 156, 194, 170, 156, 204, 172, 174, 200, 144, 188, 190, 162, 192, 178, 166, 194, 172, 170, 184, 182, 174, 184, 170, 182, 194, 172, 180, 192, 162, 188, 182, 150, 200, 180, 138, 208, 168, 170, 208, 156, 174, 192, 162, 174, 196, 164, 182, 174, 162, 188, 190, 154, 196, 172, 176, 186, 168, 162, 192, 160, 184, 192, 162, 188, 184, 146, 192, 188, 158, 200, 186, 168, 196, 172, 178, 196, 164, 178, 194, 166, 180, 190, 156, 184, 186, 148, 200, 162, 152, 206, 158, 166, 198, 158, 186, 192, 166, 180, 188, 168, 182, 190, 160, 192, 160, 170, 196, 166, 176}, + {162, 188, 178, 176, 174, 186, 160, 184, 176, 176, 182, 174, 182, 174, 170, 186, 172, 176, 176, 170, 168, 180, 176, 166, 182, 176, 164, 184, 174, 166, 182, 162, 182, 172, 164, 182, 170, 162, 186, 172, 176, 180, 180, 166, 184, 174, 170, 180, 178, 176, 184, 164, 180, 188, 154, 188, 180, 164, 186, 174, 166, 178, 168, 176, 180, 162, 176, 172, 174, 184, 174, 180, 168, 184, 158, 176, 178, 156, 186, 174, 164, 176, 172, 186, 176, 164, 180, 188, 158, 184, 176, 160, 194, 174, 166, 172, 176, 170, 174, 160, 176, 168, 166, 172, 180, 164, 174, 178, 156, 174, 174, 152, 184, 162, 162, 176, 160, 162, 176, 162, 178, 166, 160, 164, 180, 162, 170, 168, 174, 178, 166, 162, 180, 164, 174, 176, 156, 180, 178, 150, 170, 178, 152, 184, 178, 150, 190, 164, 164, 174, 168, 170, 166, 152, 172, 176, 164, 170, 170, 168, 176, 172, 154, 178, 174, 156, 194, 164, 172, 170, 174, 180, 180, 164, 178, 174, 168, 174, 178, 164, 186, 170, 176, 190, 178, 174, 172, 160, 180, 178, 160, 180, 180, 154, 180, 190, 158, 186, 170, 174, 188, 166, 182, 180, 166, 180, 178, 162, 186, 184, 164, 182, 174, 164, 188, 174, 168, 184, 174, 168, 192, 166, 180, 158, 168, 186, 164, 166, 182, 182, 158, 188, 160, 178, 182, 168, 174, 182, 178, 180, 188, 164, 162, 188, 152, 186, 178, 174, 196, 172, 182, 172, 174, 194, 174, 172, 182, 166, 164, 186, 166, 176, 170, 178, 160, 174, 178, 164, 178, 176, 174, 176, 178, 174, 172, 168, 184, 172, 170, 178, 162, 172, 182, 178, 174, 190, 174, 180, 174, 160, 192, 178, 168, 168, 180, 158, 186, 180, 158, 184, 184, 160, 186, 170, 178, 172, 170, 178, 180, 172, 176, 158, 166, 188, 162, 172, 184, 174, 172, 180, 174, 164, 188, 166, 168, 180, 178, 176, 182, 154, 186, 180, 158, 184, 172, 176, 190, 160, 188, 170, 176, 184, 178, 166, 182, 174, 160, 180, 174, 166, 180, 180, 164, 176, 174, 176, 190, 160, 176, 184}, + {188, 176, 170, 176, 178, 162, 180, 166, 172, 188, 154, 170, 186, 164, 172, 178, 164, 176, 174, 182, 178, 160, 170, 190, 160, 168, 184, 166, 170, 182, 166, 184, 170, 172, 174, 174, 162, 182, 176, 170, 178, 168, 174, 188, 162, 168, 188, 154, 186, 178, 158, 178, 152, 180, 178, 164, 162, 172, 164, 166, 182, 164, 170, 182, 160, 178, 188, 160, 174, 178, 160, 172, 180, 168, 190, 154, 186, 180, 166, 176, 178, 174, 176, 164, 160, 186, 154, 170, 176, 166, 160, 166, 160, 160, 166, 164, 176, 174, 152, 170, 180, 160, 168, 172, 168, 180, 160, 168, 184, 150, 178, 176, 152, 180, 172, 154, 176, 174, 156, 172, 166, 164, 174, 168, 154, 176, 168, 154, 176, 158, 164, 172, 156, 176, 166, 168, 166, 168, 156, 190, 148, 170, 184, 156, 164, 176, 146, 170, 178, 150, 174, 190, 146, 188, 180, 152, 170, 176, 160, 178, 174, 154, 190, 150, 182, 176, 148, 178, 162, 176, 168, 172, 170, 172, 164, 172, 182, 154, 168, 180, 162, 170, 178, 162, 174, 182, 152, 190, 178, 172, 178, 170, 176, 184, 168, 174, 184, 166, 180, 172, 160, 182, 172, 166, 184, 172, 162, 188, 164, 176, 176, 170, 172, 192, 150, 172, 184, 152, 178, 178, 154, 178, 170, 172, 174, 180, 180, 172, 166, 176, 186, 164, 174, 176, 154, 182, 182, 158, 182, 168, 158, 196, 168, 168, 192, 160, 162, 176, 162, 164, 176, 174, 170, 160, 174, 174, 170, 166, 174, 166, 184, 178, 170, 178, 186, 156, 186, 182, 154, 176, 178, 162, 188, 186, 164, 190, 166, 178, 174, 168, 178, 176, 162, 172, 174, 170, 164, 172, 162, 182, 162, 166, 174, 166, 164, 194, 162, 176, 186, 152, 180, 186, 168, 168, 182, 164, 174, 188, 158, 176, 174, 180, 184, 164, 184, 172, 166, 178, 182, 150, 178, 178, 164, 178, 164, 178, 174, 164, 160, 194, 164, 178, 186, 172, 160, 178, 170, 166, 176, 178, 170, 180, 168, 178, 168, 178, 178, 168, 176, 180, 158, 182, 174, 170, 170, 188, 154, 186, 168, 162}, + {180, 148, 180, 170, 164, 184, 162, 180, 186, 144, 180, 178, 154, 182, 170, 150, 196, 170, 154, 176, 162, 162, 180, 148, 182, 186, 152, 168, 178, 154, 176, 182, 142, 194, 168, 158, 188, 174, 170, 176, 160, 168, 182, 156, 182, 184, 150, 176, 170, 150, 182, 184, 162, 166, 186, 150, 196, 164, 178, 178, 166, 174, 174, 154, 186, 180, 132, 196, 162, 154, 188, 172, 154, 190, 156, 164, 182, 158, 168, 196, 148, 176, 182, 156, 182, 192, 142, 172, 196, 142, 186, 166, 174, 184, 152, 180, 176, 148, 184, 174, 146, 180, 170, 148, 190, 162, 158, 172, 162, 148, 182, 150, 168, 184, 152, 178, 172, 146, 172, 172, 148, 182, 166, 158, 178, 158, 178, 178, 134, 172, 180, 158, 166, 188, 140, 180, 174, 136, 182, 174, 140, 182, 162, 146, 182, 156, 174, 174, 148, 180, 164, 144, 186, 158, 156, 168, 172, 154, 182, 156, 166, 184, 150, 170, 180, 160, 174, 178, 152, 188, 182, 136, 168, 174, 154, 166, 180, 160, 170, 160, 176, 180, 158, 172, 188, 148, 188, 172, 144, 186, 176, 148, 176, 180, 150, 184, 166, 166, 184, 144, 190, 184, 152, 190, 172, 160, 176, 178, 160, 180, 170, 158, 182, 162, 190, 176, 146, 176, 186, 156, 170, 190, 148, 178, 178, 140, 198, 162, 160, 174, 168, 168, 186, 148, 190, 172, 150, 196, 178, 158, 184, 168, 164, 180, 168, 164, 180, 164, 186, 188, 150, 198, 164, 164, 168, 182, 154, 188, 174, 156, 174, 162, 166, 172, 158, 176, 166, 150, 190, 174, 148, 186, 180, 144, 180, 162, 166, 178, 166, 164, 178, 168, 172, 190, 162, 180, 180, 156, 192, 176, 160, 188, 170, 156, 182, 164, 170, 182, 158, 172, 168, 160, 186, 180, 146, 182, 174, 142, 192, 178, 156, 182, 164, 162, 184, 166, 176, 178, 150, 180, 176, 156, 180, 176, 168, 170, 190, 160, 184, 180, 164, 172, 168, 166, 182, 158, 182, 180, 142, 190, 170, 136, 186, 174, 148, 190, 158, 158, 184, 166, 164, 180, 166, 178, 174, 156, 168, 186, 148, 180}, + {150, 186, 180, 152, 168, 170, 168, 164, 160, 172, 178, 156, 178, 180, 152, 178, 180, 146, 196, 172, 156, 186, 168, 156, 184, 154, 172, 182, 170, 182, 170, 162, 174, 178, 154, 170, 174, 154, 174, 166, 164, 180, 164, 168, 170, 158, 174, 188, 152, 186, 174, 156, 186, 168, 150, 190, 156, 166, 192, 158, 168, 184, 162, 174, 178, 154, 186, 178, 154, 182, 180, 148, 184, 166, 150, 188, 166, 170, 174, 162, 172, 170, 166, 168, 164, 158, 178, 178, 154, 186, 162, 164, 172, 166, 174, 166, 160, 166, 182, 158, 166, 176, 142, 182, 172, 140, 200, 158, 152, 182, 162, 148, 180, 156, 160, 174, 156, 176, 168, 146, 170, 176, 146, 172, 168, 144, 170, 164, 154, 180, 154, 162, 164, 144, 172, 168, 148, 180, 164, 144, 194, 158, 148, 178, 166, 150, 170, 158, 166, 164, 156, 174, 174, 152, 170, 164, 144, 184, 172, 138, 188, 154, 148, 184, 154, 164, 168, 150, 164, 170, 150, 178, 166, 162, 180, 166, 156, 176, 160, 170, 168, 168, 170, 174, 156, 180, 170, 154, 194, 164, 150, 206, 162, 152, 202, 162, 150, 180, 168, 166, 176, 162, 146, 186, 146, 172, 176, 144, 188, 176, 146, 184, 160, 166, 178, 152, 166, 186, 158, 170, 180, 152, 182, 172, 156, 184, 170, 158, 190, 172, 162, 184, 164, 160, 180, 154, 180, 170, 146, 188, 176, 152, 194, 160, 156, 196, 168, 150, 184, 154, 154, 170, 168, 172, 176, 158, 168, 184, 146, 188, 174, 158, 186, 170, 168, 186, 164, 158, 186, 158, 172, 174, 158, 194, 164, 152, 190, 166, 156, 194, 170, 160, 180, 156, 170, 170, 164, 174, 170, 160, 176, 178, 142, 184, 184, 134, 194, 168, 150, 174, 172, 168, 164, 166, 168, 174, 164, 174, 170, 154, 178, 170, 164, 178, 170, 168, 174, 170, 160, 180, 158, 184, 174, 158, 174, 178, 142, 188, 158, 156, 188, 158, 158, 180, 160, 174, 168, 166, 164, 188, 170, 174, 178, 158, 170, 172, 154, 184, 174, 160, 182, 176, 162, 166, 166, 168, 184, 160, 182, 176}, + {166, 170, 154, 182, 180, 156, 188, 166, 164, 182, 154, 162, 186, 146, 172, 188, 152, 172, 182, 150, 172, 182, 158, 176, 174, 164, 176, 156, 160, 172, 142, 184, 170, 148, 178, 172, 156, 180, 168, 150, 190, 172, 164, 188, 166, 164, 182, 160, 156, 182, 156, 166, 176, 158, 174, 164, 170, 174, 162, 160, 186, 150, 170, 176, 150, 172, 176, 156, 172, 180, 146, 188, 170, 150, 188, 170, 156, 180, 162, 160, 178, 162, 178, 172, 156, 180, 170, 152, 178, 168, 162, 182, 160, 164, 192, 150, 164, 170, 148, 160, 180, 146, 180, 172, 150, 162, 170, 150, 168, 172, 154, 178, 162, 156, 174, 146, 162, 168, 144, 178, 178, 138, 182, 148, 152, 178, 150, 150, 180, 160, 150, 172, 164, 164, 178, 152, 158, 176, 146, 172, 166, 152, 174, 168, 148, 176, 156, 152, 184, 156, 160, 168, 146, 162, 170, 142, 174, 160, 152, 178, 172, 138, 178, 162, 156, 170, 168, 160, 188, 150, 170, 176, 150, 172, 160, 160, 172, 170, 158, 182, 152, 164, 172, 168, 158, 178, 144, 176, 182, 150, 182, 172, 158, 174, 178, 148, 182, 168, 162, 184, 152, 170, 188, 154, 176, 178, 168, 176, 178, 166, 172, 174, 158, 186, 162, 164, 190, 156, 162, 182, 148, 164, 184, 152, 162, 190, 146, 170, 168, 156, 170, 168, 148, 180, 160, 170, 188, 166, 170, 176, 148, 178, 166, 162, 172, 164, 158, 180, 166, 156, 192, 158, 168, 186, 152, 182, 170, 158, 166, 180, 150, 184, 164, 168, 172, 160, 174, 180, 170, 156, 174, 160, 166, 168, 164, 168, 184, 146, 192, 162, 150, 182, 170, 148, 188, 146, 162, 192, 154, 180, 172, 160, 174, 172, 158, 176, 168, 166, 180, 174, 156, 186, 148, 174, 180, 158, 170, 172, 156, 180, 172, 148, 182, 174, 160, 172, 164, 160, 184, 172, 144, 178, 154, 166, 178, 156, 172, 164, 166, 164, 186, 156, 180, 164, 166, 174, 156, 172, 186, 142, 172, 180, 140, 190, 174, 156, 176, 174, 156, 176, 164, 152, 178, 162, 164, 174, 156, 164, 170, 164}, + {178, 136, 184, 172, 138, 170, 178, 144, 178, 162, 164, 168, 172, 152, 174, 152, 172, 166, 160, 174, 176, 152, 168, 176, 140, 172, 168, 164, 168, 178, 166, 174, 164, 164, 182, 162, 164, 190, 146, 168, 176, 152, 172, 164, 162, 170, 168, 162, 166, 162, 170, 172, 148, 180, 162, 148, 174, 168, 158, 168, 174, 152, 170, 158, 168, 180, 170, 162, 182, 158, 166, 176, 158, 174, 164, 158, 168, 172, 160, 182, 162, 162, 158, 168, 162, 174, 170, 166, 166, 154, 172, 176, 150, 164, 164, 150, 180, 166, 158, 170, 162, 164, 168, 156, 172, 168, 154, 180, 158, 168, 158, 178, 146, 172, 164, 160, 172, 152, 164, 174, 154, 158, 172, 150, 168, 168, 158, 164, 176, 146, 172, 148, 174, 158, 168, 162, 156, 164, 170, 162, 154, 172, 166, 144, 168, 172, 152, 172, 166, 146, 166, 160, 154, 178, 164, 166, 174, 146, 168, 174, 142, 166, 178, 156, 172, 166, 158, 160, 160, 164, 162, 160, 166, 180, 150, 174, 164, 144, 168, 170, 164, 166, 176, 158, 176, 164, 168, 164, 166, 176, 168, 158, 184, 172, 154, 170, 172, 166, 164, 182, 150, 168, 176, 158, 170, 164, 154, 176, 138, 170, 182, 142, 166, 186, 148, 174, 168, 160, 170, 162, 180, 162, 154, 180, 168, 158, 170, 174, 172, 158, 184, 160, 172, 182, 156, 180, 164, 154, 176, 156, 168, 182, 158, 176, 184, 142, 176, 170, 154, 172, 170, 156, 174, 164, 166, 168, 160, 170, 168, 166, 154, 188, 150, 174, 174, 154, 170, 176, 158, 176, 170, 164, 176, 142, 182, 176, 144, 170, 174, 156, 176, 166, 160, 172, 178, 150, 180, 166, 156, 164, 172, 162, 172, 156, 162, 190, 140, 176, 170, 156, 168, 174, 156, 170, 166, 162, 176, 164, 160, 182, 150, 178, 182, 152, 174, 172, 154, 168, 184, 152, 178, 170, 170, 170, 164, 170, 172, 150, 180, 166, 154, 184, 166, 150, 168, 168, 160, 170, 164, 166, 182, 168, 160, 184, 154, 170, 168, 162, 164, 184, 146, 178, 172, 160, 170, 178, 168, 172, 166, 170}, + {166, 164, 164, 160, 164, 172, 156, 178, 166, 150, 190, 166, 152, 182, 168, 154, 178, 174, 158, 170, 154, 180, 160, 170, 174, 174, 158, 168, 166, 164, 168, 162, 166, 162, 160, 162, 164, 156, 172, 160, 156, 178, 162, 160, 180, 162, 154, 188, 162, 160, 178, 152, 164, 174, 166, 172, 178, 162, 172, 172, 164, 166, 174, 154, 174, 170, 150, 182, 166, 156, 172, 150, 180, 166, 152, 184, 166, 154, 180, 166, 144, 180, 154, 168, 178, 152, 170, 168, 156, 180, 168, 162, 178, 172, 164, 180, 160, 150, 186, 164, 152, 174, 164, 156, 166, 152, 164, 172, 140, 170, 154, 150, 172, 170, 146, 172, 154, 148, 178, 156, 158, 164, 156, 158, 158, 152, 166, 158, 142, 176, 154, 148, 178, 160, 150, 172, 164, 154, 174, 156, 168, 166, 142, 170, 164, 150, 166, 162, 152, 176, 148, 156, 166, 162, 150, 156, 158, 158, 168, 140, 172, 168, 132, 180, 160, 148, 170, 168, 144, 182, 144, 166, 160, 160, 168, 152, 160, 170, 156, 174, 166, 164, 150, 176, 168, 146, 186, 164, 158, 174, 156, 176, 174, 144, 172, 174, 138, 182, 156, 154, 184, 166, 152, 174, 154, 158, 178, 168, 168, 168, 160, 162, 174, 158, 180, 168, 154, 188, 160, 156, 184, 166, 162, 184, 152, 176, 174, 148, 178, 160, 150, 182, 154, 152, 168, 172, 150, 182, 158, 168, 164, 160, 162, 168, 158, 156, 188, 154, 170, 174, 138, 180, 168, 158, 176, 156, 168, 180, 162, 166, 170, 162, 172, 162, 154, 178, 172, 158, 186, 160, 152, 168, 174, 162, 176, 156, 156, 188, 152, 170, 174, 150, 182, 164, 140, 194, 158, 160, 186, 162, 172, 168, 166, 168, 166, 164, 172, 172, 156, 154, 174, 170, 172, 170, 160, 176, 158, 154, 184, 158, 166, 172, 160, 174, 164, 158, 186, 152, 148, 188, 162, 152, 184, 156, 156, 168, 164, 168, 156, 166, 182, 158, 164, 160, 184, 152, 172, 172, 158, 184, 152, 160, 170, 164, 172, 172, 156, 178, 162, 152, 188, 162, 150, 178, 158, 158, 176, 156, 164, 160}, + {154, 178, 178, 138, 180, 168, 148, 172, 174, 164, 172, 162, 164, 176, 148, 168, 172, 154, 164, 176, 162, 170, 160, 156, 182, 162, 158, 176, 150, 170, 166, 160, 172, 174, 140, 186, 178, 146, 182, 176, 152, 186, 164, 166, 172, 152, 166, 178, 146, 178, 174, 150, 176, 170, 146, 178, 150, 152, 172, 162, 156, 178, 152, 162, 174, 156, 172, 182, 148, 178, 174, 150, 190, 172, 152, 174, 158, 164, 178, 142, 160, 190, 148, 182, 172, 140, 178, 174, 138, 190, 164, 144, 174, 160, 154, 168, 160, 152, 168, 148, 176, 170, 144, 170, 172, 144, 170, 158, 148, 172, 162, 150, 174, 148, 160, 178, 140, 178, 164, 138, 178, 164, 140, 176, 164, 152, 172, 150, 156, 160, 164, 158, 156, 158, 162, 168, 148, 160, 168, 144, 178, 162, 142, 182, 158, 146, 164, 150, 156, 168, 150, 158, 164, 148, 168, 164, 150, 172, 162, 152, 176, 166, 148, 166, 156, 158, 168, 158, 156, 170, 148, 170, 170, 148, 174, 182, 138, 180, 156, 144, 176, 150, 166, 168, 156, 162, 166, 158, 172, 168, 154, 180, 162, 162, 180, 164, 160, 188, 162, 162, 172, 146, 176, 186, 144, 188, 156, 156, 174, 162, 156, 170, 162, 154, 184, 154, 156, 182, 152, 164, 178, 162, 150, 176, 152, 166, 188, 140, 180, 170, 148, 180, 160, 172, 170, 154, 168, 178, 152, 180, 170, 150, 176, 168, 168, 170, 162, 162, 176, 152, 166, 174, 152, 164, 172, 154, 170, 176, 138, 174, 170, 144, 182, 166, 156, 178, 150, 170, 168, 152, 164, 174, 152, 168, 168, 150, 170, 170, 144, 182, 166, 156, 174, 152, 172, 176, 160, 162, 170, 160, 170, 162, 152, 186, 162, 160, 178, 156, 168, 184, 152, 160, 176, 150, 170, 172, 144, 160, 184, 142, 172, 172, 142, 184, 162, 162, 186, 162, 162, 184, 152, 172, 172, 150, 176, 170, 152, 186, 162, 148, 172, 166, 162, 172, 158, 158, 178, 152, 168, 176, 142, 172, 180, 132, 180, 172, 142, 188, 162, 158, 172, 162, 152, 178, 142, 184, 174, 144, 176, 170}, + {158, 174, 152, 170, 156, 156, 174, 160, 156, 158, 156, 158, 170, 160, 152, 176, 156, 172, 178, 150, 172, 184, 150, 172, 166, 150, 180, 156, 162, 178, 160, 160, 168, 152, 176, 166, 148, 168, 168, 152, 164, 160, 158, 168, 160, 144, 176, 160, 152, 182, 144, 170, 184, 158, 162, 170, 156, 176, 156, 162, 170, 164, 168, 180, 156, 166, 172, 150, 164, 170, 150, 168, 158, 154, 170, 162, 154, 172, 170, 156, 172, 154, 156, 174, 160, 168, 174, 150, 160, 170, 160, 160, 170, 164, 178, 154, 158, 180, 164, 160, 176, 154, 154, 174, 150, 162, 166, 166, 164, 160, 150, 170, 156, 154, 168, 152, 158, 166, 150, 166, 158, 148, 160, 156, 154, 162, 158, 154, 172, 154, 150, 162, 160, 146, 176, 154, 144, 168, 164, 156, 164, 148, 162, 166, 148, 180, 158, 156, 168, 160, 156, 180, 140, 168, 166, 150, 164, 160, 152, 176, 148, 146, 166, 158, 158, 164, 164, 146, 180, 154, 144, 164, 156, 164, 148, 158, 176, 156, 154, 180, 156, 166, 184, 150, 166, 188, 154, 162, 186, 148, 176, 166, 166, 156, 164, 166, 168, 160, 152, 174, 156, 162, 170, 158, 156, 170, 154, 166, 166, 154, 178, 156, 156, 186, 160, 164, 178, 152, 154, 178, 162, 158, 184, 162, 168, 166, 162, 160, 158, 160, 166, 174, 158, 186, 142, 168, 174, 160, 160, 170, 146, 174, 164, 154, 174, 156, 162, 186, 150, 160, 174, 164, 162, 176, 162, 156, 178, 150, 164, 178, 160, 164, 172, 150, 190, 154, 164, 180, 158, 158, 186, 148, 158, 176, 158, 182, 168, 152, 174, 162, 160, 162, 164, 166, 172, 156, 150, 180, 154, 156, 180, 158, 166, 178, 146, 164, 176, 160, 172, 154, 154, 192, 142, 162, 182, 158, 166, 182, 156, 172, 162, 156, 184, 164, 152, 166, 160, 152, 168, 168, 146, 184, 156, 162, 176, 154, 158, 168, 152, 170, 160, 156, 178, 144, 168, 180, 162, 164, 170, 168, 164, 170, 158, 176, 168, 156, 174, 172, 148, 168, 172, 150, 188, 160, 158, 176, 156, 168, 178, 156}, + {188, 162, 148, 184, 162, 162, 176, 154, 172, 170, 162, 174, 178, 158, 176, 178, 142, 176, 176, 146, 172, 162, 148, 176, 152, 166, 174, 150, 168, 178, 134, 172, 186, 122, 184, 162, 154, 172, 160, 158, 180, 164, 160, 182, 156, 170, 184, 154, 172, 170, 148, 172, 170, 140, 178, 172, 146, 174, 160, 162, 170, 142, 174, 170, 148, 172, 174, 138, 178, 172, 148, 188, 154, 160, 176, 160, 154, 182, 148, 166, 190, 138, 174, 178, 136, 180, 168, 148, 172, 176, 152, 182, 164, 152, 186, 152, 170, 174, 144, 174, 170, 148, 174, 170, 138, 178, 158, 156, 164, 158, 154, 166, 138, 164, 164, 132, 180, 166, 132, 172, 170, 134, 182, 164, 144, 166, 156, 152, 170, 156, 162, 164, 146, 174, 166, 142, 172, 170, 130, 182, 166, 142, 174, 152, 150, 172, 136, 160, 174, 128, 174, 162, 142, 166, 162, 132, 170, 158, 148, 162, 158, 154, 172, 136, 164, 168, 132, 164, 178, 132, 174, 182, 132, 182, 166, 144, 180, 158, 154, 176, 156, 146, 176, 146, 168, 162, 150, 174, 170, 144, 170, 168, 144, 176, 158, 162, 170, 146, 172, 176, 140, 174, 176, 142, 180, 168, 152, 172, 174, 146, 180, 166, 154, 180, 150, 160, 180, 154, 180, 162, 140, 182, 168, 144, 170, 176, 148, 194, 156, 150, 168, 158, 166, 166, 148, 166, 174, 136, 178, 180, 144, 172, 170, 154, 176, 162, 150, 176, 164, 168, 176, 130, 176, 172, 138, 176, 176, 144, 172, 168, 152, 174, 166, 150, 178, 152, 162, 172, 146, 160, 178, 144, 180, 166, 142, 174, 170, 156, 176, 160, 162, 162, 160, 172, 168, 152, 170, 182, 140, 176, 176, 140, 176, 168, 148, 188, 162, 134, 186, 156, 162, 180, 144, 168, 182, 138, 176, 168, 148, 170, 168, 140, 170, 164, 162, 182, 156, 158, 174, 156, 170, 170, 150, 170, 172, 144, 182, 168, 142, 180, 180, 152, 166, 158, 168, 174, 154, 166, 176, 138, 174, 186, 138, 176, 166, 150, 180, 162, 148, 178, 158, 162, 174, 136, 174, 174, 136, 174, 168, 136}, + {174, 160, 168, 168, 158, 156, 168, 160, 164, 160, 156, 176, 136, 162, 174, 150, 166, 174, 148, 168, 172, 150, 174, 176, 152, 172, 160, 160, 166, 160, 170, 176, 140, 164, 180, 160, 158, 178, 156, 154, 172, 162, 164, 164, 152, 174, 150, 152, 176, 152, 156, 178, 156, 174, 164, 158, 164, 166, 166, 156, 154, 166, 180, 146, 168, 174, 146, 164, 172, 158, 160, 176, 152, 162, 178, 156, 166, 160, 158, 170, 148, 166, 176, 156, 164, 172, 148, 160, 178, 156, 162, 176, 154, 170, 152, 152, 172, 154, 160, 170, 142, 158, 170, 138, 172, 168, 146, 156, 160, 164, 164, 164, 156, 164, 148, 166, 172, 146, 162, 166, 140, 148, 172, 152, 156, 166, 152, 160, 160, 160, 162, 160, 144, 160, 150, 162, 174, 142, 154, 172, 138, 164, 160, 152, 156, 158, 162, 166, 136, 166, 174, 140, 158, 168, 146, 162, 172, 156, 158, 174, 152, 160, 174, 154, 166, 152, 158, 176, 140, 166, 172, 136, 158, 170, 146, 158, 156, 162, 164, 156, 156, 176, 158, 160, 172, 162, 158, 170, 158, 158, 180, 158, 166, 174, 156, 172, 170, 160, 178, 158, 160, 180, 142, 168, 178, 144, 168, 168, 158, 156, 166, 166, 158, 162, 168, 170, 154, 168, 166, 160, 156, 168, 152, 158, 178, 144, 162, 170, 158, 168, 166, 152, 168, 162, 176, 162, 150, 176, 170, 146, 174, 168, 154, 154, 180, 150, 174, 162, 156, 166, 164, 166, 180, 154, 164, 182, 150, 172, 168, 142, 174, 170, 150, 168, 166, 168, 168, 160, 170, 172, 150, 168, 160, 166, 156, 174, 156, 158, 174, 158, 160, 182, 148, 170, 158, 166, 170, 154, 166, 184, 144, 170, 170, 144, 166, 164, 150, 174, 166, 154, 170, 158, 166, 176, 144, 160, 178, 142, 158, 176, 162, 156, 178, 150, 172, 172, 154, 170, 160, 156, 176, 156, 168, 164, 160, 170, 164, 152, 168, 166, 146, 162, 174, 148, 172, 160, 164, 174, 150, 160, 182, 146, 162, 184, 152, 156, 170, 152, 174, 164, 156, 166, 160, 164, 170, 162, 172, 172, 158, 160}, + {168, 136, 170, 158, 148, 190, 170, 138, 172, 164, 160, 164, 154, 170, 176, 138, 178, 178, 146, 174, 174, 142, 174, 158, 150, 168, 158, 162, 176, 150, 164, 166, 152, 172, 164, 142, 184, 168, 138, 174, 166, 144, 174, 164, 158, 176, 146, 164, 176, 142, 182, 168, 136, 174, 170, 140, 190, 158, 142, 180, 166, 160, 166, 156, 166, 178, 142, 186, 170, 140, 180, 170, 138, 168, 164, 148, 182, 156, 154, 184, 146, 168, 174, 138, 174, 172, 142, 172, 178, 130, 180, 154, 144, 176, 170, 152, 172, 162, 168, 176, 142, 182, 170, 140, 182, 166, 130, 180, 168, 142, 166, 156, 142, 168, 160, 152, 168, 140, 174, 158, 140, 176, 152, 142, 170, 170, 128, 170, 158, 140, 182, 146, 156, 170, 140, 170, 166, 142, 184, 158, 128, 188, 166, 142, 184, 146, 146, 168, 156, 158, 170, 138, 176, 164, 134, 172, 162, 136, 162, 160, 138, 170, 156, 144, 174, 150, 160, 160, 136, 168, 160, 134, 176, 166, 136, 172, 172, 132, 180, 156, 156, 162, 156, 162, 166, 154, 178, 168, 140, 190, 170, 132, 178, 168, 126, 176, 160, 148, 178, 154, 158, 178, 146, 170, 170, 148, 176, 176, 136, 172, 162, 150, 178, 162, 154, 170, 156, 170, 172, 142, 170, 174, 150, 174, 176, 142, 180, 176, 132, 186, 164, 152, 172, 152, 162, 172, 152, 172, 168, 144, 186, 164, 142, 176, 162, 148, 160, 172, 140, 180, 160, 150, 178, 144, 166, 176, 124, 176, 176, 142, 182, 166, 146, 178, 162, 146, 176, 152, 170, 164, 148, 178, 160, 144, 172, 158, 150, 176, 176, 130, 182, 166, 140, 174, 160, 148, 172, 150, 178, 172, 138, 184, 178, 138, 186, 172, 144, 180, 164, 154, 176, 156, 166, 166, 150, 182, 166, 156, 178, 170, 130, 190, 172, 142, 176, 168, 140, 176, 156, 156, 172, 146, 166, 174, 134, 180, 172, 144, 192, 166, 148, 178, 162, 154, 164, 164, 152, 174, 162, 168, 170, 140, 180, 174, 128, 188, 168, 142, 178, 164, 146, 176, 162, 154, 182, 138, 168, 170, 140, 174}, + {156, 172, 162, 154, 178, 162, 140, 186, 168, 146, 172, 170, 154, 166, 158, 166, 168, 152, 162, 174, 148, 168, 170, 142, 180, 158, 156, 178, 152, 152, 168, 164, 164, 170, 162, 164, 152, 150, 176, 166, 144, 180, 164, 144, 178, 164, 156, 172, 154, 164, 164, 154, 166, 176, 150, 178, 156, 154, 172, 170, 146, 174, 168, 148, 162, 160, 158, 160, 160, 160, 162, 144, 182, 166, 138, 172, 164, 134, 176, 162, 152, 178, 160, 174, 156, 150, 174, 158, 152, 184, 162, 152, 190, 168, 144, 178, 164, 138, 172, 152, 156, 164, 154, 168, 162, 146, 170, 164, 140, 168, 172, 138, 172, 146, 146, 166, 162, 148, 150, 162, 158, 160, 142, 172, 158, 142, 174, 166, 140, 176, 150, 144, 176, 150, 160, 166, 142, 176, 144, 160, 166, 154, 136, 170, 156, 148, 158, 160, 142, 158, 156, 154, 154, 152, 160, 162, 150, 156, 176, 144, 166, 168, 136, 170, 158, 150, 168, 154, 150, 162, 150, 174, 154, 142, 174, 158, 144, 176, 158, 148, 170, 170, 144, 172, 160, 162, 168, 154, 154, 162, 160, 166, 178, 154, 184, 160, 146, 174, 160, 148, 168, 160, 160, 162, 172, 154, 160, 148, 180, 164, 152, 176, 164, 146, 176, 168, 148, 176, 162, 164, 170, 148, 168, 162, 148, 172, 154, 144, 182, 162, 146, 178, 162, 156, 170, 156, 148, 170, 168, 154, 168, 152, 168, 176, 142, 176, 174, 144, 176, 168, 150, 184, 152, 166, 164, 168, 172, 156, 156, 178, 156, 144, 182, 172, 136, 188, 166, 146, 162, 164, 150, 164, 156, 168, 166, 154, 166, 162, 148, 174, 180, 142, 178, 154, 152, 174, 168, 158, 164, 168, 162, 166, 156, 168, 160, 142, 174, 164, 142, 170, 158, 150, 172, 166, 150, 164, 166, 158, 162, 148, 178, 158, 146, 158, 176, 138, 182, 172, 142, 178, 164, 148, 168, 168, 154, 180, 146, 166, 164, 150, 166, 166, 152, 182, 164, 146, 172, 174, 154, 172, 158, 162, 162, 152, 176, 152, 148, 168, 166, 140, 182, 166, 148, 180, 164, 158, 162, 162, 158, 170}, + {138, 156, 184, 144, 174, 166, 152, 160, 160, 156, 168, 154, 166, 184, 148, 154, 182, 132, 164, 188, 138, 162, 172, 146, 164, 166, 148, 164, 154, 154, 180, 150, 158, 176, 144, 166, 176, 160, 160, 172, 158, 168, 176, 142, 176, 162, 144, 182, 148, 160, 172, 142, 164, 172, 136, 170, 170, 154, 164, 164, 148, 178, 150, 162, 180, 146, 162, 180, 144, 162, 184, 146, 164, 174, 152, 170, 168, 154, 172, 162, 156, 174, 152, 154, 182, 146, 164, 182, 144, 156, 182, 150, 156, 168, 146, 176, 160, 158, 174, 148, 154, 178, 148, 154, 174, 146, 152, 184, 140, 160, 158, 158, 160, 170, 148, 174, 138, 156, 180, 130, 158, 174, 138, 154, 172, 150, 150, 160, 144, 168, 166, 142, 168, 154, 148, 172, 144, 156, 168, 140, 158, 182, 132, 162, 166, 146, 160, 156, 146, 174, 140, 162, 174, 144, 152, 164, 152, 154, 170, 144, 164, 162, 146, 174, 162, 142, 174, 158, 148, 178, 128, 160, 166, 138, 156, 172, 146, 148, 164, 156, 166, 154, 152, 188, 144, 156, 182, 144, 160, 182, 142, 160, 178, 130, 166, 174, 142, 178, 160, 158, 172, 160, 156, 182, 138, 172, 188, 148, 160, 174, 148, 156, 170, 154, 180, 164, 146, 178, 142, 154, 178, 146, 156, 176, 140, 170, 164, 148, 164, 176, 148, 166, 170, 156, 168, 156, 150, 188, 140, 164, 182, 140, 172, 174, 154, 158, 170, 146, 168, 158, 148, 176, 146, 158, 182, 144, 150, 192, 140, 160, 172, 158, 148, 184, 146, 166, 158, 160, 174, 154, 160, 188, 140, 154, 180, 148, 166, 174, 154, 160, 166, 144, 170, 166, 158, 182, 142, 162, 186, 142, 158, 188, 134, 166, 170, 144, 162, 180, 144, 156, 170, 152, 174, 154, 166, 188, 138, 164, 174, 150, 160, 174, 152, 184, 176, 148, 166, 168, 146, 174, 156, 156, 180, 142, 154, 186, 140, 170, 174, 148, 166, 180, 152, 158, 156, 162, 170, 152, 158, 176, 142, 166, 174, 144, 152, 192, 148, 156, 172, 146, 156, 176, 138, 172, 160, 156, 182, 144, 168, 172}, + {142, 188, 146, 150, 172, 146, 162, 170, 162, 170, 164, 150, 176, 138, 154, 184, 158, 160, 176, 158, 156, 176, 152, 162, 168, 152, 164, 166, 156, 174, 162, 138, 186, 154, 154, 186, 148, 156, 168, 152, 154, 176, 146, 188, 150, 148, 190, 156, 148, 188, 150, 154, 168, 164, 150, 170, 160, 156, 170, 156, 166, 158, 152, 180, 146, 160, 190, 152, 152, 184, 154, 148, 178, 150, 160, 170, 144, 180, 154, 154, 174, 160, 148, 176, 160, 158, 178, 150, 150, 186, 150, 160, 180, 154, 168, 158, 156, 176, 146, 154, 192, 144, 152, 178, 160, 140, 176, 146, 162, 166, 158, 160, 160, 134, 164, 154, 156, 176, 154, 142, 174, 130, 150, 176, 142, 152, 166, 142, 168, 144, 144, 172, 146, 150, 178, 150, 152, 164, 148, 142, 172, 146, 152, 164, 136, 162, 158, 144, 166, 144, 154, 174, 148, 146, 184, 142, 146, 180, 158, 144, 160, 150, 166, 152, 140, 172, 146, 146, 170, 144, 152, 164, 150, 148, 172, 140, 146, 176, 138, 164, 152, 156, 172, 156, 158, 174, 148, 150, 186, 154, 156, 186, 156, 160, 172, 146, 176, 154, 148, 172, 166, 146, 170, 150, 156, 178, 144, 156, 184, 140, 162, 174, 150, 166, 162, 146, 184, 152, 160, 184, 150, 148, 186, 152, 150, 178, 160, 158, 170, 150, 166, 168, 150, 172, 162, 150, 178, 150, 160, 184, 156, 150, 190, 138, 162, 174, 144, 166, 164, 140, 180, 148, 138, 192, 150, 152, 182, 156, 162, 170, 164, 146, 170, 156, 172, 164, 154, 166, 162, 150, 176, 156, 150, 190, 152, 140, 182, 148, 162, 180, 148, 176, 174, 150, 172, 140, 160, 174, 144, 158, 180, 156, 158, 180, 150, 154, 176, 140, 164, 174, 150, 168, 156, 150, 174, 150, 146, 192, 154, 150, 180, 154, 156, 164, 146, 176, 168, 146, 182, 158, 144, 182, 146, 152, 178, 158, 150, 178, 158, 146, 180, 142, 162, 170, 142, 170, 152, 156, 186, 146, 152, 192, 142, 158, 178, 146, 164, 170, 154, 156, 178, 146, 178, 160, 148, 168, 162, 152, 176, 158}, + {164, 162, 152, 164, 162, 154, 162, 168, 146, 164, 174, 150, 168, 168, 160, 152, 166, 164, 152, 158, 172, 166, 142, 164, 180, 148, 154, 184, 140, 154, 172, 154, 162, 158, 158, 166, 156, 168, 164, 152, 172, 164, 150, 162, 182, 146, 154, 174, 148, 152, 164, 162, 152, 154, 172, 168, 146, 160, 178, 144, 160, 178, 150, 158, 176, 150, 162, 168, 154, 170, 154, 176, 152, 146, 166, 166, 150, 166, 160, 146, 156, 178, 146, 168, 166, 154, 158, 164, 164, 164, 150, 166, 172, 146, 172, 176, 152, 158, 170, 146, 156, 166, 158, 160, 152, 174, 162, 150, 168, 162, 138, 160, 166, 148, 162, 170, 146, 146, 160, 148, 148, 170, 150, 154, 148, 160, 164, 142, 160, 170, 146, 156, 170, 152, 158, 172, 150, 148, 164, 154, 160, 150, 168, 166, 142, 160, 170, 140, 156, 168, 142, 150, 164, 146, 150, 160, 164, 152, 150, 174, 160, 146, 152, 166, 152, 158, 178, 136, 158, 172, 148, 158, 158, 152, 156, 154, 172, 156, 148, 160, 168, 148, 166, 172, 154, 158, 172, 156, 154, 164, 156, 166, 150, 178, 164, 148, 166, 174, 144, 158, 168, 142, 162, 176, 154, 154, 172, 166, 160, 156, 176, 158, 154, 162, 178, 146, 164, 178, 142, 162, 172, 152, 158, 160, 166, 162, 146, 160, 170, 150, 160, 176, 152, 170, 166, 146, 156, 176, 158, 158, 160, 166, 152, 164, 164, 166, 152, 166, 170, 148, 158, 184, 144, 170, 172, 152, 162, 158, 158, 176, 144, 166, 170, 150, 162, 178, 144, 164, 184, 150, 154, 166, 160, 144, 160, 168, 160, 156, 158, 158, 152, 166, 172, 136, 170, 182, 150, 164, 170, 150, 166, 156, 162, 158, 160, 168, 162, 152, 160, 176, 140, 158, 174, 156, 152, 176, 150, 162, 158, 166, 158, 156, 164, 174, 156, 162, 174, 144, 166, 174, 144, 170, 174, 150, 154, 158, 162, 156, 150, 166, 164, 158, 170, 172, 152, 166, 178, 148, 164, 176, 150, 166, 162, 156, 160, 158, 162, 162, 146, 176, 156, 146, 162, 184, 150, 168, 172, 154, 156, 164}, + {180, 160, 146, 166, 166, 148, 172, 162, 146, 176, 150, 162, 166, 146, 176, 170, 136, 178, 180, 132, 190, 158, 148, 162, 158, 146, 172, 140, 164, 176, 142, 164, 166, 150, 178, 170, 136, 172, 168, 136, 176, 164, 150, 174, 144, 168, 180, 140, 174, 172, 132, 180, 180, 132, 170, 156, 154, 172, 162, 158, 172, 150, 164, 164, 148, 160, 168, 146, 174, 164, 132, 180, 170, 138, 176, 158, 146, 174, 154, 164, 182, 122, 182, 162, 140, 180, 172, 142, 172, 168, 138, 180, 162, 152, 172, 140, 160, 168, 150, 172, 162, 140, 174, 160, 136, 174, 162, 134, 186, 154, 158, 158, 152, 152, 164, 138, 170, 166, 132, 174, 174, 120, 178, 162, 132, 172, 146, 150, 168, 140, 170, 162, 132, 162, 170, 132, 178, 164, 134, 168, 154, 138, 170, 160, 142, 164, 150, 150, 160, 132, 164, 170, 126, 178, 176, 128, 160, 166, 140, 166, 162, 144, 168, 146, 160, 168, 130, 176, 152, 130, 166, 158, 126, 172, 156, 128, 166, 156, 146, 172, 152, 150, 172, 140, 174, 172, 134, 178, 172, 144, 178, 174, 134, 170, 164, 148, 174, 144, 166, 170, 144, 178, 162, 140, 180, 172, 134, 170, 174, 132, 176, 168, 146, 180, 160, 152, 178, 146, 170, 164, 144, 172, 170, 130, 174, 166, 140, 178, 158, 146, 170, 156, 160, 174, 136, 180, 172, 140, 174, 172, 142, 180, 176, 142, 178, 162, 152, 164, 158, 156, 166, 146, 170, 164, 132, 176, 170, 138, 184, 162, 148, 178, 156, 148, 168, 162, 162, 170, 148, 162, 178, 136, 174, 182, 136, 172, 172, 140, 174, 172, 140, 176, 158, 158, 178, 140, 172, 168, 134, 188, 166, 142, 186, 168, 144, 174, 156, 144, 172, 154, 160, 172, 144, 162, 174, 148, 174, 172, 146, 168, 170, 134, 180, 172, 142, 176, 158, 148, 176, 146, 176, 162, 124, 182, 168, 134, 182, 160, 150, 172, 168, 148, 166, 172, 154, 164, 148, 162, 166, 144, 172, 166, 136, 182, 176, 130, 176, 168, 138, 168, 164, 152, 174, 130, 176, 168, 130, 178, 176, 142}, + {162, 150, 166, 166, 140, 170, 166, 144, 174, 156, 156, 162, 174, 160, 154, 160, 164, 160, 146, 178, 148, 150, 164, 174, 140, 166, 170, 154, 162, 158, 156, 164, 164, 164, 156, 158, 170, 156, 152, 176, 164, 142, 176, 176, 152, 160, 156, 166, 150, 146, 174, 148, 142, 172, 158, 150, 168, 164, 140, 170, 170, 154, 172, 160, 166, 156, 174, 160, 162, 152, 174, 152, 150, 182, 162, 142, 172, 160, 152, 158, 158, 172, 158, 160, 164, 158, 154, 166, 158, 146, 178, 162, 150, 170, 172, 154, 168, 166, 152, 160, 158, 158, 156, 158, 168, 152, 154, 174, 152, 144, 160, 170, 148, 162, 152, 162, 154, 156, 156, 146, 154, 158, 148, 146, 166, 146, 152, 164, 158, 142, 156, 166, 154, 158, 150, 170, 152, 150, 170, 146, 152, 164, 156, 136, 162, 162, 140, 158, 158, 154, 152, 152, 164, 150, 154, 164, 160, 142, 168, 162, 146, 174, 156, 152, 160, 164, 148, 148, 156, 162, 154, 156, 162, 146, 152, 158, 158, 138, 160, 160, 144, 164, 164, 156, 162, 166, 166, 154, 144, 176, 162, 148, 180, 160, 144, 182, 160, 152, 156, 168, 154, 162, 162, 164, 152, 152, 168, 154, 158, 174, 158, 152, 162, 158, 152, 176, 152, 158, 160, 172, 148, 166, 152, 180, 156, 146, 170, 154, 146, 178, 164, 142, 170, 168, 154, 158, 156, 178, 156, 154, 172, 164, 142, 172, 158, 148, 170, 164, 144, 166, 162, 154, 152, 168, 158, 150, 160, 166, 158, 158, 174, 152, 146, 174, 176, 134, 170, 174, 144, 170, 158, 166, 154, 148, 166, 166, 138, 172, 158, 150, 176, 156, 146, 168, 166, 164, 152, 164, 166, 158, 156, 168, 148, 160, 164, 162, 152, 166, 164, 140, 162, 164, 152, 170, 146, 164, 156, 154, 168, 152, 160, 174, 164, 142, 180, 160, 152, 172, 166, 158, 154, 166, 166, 156, 150, 186, 148, 152, 162, 162, 144, 170, 168, 144, 170, 164, 154, 160, 168, 162, 164, 156, 172, 156, 154, 180, 154, 142, 172, 162, 142, 162, 186, 158, 156, 160, 164, 170, 164, 168}, + {168, 142, 158, 158, 158, 160, 156, 152, 166, 164, 152, 172, 166, 148, 174, 154, 150, 174, 170, 144, 176, 154, 164, 160, 156, 170, 160, 140, 180, 158, 138, 174, 158, 148, 182, 148, 156, 172, 166, 160, 160, 162, 166, 158, 150, 174, 170, 144, 174, 170, 136, 176, 164, 146, 166, 158, 152, 168, 156, 168, 160, 148, 174, 162, 146, 162, 170, 148, 184, 156, 158, 172, 160, 154, 170, 156, 152, 164, 142, 172, 162, 138, 176, 160, 152, 168, 160, 156, 176, 152, 148, 168, 162, 156, 160, 154, 160, 162, 138, 172, 160, 144, 182, 156, 146, 168, 168, 156, 164, 148, 166, 154, 156, 170, 158, 148, 160, 164, 136, 168, 146, 154, 168, 142, 150, 158, 144, 148, 156, 144, 160, 162, 136, 168, 164, 138, 178, 164, 140, 164, 154, 162, 156, 158, 150, 156, 154, 154, 158, 144, 170, 154, 136, 168, 146, 148, 162, 158, 148, 160, 154, 158, 154, 148, 158, 156, 148, 162, 164, 134, 164, 156, 138, 162, 142, 150, 160, 152, 154, 158, 162, 152, 156, 148, 170, 172, 134, 182, 160, 156, 168, 162, 156, 168, 162, 154, 168, 154, 170, 162, 140, 168, 162, 136, 168, 160, 156, 178, 144, 166, 164, 164, 164, 156, 154, 166, 172, 140, 174, 160, 148, 176, 162, 140, 172, 160, 156, 168, 148, 158, 172, 156, 166, 162, 154, 176, 174, 132, 174, 158, 150, 176, 152, 158, 174, 152, 162, 164, 148, 164, 162, 140, 170, 164, 144, 168, 156, 152, 168, 166, 158, 168, 156, 160, 168, 162, 166, 154, 162, 174, 162, 142, 174, 152, 142, 176, 150, 160, 164, 156, 162, 164, 158, 158, 176, 144, 174, 162, 142, 178, 164, 140, 180, 146, 164, 174, 148, 164, 160, 164, 164, 154, 142, 174, 180, 142, 172, 164, 146, 180, 154, 162, 158, 172, 158, 170, 146, 152, 180, 146, 166, 164, 134, 172, 160, 138, 172, 146, 154, 170, 160, 158, 164, 160, 170, 160, 152, 162, 170, 140, 182, 162, 140, 186, 154, 152, 170, 160, 140, 168, 154, 168, 156, 144, 170, 166, 142, 172, 160, 148}, + {152, 152, 168, 156, 150, 166, 152, 148, 178, 138, 160, 178, 144, 170, 170, 144, 172, 164, 150, 186, 154, 146, 180, 162, 142, 176, 142, 170, 166, 140, 170, 158, 142, 176, 150, 158, 162, 158, 152, 176, 152, 148, 178, 162, 142, 176, 140, 172, 164, 140, 166, 158, 138, 180, 158, 140, 174, 154, 156, 168, 146, 164, 170, 142, 178, 162, 148, 184, 148, 152, 172, 154, 144, 186, 140, 150, 178, 144, 150, 178, 142, 164, 166, 140, 174, 164, 150, 176, 162, 152, 178, 158, 158, 182, 148, 156, 182, 142, 172, 172, 138, 176, 154, 146, 176, 156, 142, 176, 156, 140, 174, 152, 154, 168, 134, 164, 162, 140, 172, 148, 140, 170, 144, 148, 166, 146, 148, 170, 146, 150, 164, 144, 152, 164, 140, 170, 164, 142, 166, 154, 140, 174, 158, 142, 172, 146, 148, 172, 132, 150, 160, 130, 164, 154, 142, 160, 156, 150, 166, 154, 150, 182, 156, 152, 166, 138, 158, 158, 148, 166, 154, 136, 174, 152, 146, 162, 154, 150, 168, 144, 150, 174, 146, 162, 172, 138, 182, 162, 150, 172, 162, 150, 180, 154, 140, 192, 140, 154, 172, 138, 170, 160, 144, 176, 152, 150, 166, 156, 160, 162, 162, 156, 172, 156, 156, 174, 156, 168, 162, 146, 182, 152, 146, 174, 156, 140, 180, 152, 150, 182, 146, 156, 172, 144, 164, 166, 144, 176, 160, 154, 170, 160, 156, 170, 156, 146, 174, 148, 152, 174, 144, 158, 166, 136, 184, 162, 144, 178, 150, 148, 180, 156, 146, 180, 158, 152, 170, 158, 152, 168, 144, 176, 158, 142, 172, 154, 150, 162, 156, 152, 176, 142, 154, 186, 140, 168, 168, 140, 180, 154, 152, 180, 156, 156, 174, 148, 150, 174, 150, 146, 170, 152, 162, 160, 142, 168, 164, 142, 176, 158, 150, 174, 164, 148, 176, 154, 160, 180, 138, 168, 166, 148, 164, 166, 140, 180, 154, 152, 176, 152, 144, 182, 146, 156, 170, 146, 166, 172, 146, 172, 170, 140, 180, 158, 152, 172, 154, 152, 170, 158, 142, 178, 148, 160, 172, 142, 168, 164, 150, 180}, + {168, 146, 162, 170, 154, 164, 160, 160, 146, 160, 174, 152, 156, 180, 144, 164, 168, 172, 152, 158, 164, 156, 150, 158, 166, 144, 158, 168, 144, 164, 170, 152, 158, 158, 164, 152, 162, 170, 162, 160, 166, 168, 148, 158, 176, 150, 160, 168, 150, 156, 174, 162, 146, 154, 158, 166, 156, 164, 158, 160, 152, 178, 146, 166, 166, 156, 152, 180, 154, 154, 170, 164, 170, 140, 174, 162, 142, 156, 170, 148, 152, 176, 154, 154, 160, 162, 156, 156, 168, 160, 156, 162, 166, 148, 160, 182, 140, 160, 166, 152, 154, 170, 150, 158, 152, 166, 160, 150, 156, 174, 146, 152, 168, 144, 172, 160, 148, 150, 168, 152, 148, 156, 158, 136, 146, 158, 158, 136, 164, 158, 144, 154, 174, 150, 158, 166, 158, 148, 158, 164, 158, 156, 150, 164, 142, 146, 168, 136, 160, 164, 138, 152, 160, 148, 150, 160, 160, 148, 150, 164, 162, 136, 168, 162, 146, 154, 178, 146, 146, 164, 146, 152, 156, 152, 144, 156, 150, 148, 160, 152, 154, 142, 154, 170, 146, 160, 166, 156, 164, 160, 164, 152, 160, 166, 170, 142, 160, 170, 152, 150, 172, 150, 160, 164, 154, 152, 172, 150, 160, 162, 170, 156, 154, 162, 166, 152, 152, 178, 154, 152, 178, 150, 160, 154, 168, 152, 150, 156, 160, 152, 144, 164, 158, 154, 174, 154, 168, 166, 160, 148, 174, 164, 154, 158, 170, 160, 152, 154, 176, 148, 158, 176, 146, 150, 166, 156, 156, 164, 166, 164, 152, 168, 162, 154, 160, 178, 150, 158, 180, 146, 164, 160, 164, 146, 170, 162, 152, 166, 156, 158, 148, 152, 172, 150, 156, 170, 152, 168, 162, 166, 152, 164, 164, 152, 172, 158, 166, 148, 158, 168, 142, 164, 162, 152, 154, 172, 154, 164, 168, 162, 156, 158, 162, 160, 150, 160, 170, 148, 166, 172, 144, 162, 172, 156, 148, 156, 162, 148, 162, 162, 158, 156, 168, 168, 156, 170, 162, 156, 152, 182, 156, 156, 166, 156, 156, 154, 158, 162, 144, 162, 166, 144, 156, 166, 148, 160, 166, 154, 158, 156}, + {160, 158, 170, 140, 170, 158, 136, 154, 178, 146, 162, 176, 146, 158, 174, 152, 166, 148, 170, 168, 140, 176, 176, 144, 160, 180, 144, 146, 176, 142, 154, 164, 158, 162, 148, 164, 158, 148, 164, 170, 154, 164, 174, 148, 162, 182, 142, 162, 178, 152, 150, 160, 160, 166, 140, 168, 158, 134, 168, 170, 150, 154, 182, 142, 164, 172, 158, 156, 158, 158, 160, 150, 162, 166, 144, 164, 176, 134, 158, 176, 146, 146, 172, 158, 160, 162, 154, 166, 148, 168, 164, 150, 176, 174, 142, 158, 176, 146, 156, 178, 146, 162, 160, 164, 154, 142, 164, 170, 138, 158, 172, 144, 158, 168, 146, 156, 168, 146, 162, 152, 154, 156, 130, 172, 158, 142, 152, 164, 136, 150, 178, 140, 146, 160, 154, 148, 154, 164, 156, 154, 154, 162, 142, 158, 172, 140, 154, 168, 138, 146, 170, 142, 146, 160, 156, 154, 136, 172, 150, 142, 170, 174, 144, 156, 172, 138, 148, 166, 148, 152, 164, 146, 142, 150, 158, 158, 134, 160, 154, 134, 164, 176, 156, 150, 172, 148, 162, 166, 164, 164, 158, 164, 174, 146, 166, 172, 140, 160, 166, 146, 156, 166, 154, 150, 166, 156, 162, 148, 172, 158, 144, 166, 176, 146, 162, 190, 146, 156, 182, 144, 152, 166, 158, 164, 150, 162, 164, 150, 166, 170, 144, 164, 164, 148, 164, 168, 150, 160, 168, 160, 162, 146, 174, 170, 140, 174, 170, 146, 154, 176, 144, 144, 176, 154, 152, 162, 146, 162, 150, 170, 160, 146, 172, 166, 148, 168, 164, 150, 158, 176, 152, 158, 162, 152, 164, 144, 164, 160, 148, 168, 166, 152, 162, 172, 152, 156, 178, 152, 162, 166, 160, 164, 152, 170, 160, 144, 172, 160, 142, 160, 180, 146, 154, 176, 146, 152, 168, 140, 160, 166, 158, 172, 156, 164, 174, 154, 160, 180, 138, 160, 172, 140, 152, 166, 160, 152, 156, 158, 168, 144, 162, 168, 146, 158, 180, 140, 156, 190, 140, 156, 174, 148, 162, 162, 158, 164, 152, 170, 164, 142, 156, 174, 154, 152, 162, 156, 154, 172, 152, 160}, + {148, 156, 158, 148, 162, 160, 152, 172, 150, 156, 166, 142, 162, 174, 132, 178, 164, 146, 174, 162, 148, 168, 154, 156, 168, 148, 164, 168, 150, 160, 162, 140, 162, 154, 154, 172, 168, 146, 170, 160, 154, 172, 152, 160, 170, 134, 176, 172, 134, 170, 166, 144, 156, 174, 138, 166, 168, 154, 164, 154, 154, 168, 144, 174, 166, 146, 164, 176, 140, 178, 176, 142, 168, 158, 158, 160, 156, 158, 166, 138, 156, 164, 142, 168, 162, 146, 168, 180, 144, 162, 166, 150, 174, 154, 166, 168, 154, 160, 172, 126, 176, 160, 142, 164, 168, 144, 162, 156, 162, 168, 150, 156, 168, 142, 166, 162, 140, 166, 154, 132, 170, 158, 146, 144, 160, 142, 154, 152, 144, 168, 128, 162, 170, 134, 168, 172, 142, 154, 172, 144, 168, 162, 140, 166, 150, 150, 166, 130, 158, 156, 132, 158, 158, 134, 168, 162, 144, 162, 164, 150, 160, 156, 158, 158, 140, 164, 176, 140, 160, 164, 130, 158, 164, 140, 154, 160, 136, 168, 148, 146, 164, 146, 148, 166, 132, 170, 168, 140, 174, 160, 156, 170, 158, 152, 168, 158, 164, 172, 146, 160, 170, 140, 166, 162, 140, 162, 164, 144, 162, 172, 152, 166, 152, 164, 168, 148, 162, 174, 136, 174, 172, 142, 170, 158, 156, 154, 168, 138, 174, 148, 146, 174, 150, 158, 170, 148, 164, 168, 150, 172, 168, 140, 166, 164, 150, 166, 154, 156, 170, 146, 160, 168, 136, 160, 168, 142, 174, 170, 148, 160, 174, 144, 170, 166, 164, 166, 160, 156, 174, 142, 168, 160, 144, 170, 162, 140, 168, 162, 142, 158, 160, 154, 168, 146, 162, 172, 146, 162, 172, 144, 166, 178, 138, 168, 160, 158, 162, 160, 160, 166, 140, 164, 166, 136, 166, 170, 140, 174, 170, 138, 168, 170, 152, 166, 160, 148, 172, 154, 166, 170, 140, 174, 164, 142, 166, 174, 130, 162, 164, 146, 162, 156, 156, 176, 146, 158, 174, 140, 174, 172, 138, 170, 174, 138, 182, 160, 146, 170, 158, 154, 162, 140, 162, 166, 152, 162, 170, 144, 172, 166}, + {158, 172, 146, 158, 158, 142, 162, 144, 156, 168, 154, 152, 170, 166, 152, 164, 154, 170, 160, 152, 170, 170, 154, 170, 152, 148, 158, 156, 150, 166, 162, 146, 164, 160, 154, 164, 154, 162, 160, 146, 174, 150, 158, 176, 172, 142, 166, 158, 156, 164, 150, 166, 160, 142, 176, 150, 142, 174, 146, 152, 172, 158, 148, 168, 166, 154, 170, 164, 162, 160, 156, 164, 158, 150, 168, 160, 144, 174, 154, 146, 170, 164, 144, 162, 154, 162, 162, 154, 162, 156, 152, 186, 154, 150, 166, 162, 152, 170, 160, 164, 164, 154, 158, 162, 142, 166, 152, 156, 172, 154, 150, 170, 152, 156, 160, 158, 148, 158, 164, 148, 150, 148, 156, 150, 140, 166, 142, 138, 166, 146, 144, 164, 156, 152, 164, 144, 156, 162, 152, 166, 160, 154, 170, 150, 142, 162, 152, 146, 158, 158, 138, 156, 160, 144, 152, 142, 158, 148, 128, 172, 162, 142, 174, 162, 144, 166, 160, 146, 154, 162, 150, 152, 150, 154, 156, 136, 166, 142, 140, 166, 146, 148, 174, 152, 158, 164, 168, 156, 156, 156, 164, 166, 150, 176, 150, 154, 166, 156, 146, 168, 156, 150, 164, 150, 148, 164, 158, 160, 162, 148, 156, 164, 142, 172, 160, 156, 178, 158, 154, 172, 160, 156, 162, 156, 162, 156, 142, 174, 148, 152, 174, 154, 152, 170, 158, 148, 172, 160, 158, 154, 162, 166, 170, 150, 168, 152, 142, 174, 150, 152, 174, 154, 146, 180, 154, 150, 162, 156, 148, 160, 152, 170, 166, 148, 174, 166, 140, 172, 168, 148, 160, 170, 156, 162, 148, 164, 156, 140, 170, 154, 146, 172, 154, 156, 168, 166, 142, 170, 160, 160, 170, 154, 164, 160, 156, 166, 162, 144, 178, 140, 140, 180, 152, 148, 166, 164, 146, 166, 154, 164, 158, 150, 180, 152, 158, 170, 162, 144, 172, 152, 154, 168, 160, 150, 162, 154, 164, 160, 146, 164, 166, 144, 168, 148, 164, 168, 160, 158, 168, 170, 152, 170, 156, 170, 158, 146, 170, 148, 146, 172, 152, 146, 170, 148, 142, 172, 156, 152, 160, 164}, + {162, 154, 158, 154, 176, 142, 156, 164, 166, 152, 162, 162, 148, 148, 170, 162, 154, 168, 178, 152, 158, 170, 162, 152, 170, 158, 154, 154, 164, 150, 144, 154, 158, 150, 166, 164, 144, 162, 174, 158, 150, 172, 166, 152, 164, 164, 154, 158, 176, 146, 164, 154, 166, 148, 154, 166, 158, 150, 162, 156, 152, 160, 164, 148, 156, 172, 160, 156, 158, 178, 148, 158, 168, 154, 148, 166, 158, 142, 166, 164, 146, 144, 176, 148, 150, 160, 164, 156, 164, 170, 154, 154, 178, 156, 152, 174, 166, 148, 152, 164, 150, 150, 160, 158, 152, 148, 168, 148, 150, 162, 162, 152, 162, 156, 156, 148, 168, 158, 154, 152, 162, 142, 152, 168, 142, 138, 168, 148, 142, 158, 154, 146, 142, 168, 154, 164, 156, 162, 148, 152, 158, 152, 152, 164, 152, 142, 150, 164, 140, 150, 156, 146, 142, 150, 156, 144, 154, 170, 148, 140, 170, 162, 144, 156, 166, 148, 154, 162, 156, 154, 156, 156, 144, 156, 156, 150, 144, 158, 146, 144, 158, 160, 142, 148, 156, 158, 154, 166, 166, 152, 164, 174, 154, 146, 180, 162, 156, 160, 162, 152, 154, 166, 160, 152, 166, 154, 150, 164, 164, 162, 162, 172, 166, 144, 170, 168, 162, 156, 160, 158, 154, 170, 152, 156, 156, 168, 144, 150, 164, 160, 142, 158, 158, 146, 162, 168, 152, 156, 170, 164, 158, 156, 170, 154, 158, 168, 160, 156, 164, 162, 146, 152, 170, 146, 152, 168, 162, 144, 162, 170, 148, 164, 166, 158, 154, 176, 158, 156, 158, 172, 160, 140, 166, 166, 144, 164, 166, 152, 152, 154, 158, 148, 162, 162, 146, 156, 176, 156, 156, 170, 166, 150, 160, 170, 154, 162, 168, 156, 144, 168, 168, 142, 160, 164, 152, 140, 172, 152, 160, 168, 160, 160, 146, 166, 164, 156, 166, 170, 150, 158, 172, 152, 148, 166, 166, 150, 152, 164, 150, 152, 170, 154, 152, 156, 158, 156, 158, 170, 158, 162, 170, 160, 150, 162, 162, 150, 156, 180, 156, 140, 170, 152, 146, 156, 170, 156, 144, 162, 160, 148}, + {158, 162, 152, 158, 158, 154, 166, 158, 142, 170, 156, 144, 176, 158, 154, 164, 160, 158, 160, 156, 170, 154, 156, 172, 150, 144, 168, 160, 136, 174, 152, 152, 170, 150, 152, 162, 160, 162, 158, 156, 168, 150, 154, 182, 160, 144, 172, 160, 146, 174, 150, 154, 160, 154, 164, 146, 148, 172, 150, 156, 166, 158, 144, 180, 148, 150, 170, 162, 162, 164, 164, 164, 156, 156, 168, 156, 148, 168, 154, 140, 176, 156, 146, 170, 150, 158, 154, 148, 168, 160, 162, 162, 164, 162, 170, 152, 148, 176, 152, 160, 174, 156, 150, 172, 140, 166, 144, 162, 162, 160, 146, 166, 156, 154, 164, 156, 144, 172, 142, 154, 158, 158, 160, 144, 150, 162, 146, 142, 168, 140, 140, 170, 156, 142, 162, 148, 160, 160, 158, 156, 158, 156, 170, 154, 146, 168, 160, 130, 164, 148, 134, 162, 140, 150, 152, 150, 152, 150, 164, 156, 154, 146, 182, 156, 140, 172, 164, 142, 168, 138, 154, 158, 150, 140, 154, 148, 156, 160, 138, 156, 150, 138, 166, 160, 146, 172, 152, 156, 164, 168, 156, 166, 156, 172, 152, 150, 168, 166, 144, 168, 160, 146, 158, 144, 152, 164, 158, 152, 160, 156, 160, 154, 144, 172, 162, 154, 174, 156, 150, 172, 148, 160, 170, 156, 158, 156, 146, 172, 148, 146, 170, 158, 152, 162, 160, 146, 170, 158, 142, 168, 162, 170, 160, 162, 168, 154, 156, 164, 160, 144, 174, 152, 152, 166, 152, 152, 160, 152, 158, 160, 158, 164, 162, 160, 162, 164, 156, 168, 160, 148, 168, 150, 148, 156, 168, 160, 156, 154, 160, 154, 152, 174, 156, 146, 176, 152, 150, 168, 160, 154, 178, 160, 160, 166, 154, 164, 154, 158, 168, 152, 142, 166, 156, 142, 166, 156, 148, 164, 148, 158, 160, 156, 164, 158, 154, 184, 158, 140, 172, 164, 146, 174, 162, 140, 166, 152, 150, 156, 154, 174, 148, 152, 168, 164, 150, 174, 162, 146, 166, 156, 154, 166, 164, 160, 160, 160, 156, 148, 156, 178, 150, 144, 176, 154, 134, 176, 156, 146, 166, 162}, + {168, 154, 144, 180, 140, 156, 168, 140, 164, 166, 140, 172, 160, 152, 164, 160, 156, 168, 156, 162, 168, 154, 152, 170, 154, 160, 162, 148, 166, 158, 150, 160, 152, 146, 176, 148, 144, 176, 152, 146, 174, 152, 170, 174, 154, 170, 166, 154, 174, 154, 150, 166, 144, 150, 162, 150, 156, 160, 146, 156, 166, 142, 166, 158, 158, 174, 150, 160, 172, 148, 152, 166, 156, 154, 168, 160, 154, 160, 148, 170, 154, 144, 168, 160, 148, 168, 160, 152, 172, 142, 158, 166, 152, 166, 170, 154, 168, 158, 152, 164, 154, 148, 160, 148, 146, 166, 152, 146, 170, 142, 158, 170, 140, 172, 156, 152, 168, 170, 154, 166, 146, 142, 152, 146, 142, 158, 144, 150, 158, 138, 164, 152, 140, 166, 156, 148, 162, 164, 146, 164, 148, 154, 166, 146, 152, 168, 132, 162, 154, 144, 158, 156, 140, 164, 142, 144, 160, 142, 144, 164, 160, 150, 158, 148, 158, 158, 142, 178, 150, 154, 166, 144, 144, 164, 140, 148, 158, 128, 152, 162, 134, 160, 158, 144, 160, 156, 152, 170, 154, 152, 172, 156, 158, 170, 152, 162, 170, 138, 174, 160, 146, 164, 162, 154, 166, 144, 152, 176, 146, 146, 176, 156, 156, 166, 148, 164, 180, 148, 166, 162, 162, 168, 150, 140, 168, 152, 154, 168, 146, 160, 160, 140, 164, 168, 146, 166, 170, 148, 176, 152, 156, 174, 152, 158, 166, 156, 156, 168, 146, 162, 158, 146, 164, 150, 150, 160, 156, 158, 162, 158, 152, 170, 150, 158, 162, 152, 172, 164, 150, 170, 160, 156, 180, 154, 142, 172, 142, 138, 166, 152, 160, 170, 136, 168, 160, 144, 174, 162, 152, 170, 164, 152, 162, 154, 162, 172, 144, 158, 164, 146, 158, 170, 150, 166, 160, 144, 164, 160, 154, 170, 152, 152, 164, 150, 162, 174, 146, 170, 168, 150, 168, 158, 150, 174, 152, 154, 170, 150, 152, 162, 152, 150, 170, 142, 160, 170, 150, 168, 166, 154, 176, 158, 154, 170, 150, 152, 172, 150, 148, 174, 146, 152, 156, 144, 162, 162, 144, 174, 158, 148}, + {172, 144, 166, 154, 156, 166, 140, 152, 164, 146, 154, 162, 146, 156, 172, 148, 168, 164, 160, 164, 164, 162, 172, 150, 160, 158, 150, 158, 160, 156, 144, 164, 150, 158, 162, 146, 174, 158, 162, 164, 154, 166, 160, 150, 156, 170, 148, 164, 164, 148, 160, 168, 164, 160, 154, 160, 158, 148, 158, 166, 148, 156, 162, 152, 160, 168, 150, 158, 170, 172, 156, 168, 160, 160, 154, 154, 172, 146, 152, 166, 140, 164, 168, 142, 154, 160, 156, 162, 160, 162, 164, 162, 158, 172, 150, 152, 168, 144, 164, 170, 150, 152, 172, 156, 156, 154, 152, 164, 148, 162, 156, 156, 152, 168, 148, 152, 164, 142, 158, 168, 146, 160, 154, 148, 162, 140, 150, 154, 138, 148, 146, 132, 156, 166, 140, 156, 164, 150, 154, 162, 162, 158, 160, 156, 156, 144, 150, 162, 140, 150, 162, 128, 154, 156, 146, 156, 160, 154, 158, 152, 154, 168, 154, 152, 162, 146, 160, 166, 148, 144, 164, 148, 156, 148, 152, 152, 146, 150, 158, 136, 156, 158, 136, 154, 162, 146, 162, 166, 152, 160, 164, 160, 170, 158, 162, 166, 154, 158, 160, 144, 166, 160, 144, 156, 164, 150, 156, 160, 148, 166, 154, 158, 168, 148, 176, 158, 154, 162, 168, 146, 162, 170, 150, 170, 164, 160, 156, 152, 156, 154, 158, 148, 164, 146, 158, 172, 136, 162, 162, 158, 164, 168, 168, 160, 160, 160, 174, 148, 164, 160, 142, 160, 164, 138, 156, 168, 146, 154, 166, 144, 162, 154, 168, 164, 152, 160, 168, 150, 160, 170, 142, 156, 168, 152, 156, 156, 164, 168, 154, 146, 160, 154, 156, 154, 154, 164, 166, 148, 164, 164, 162, 160, 168, 160, 160, 152, 164, 160, 152, 158, 172, 130, 152, 170, 140, 146, 178, 142, 164, 158, 156, 172, 158, 162, 166, 160, 164, 166, 142, 166, 172, 148, 160, 162, 148, 154, 158, 150, 158, 162, 146, 162, 156, 154, 168, 150, 156, 168, 144, 158, 172, 156, 156, 170, 156, 158, 160, 162, 164, 148, 158, 168, 140, 154, 170, 142, 156, 160, 154, 156}, + {144, 170, 160, 152, 150, 154, 150, 152, 160, 160, 156, 156, 158, 156, 152, 158, 164, 144, 164, 172, 148, 156, 166, 162, 156, 170, 158, 158, 156, 152, 154, 146, 172, 148, 148, 158, 154, 160, 150, 164, 150, 156, 170, 168, 164, 156, 164, 158, 146, 166, 156, 150, 160, 154, 144, 150, 168, 148, 148, 160, 160, 162, 164, 158, 154, 150, 174, 156, 158, 162, 174, 144, 152, 176, 150, 160, 162, 162, 150, 154, 164, 148, 148, 158, 156, 156, 156, 160, 146, 156, 170, 156, 156, 172, 170, 158, 164, 166, 154, 148, 170, 156, 140, 162, 162, 144, 158, 164, 152, 152, 168, 156, 160, 162, 162, 148, 160, 162, 156, 148, 152, 160, 138, 150, 162, 148, 144, 160, 150, 146, 158, 166, 140, 150, 162, 156, 148, 160, 164, 144, 150, 172, 152, 150, 160, 160, 148, 152, 160, 150, 146, 152, 154, 134, 152, 148, 138, 148, 162, 138, 156, 164, 160, 152, 160, 166, 154, 154, 170, 154, 146, 154, 160, 136, 146, 158, 140, 144, 150, 154, 144, 156, 166, 146, 146, 164, 164, 146, 170, 172, 150, 158, 174, 154, 152, 168, 162, 154, 168, 156, 162, 158, 152, 150, 148, 162, 156, 146, 152, 166, 150, 154, 164, 160, 150, 166, 174, 158, 148, 178, 154, 146, 160, 160, 150, 150, 168, 150, 144, 174, 154, 156, 162, 160, 156, 152, 162, 150, 148, 170, 160, 156, 164, 168, 152, 156, 158, 158, 156, 162, 164, 152, 148, 170, 160, 144, 156, 164, 150, 162, 168, 150, 154, 174, 154, 156, 168, 176, 152, 162, 168, 158, 148, 170, 156, 150, 152, 154, 146, 158, 162, 152, 152, 166, 160, 148, 164, 168, 152, 156, 164, 172, 152, 156, 174, 148, 152, 170, 162, 146, 162, 170, 154, 146, 164, 158, 140, 168, 154, 148, 156, 160, 144, 162, 174, 162, 152, 170, 172, 150, 162, 164, 158, 148, 160, 160, 144, 160, 156, 150, 150, 162, 152, 150, 164, 162, 158, 158, 168, 158, 156, 176, 162, 142, 158, 172, 152, 154, 164, 154, 144, 168, 160, 146, 154, 168, 156, 148, 162, 172}, + {166, 150, 156, 170, 152, 148, 166, 154, 154, 158, 152, 152, 154, 166, 160, 152, 172, 160, 152, 166, 180, 152, 146, 174, 150, 148, 162, 158, 154, 156, 162, 154, 146, 166, 164, 146, 158, 172, 140, 154, 170, 156, 152, 168, 164, 166, 154, 172, 164, 150, 170, 156, 156, 152, 166, 150, 148, 162, 148, 154, 154, 164, 144, 156, 166, 166, 146, 180, 164, 150, 164, 176, 144, 158, 168, 150, 154, 158, 164, 150, 146, 166, 164, 142, 166, 164, 150, 154, 160, 156, 156, 168, 158, 154, 166, 164, 152, 160, 164, 166, 148, 168, 162, 144, 152, 168, 140, 154, 170, 146, 146, 168, 152, 152, 148, 170, 152, 152, 170, 170, 140, 170, 154, 140, 146, 154, 140, 144, 146, 142, 148, 136, 160, 154, 142, 162, 166, 150, 160, 166, 160, 144, 166, 150, 158, 162, 150, 146, 140, 160, 148, 144, 156, 154, 138, 158, 162, 138, 148, 176, 146, 150, 162, 154, 158, 154, 162, 160, 150, 166, 156, 144, 154, 160, 148, 144, 164, 140, 148, 148, 150, 146, 150, 156, 152, 148, 164, 162, 144, 156, 166, 154, 160, 176, 158, 158, 166, 154, 156, 162, 158, 158, 148, 160, 156, 148, 162, 160, 152, 152, 168, 146, 158, 162, 168, 150, 156, 164, 168, 144, 174, 168, 150, 162, 168, 154, 144, 170, 148, 150, 168, 144, 154, 154, 162, 154, 154, 172, 168, 156, 170, 164, 158, 160, 170, 142, 170, 160, 162, 146, 156, 162, 158, 138, 168, 164, 136, 154, 170, 140, 156, 176, 146, 150, 174, 160, 160, 158, 176, 158, 146, 170, 168, 142, 164, 156, 152, 158, 164, 142, 154, 166, 148, 152, 160, 160, 152, 154, 170, 160, 150, 162, 178, 156, 154, 168, 154, 148, 168, 156, 150, 152, 154, 156, 144, 158, 166, 140, 170, 162, 154, 154, 174, 144, 158, 164, 168, 150, 166, 162, 158, 150, 164, 168, 146, 162, 164, 142, 160, 172, 142, 146, 176, 154, 150, 158, 162, 160, 154, 174, 158, 154, 170, 166, 154, 160, 170, 146, 156, 168, 150, 148, 160, 162, 150, 142, 166, 158, 142, 158}, + {154, 158, 162, 146, 158, 166, 138, 162, 158, 140, 166, 158, 156, 154, 164, 150, 156, 164, 154, 164, 156, 174, 176, 136, 170, 176, 138, 164, 166, 138, 156, 164, 146, 148, 158, 146, 162, 152, 162, 168, 146, 168, 166, 146, 160, 170, 156, 156, 166, 154, 160, 164, 148, 166, 148, 158, 164, 146, 162, 166, 142, 160, 162, 158, 156, 160, 154, 156, 164, 164, 166, 154, 168, 168, 140, 176, 162, 140, 162, 158, 148, 160, 156, 146, 152, 168, 146, 162, 162, 160, 160, 152, 170, 168, 146, 172, 164, 150, 152, 166, 140, 164, 158, 152, 162, 158, 158, 160, 138, 170, 156, 144, 166, 164, 152, 160, 156, 154, 152, 156, 150, 156, 156, 150, 158, 140, 164, 146, 134, 160, 156, 144, 148, 152, 142, 156, 158, 154, 162, 150, 156, 160, 146, 162, 162, 144, 156, 166, 140, 152, 158, 134, 150, 146, 146, 146, 150, 148, 160, 136, 166, 164, 140, 164, 156, 156, 156, 164, 150, 160, 158, 150, 150, 144, 146, 158, 132, 162, 152, 136, 156, 154, 134, 160, 156, 152, 156, 162, 158, 164, 158, 166, 168, 150, 176, 162, 142, 166, 170, 130, 166, 156, 150, 162, 156, 148, 158, 158, 156, 164, 152, 164, 168, 136, 168, 172, 144, 168, 168, 164, 156, 160, 150, 160, 162, 152, 170, 144, 162, 156, 134, 160, 166, 140, 162, 162, 138, 158, 160, 158, 160, 166, 162, 170, 154, 172, 158, 144, 172, 168, 146, 154, 156, 160, 152, 150, 156, 166, 154, 152, 170, 140, 170, 164, 136, 166, 170, 146, 170, 164, 156, 154, 170, 142, 170, 160, 154, 154, 146, 162, 162, 138, 162, 158, 152, 158, 164, 150, 166, 156, 164, 160, 162, 150, 170, 152, 164, 166, 142, 164, 164, 142, 162, 164, 146, 156, 152, 150, 160, 156, 156, 168, 146, 172, 172, 146, 170, 172, 144, 164, 170, 144, 164, 160, 152, 154, 152, 158, 154, 142, 160, 156, 144, 160, 164, 142, 170, 166, 162, 148, 166, 164, 168, 160, 156, 160, 152, 164, 164, 138, 162, 166, 136, 164, 164, 152, 154, 164, 150, 162}, + {154, 164, 162, 148, 166, 152, 156, 154, 154, 154, 168, 154, 146, 164, 152, 168, 166, 148, 174, 154, 158, 166, 156, 156, 166, 152, 158, 162, 154, 158, 160, 146, 156, 154, 148, 166, 152, 148, 164, 150, 150, 170, 158, 156, 180, 158, 154, 174, 146, 168, 158, 144, 168, 154, 146, 160, 150, 138, 166, 142, 150, 168, 152, 154, 168, 152, 160, 164, 152, 176, 166, 140, 168, 158, 150, 162, 152, 154, 160, 160, 150, 156, 146, 160, 156, 146, 166, 164, 140, 174, 152, 152, 168, 152, 162, 174, 166, 158, 164, 154, 170, 164, 140, 168, 152, 132, 162, 156, 138, 164, 154, 148, 164, 160, 148, 156, 158, 170, 160, 146, 170, 156, 136, 166, 144, 136, 158, 150, 142, 156, 154, 140, 160, 154, 150, 158, 136, 176, 158, 146, 162, 156, 142, 176, 156, 154, 164, 146, 144, 156, 150, 152, 150, 142, 152, 154, 136, 170, 138, 152, 162, 154, 152, 174, 156, 144, 154, 152, 162, 158, 136, 168, 150, 148, 154, 146, 142, 152, 150, 140, 156, 150, 144, 156, 148, 156, 170, 140, 168, 166, 146, 168, 162, 162, 160, 162, 160, 170, 156, 166, 150, 164, 152, 154, 150, 160, 150, 142, 162, 156, 138, 172, 158, 156, 162, 158, 156, 168, 156, 168, 160, 154, 170, 166, 146, 166, 152, 148, 170, 148, 152, 164, 156, 148, 166, 156, 160, 164, 144, 168, 156, 146, 170, 166, 150, 162, 162, 152, 162, 156, 146, 162, 160, 148, 154, 150, 154, 152, 138, 170, 154, 150, 168, 152, 156, 172, 158, 170, 166, 158, 162, 166, 138, 174, 150, 152, 164, 158, 148, 160, 154, 146, 162, 162, 144, 168, 162, 158, 160, 158, 172, 164, 152, 180, 162, 152, 162, 154, 152, 174, 158, 152, 160, 148, 154, 158, 150, 166, 156, 148, 164, 144, 154, 168, 150, 160, 172, 158, 164, 168, 160, 158, 158, 160, 160, 156, 142, 170, 158, 138, 170, 154, 148, 168, 156, 154, 162, 156, 146, 162, 156, 164, 166, 156, 168, 154, 158, 166, 150, 156, 162, 152, 154, 156, 154, 148, 164, 138, 168, 158}, + {154, 162, 162, 148, 154, 164, 150, 150, 150, 162, 144, 136, 182, 150, 150, 162, 164, 150, 164, 166, 160, 162, 170, 160, 158, 148, 170, 152, 148, 170, 156, 148, 170, 154, 142, 162, 160, 146, 158, 170, 154, 152, 166, 174, 150, 150, 186, 148, 156, 166, 162, 140, 168, 156, 154, 164, 160, 158, 150, 148, 170, 144, 150, 176, 150, 146, 176, 150, 160, 170, 170, 154, 162, 174, 162, 154, 162, 168, 154, 136, 174, 146, 144, 168, 154, 136, 168, 152, 154, 166, 164, 162, 150, 166, 166, 152, 154, 174, 154, 144, 172, 142, 156, 166, 160, 154, 160, 156, 156, 160, 144, 168, 156, 140, 180, 144, 142, 168, 158, 146, 160, 162, 142, 148, 156, 148, 142, 140, 164, 136, 128, 166, 140, 134, 168, 148, 148, 160, 156, 150, 162, 156, 160, 160, 152, 166, 142, 152, 168, 138, 136, 158, 142, 142, 160, 140, 144, 154, 152, 150, 140, 164, 162, 152, 150, 178, 148, 152, 170, 156, 154, 162, 156, 140, 148, 154, 148, 144, 150, 150, 140, 148, 156, 146, 138, 164, 146, 154, 160, 160, 148, 168, 166, 160, 160, 166, 164, 156, 138, 176, 158, 140, 170, 160, 146, 168, 154, 150, 160, 168, 154, 148, 160, 160, 154, 156, 170, 162, 148, 178, 158, 146, 168, 160, 148, 164, 154, 158, 144, 162, 152, 152, 140, 180, 140, 148, 168, 164, 146, 174, 158, 158, 166, 166, 158, 158, 158, 176, 150, 152, 176, 154, 140, 172, 152, 142, 168, 154, 146, 160, 160, 160, 160, 168, 162, 150, 156, 174, 152, 152, 174, 152, 154, 170, 154, 150, 164, 156, 150, 154, 152, 160, 148, 140, 174, 152, 138, 176, 152, 144, 170, 162, 154, 160, 174, 148, 162, 160, 166, 146, 142, 182, 146, 136, 182, 144, 150, 160, 160, 148, 162, 166, 154, 150, 170, 164, 156, 164, 176, 154, 148, 174, 152, 146, 164, 160, 146, 156, 156, 146, 154, 156, 160, 146, 156, 168, 156, 146, 182, 154, 152, 178, 160, 148, 172, 166, 150, 154, 170, 156, 152, 152, 162, 148, 144, 170, 148, 144, 168, 156}, + {168, 148, 154, 166, 160, 132, 166, 156, 152, 152, 164, 152, 146, 166, 164, 144, 162, 164, 152, 164, 174, 166, 144, 174, 162, 150, 160, 162, 148, 150, 162, 160, 142, 148, 170, 146, 142, 174, 156, 144, 170, 160, 148, 160, 170, 158, 152, 178, 158, 148, 170, 168, 148, 150, 168, 152, 136, 170, 150, 144, 158, 160, 146, 150, 168, 158, 146, 166, 174, 154, 154, 180, 152, 142, 168, 164, 146, 154, 164, 154, 152, 160, 154, 144, 164, 162, 142, 152, 172, 156, 144, 168, 156, 150, 166, 168, 156, 158, 172, 160, 150, 164, 164, 146, 150, 164, 146, 146, 166, 152, 148, 166, 154, 160, 154, 164, 164, 148, 162, 168, 150, 152, 170, 150, 136, 166, 142, 142, 152, 156, 144, 146, 160, 146, 138, 156, 170, 156, 146, 176, 148, 150, 172, 152, 148, 168, 156, 142, 150, 164, 150, 140, 162, 150, 132, 154, 152, 142, 142, 162, 152, 138, 162, 162, 150, 150, 160, 160, 146, 160, 168, 148, 142, 166, 146, 136, 162, 144, 130, 156, 144, 142, 150, 164, 150, 138, 166, 166, 150, 158, 166, 158, 152, 172, 162, 150, 170, 162, 152, 158, 168, 154, 144, 164, 156, 144, 146, 162, 142, 136, 174, 152, 146, 168, 162, 156, 152, 176, 166, 156, 168, 162, 150, 150, 178, 144, 154, 160, 166, 142, 170, 150, 148, 148, 164, 154, 148, 164, 166, 144, 154, 176, 156, 152, 186, 158, 146, 158, 164, 142, 160, 160, 154, 152, 156, 158, 144, 158, 158, 148, 148, 162, 160, 138, 168, 162, 160, 164, 174, 158, 158, 176, 160, 150, 158, 166, 152, 140, 168, 158, 140, 164, 158, 150, 162, 150, 164, 154, 158, 174, 142, 166, 176, 154, 148, 178, 160, 144, 174, 150, 160, 154, 158, 154, 144, 164, 158, 146, 148, 168, 154, 144, 178, 162, 144, 172, 164, 148, 158, 176, 154, 152, 168, 162, 150, 154, 174, 144, 148, 172, 146, 138, 162, 156, 150, 154, 164, 158, 142, 172, 166, 150, 166, 182, 150, 156, 174, 152, 136, 168, 160, 150, 152, 158, 152, 146, 162, 158, 146, 156}, + {156, 164, 150, 154, 162, 158, 150, 156, 158, 150, 144, 164, 156, 146, 156, 164, 146, 160, 166, 156, 158, 166, 166, 152, 166, 168, 154, 166, 160, 158, 146, 158, 158, 146, 156, 148, 162, 146, 150, 160, 154, 162, 164, 154, 158, 168, 160, 158, 164, 166, 146, 152, 160, 154, 150, 168, 156, 142, 164, 154, 150, 156, 166, 156, 148, 166, 156, 152, 162, 164, 162, 158, 170, 164, 148, 168, 154, 154, 156, 162, 148, 146, 166, 148, 148, 148, 164, 146, 146, 166, 154, 154, 166, 164, 164, 172, 172, 160, 154, 160, 162, 150, 156, 162, 152, 156, 154, 152, 152, 158, 160, 148, 156, 162, 160, 148, 156, 166, 142, 158, 160, 154, 150, 154, 156, 132, 160, 150, 140, 144, 152, 142, 138, 158, 148, 146, 146, 162, 150, 152, 170, 146, 154, 168, 164, 148, 158, 166, 144, 140, 158, 154, 134, 146, 156, 138, 142, 156, 158, 134, 158, 164, 146, 154, 176, 158, 152, 160, 162, 150, 152, 166, 144, 144, 156, 148, 142, 158, 156, 146, 150, 154, 150, 146, 156, 158, 140, 162, 158, 150, 154, 168, 166, 156, 166, 162, 156, 162, 166, 156, 148, 166, 160, 142, 162, 158, 146, 156, 154, 160, 148, 162, 164, 146, 166, 156, 162, 156, 170, 168, 150, 170, 160, 160, 148, 166, 152, 152, 158, 150, 144, 156, 160, 152, 156, 158, 158, 148, 160, 162, 154, 156, 170, 160, 150, 178, 160, 154, 162, 170, 150, 154, 162, 150, 146, 160, 162, 148, 154, 162, 156, 150, 160, 160, 144, 174, 166, 154, 158, 170, 160, 150, 160, 162, 148, 148, 162, 162, 148, 150, 156, 150, 156, 158, 146, 166, 158, 158, 156, 156, 162, 150, 166, 164, 162, 150, 172, 164, 140, 168, 156, 154, 156, 156, 158, 142, 154, 156, 146, 152, 166, 156, 146, 162, 160, 154, 168, 172, 162, 160, 164, 166, 142, 164, 168, 140, 154, 160, 154, 146, 160, 160, 146, 160, 158, 148, 152, 160, 160, 152, 166, 168, 148, 156, 174, 158, 152, 170, 160, 152, 160, 164, 148, 158, 156, 158, 144, 158, 164, 138}, + {156, 164, 154, 160, 160, 150, 154, 158, 146, 156, 158, 146, 162, 146, 160, 162, 156, 156, 166, 160, 168, 164, 156, 164, 152, 156, 156, 152, 162, 158, 158, 148, 156, 156, 150, 160, 150, 160, 158, 152, 168, 156, 152, 158, 160, 166, 162, 156, 164, 160, 164, 156, 164, 150, 158, 152, 150, 158, 152, 154, 162, 142, 148, 162, 154, 160, 162, 160, 160, 172, 154, 166, 168, 158, 160, 156, 164, 152, 156, 150, 164, 150, 146, 162, 152, 154, 158, 158, 160, 160, 152, 158, 164, 152, 164, 146, 166, 166, 154, 162, 166, 160, 156, 160, 154, 160, 156, 152, 154, 150, 154, 146, 160, 146, 160, 160, 158, 160, 162, 152, 168, 152, 162, 150, 146, 158, 150, 140, 150, 150, 144, 154, 146, 138, 164, 144, 150, 164, 160, 158, 160, 148, 160, 152, 158, 158, 152, 150, 158, 142, 144, 152, 152, 144, 152, 136, 160, 144, 142, 154, 152, 150, 160, 152, 146, 164, 162, 144, 164, 152, 158, 168, 150, 154, 158, 140, 154, 142, 140, 148, 146, 140, 146, 146, 144, 160, 152, 158, 162, 156, 162, 162, 158, 162, 168, 156, 164, 152, 164, 158, 156, 152, 162, 156, 146, 160, 154, 150, 158, 148, 156, 156, 144, 166, 152, 156, 158, 160, 154, 164, 164, 158, 164, 154, 168, 160, 154, 160, 156, 154, 160, 150, 150, 160, 144, 156, 160, 158, 156, 166, 156, 160, 168, 158, 168, 160, 156, 168, 148, 160, 154, 156, 152, 168, 152, 152, 158, 146, 156, 162, 148, 158, 164, 154, 162, 158, 154, 168, 158, 160, 166, 158, 160, 168, 156, 160, 162, 146, 162, 152, 152, 152, 146, 154, 156, 144, 148, 168, 156, 154, 166, 162, 164, 166, 164, 170, 152, 160, 162, 160, 156, 154, 152, 150, 162, 150, 148, 162, 150, 156, 160, 156, 160, 156, 154, 158, 162, 152, 160, 166, 160, 158, 162, 150, 162, 164, 146, 162, 144, 160, 154, 148, 162, 152, 152, 158, 156, 156, 168, 152, 156, 170, 166, 166, 164, 162, 162, 156, 148, 162, 154, 150, 154, 152, 152, 154, 148, 154, 164, 160}, + {170, 156, 160, 166, 148, 160, 158, 148, 160, 166, 140, 154, 158, 148, 154, 160, 146, 162, 148, 160, 166, 156, 168, 176, 148, 164, 172, 144, 150, 170, 138, 160, 152, 148, 150, 160, 146, 160, 148, 160, 160, 142, 164, 170, 150, 168, 166, 158, 158, 160, 152, 166, 148, 162, 164, 144, 162, 162, 138, 148, 166, 144, 166, 160, 152, 160, 160, 156, 150, 162, 160, 164, 154, 166, 166, 146, 160, 168, 152, 158, 164, 140, 160, 156, 148, 156, 154, 152, 152, 150, 166, 162, 150, 164, 174, 156, 166, 168, 150, 158, 164, 154, 154, 154, 150, 158, 144, 156, 156, 148, 156, 170, 140, 164, 160, 152, 154, 160, 148, 160, 160, 152, 154, 148, 150, 154, 136, 152, 162, 128, 152, 156, 136, 150, 154, 148, 144, 162, 150, 160, 156, 162, 156, 154, 164, 160, 152, 160, 158, 146, 152, 154, 136, 146, 152, 142, 146, 144, 152, 152, 136, 156, 168, 148, 166, 164, 146, 158, 168, 150, 162, 154, 146, 152, 140, 154, 158, 136, 156, 150, 142, 154, 158, 138, 156, 142, 152, 150, 164, 148, 162, 150, 164, 168, 150, 174, 168, 156, 154, 166, 140, 158, 166, 140, 166, 148, 148, 154, 154, 156, 168, 144, 162, 164, 148, 158, 170, 154, 170, 164, 152, 158, 170, 150, 162, 152, 158, 158, 146, 160, 160, 146, 154, 160, 144, 162, 154, 148, 162, 148, 162, 156, 150, 168, 170, 148, 168, 166, 146, 160, 170, 144, 166, 158, 140, 158, 152, 148, 154, 146, 158, 160, 134, 172, 158, 156, 158, 176, 148, 172, 166, 150, 158, 156, 158, 160, 154, 154, 154, 152, 154, 164, 144, 160, 162, 146, 162, 154, 154, 160, 156, 150, 170, 158, 164, 164, 158, 158, 166, 148, 158, 172, 146, 156, 160, 150, 146, 162, 154, 152, 156, 152, 160, 152, 164, 166, 146, 176, 170, 150, 164, 170, 142, 164, 170, 144, 164, 152, 150, 160, 142, 164, 154, 150, 158, 166, 152, 160, 166, 150, 160, 166, 154, 158, 164, 160, 160, 146, 168, 166, 146, 162, 160, 142, 154, 168, 136, 156, 146, 150}, + {158, 146, 150, 166, 138, 158, 168, 138, 150, 156, 156, 162, 146, 162, 164, 148, 164, 168, 148, 162, 178, 144, 164, 168, 156, 158, 150, 164, 160, 148, 170, 162, 142, 154, 166, 132, 154, 172, 140, 158, 162, 156, 152, 162, 162, 166, 158, 170, 166, 150, 170, 170, 142, 160, 160, 150, 150, 156, 154, 158, 152, 158, 144, 148, 160, 158, 142, 172, 168, 144, 166, 172, 152, 164, 162, 158, 154, 156, 154, 156, 146, 166, 154, 132, 168, 158, 146, 156, 170, 144, 158, 166, 150, 158, 162, 160, 162, 154, 174, 164, 138, 170, 164, 144, 160, 166, 142, 156, 152, 142, 150, 150, 160, 160, 156, 156, 164, 150, 164, 166, 142, 164, 174, 138, 150, 158, 138, 148, 144, 148, 150, 140, 158, 144, 146, 156, 164, 134, 160, 166, 146, 156, 168, 154, 154, 162, 152, 156, 154, 154, 150, 134, 158, 164, 130, 144, 160, 132, 154, 156, 140, 150, 160, 148, 158, 148, 166, 154, 146, 168, 166, 146, 162, 168, 138, 152, 158, 138, 146, 154, 140, 138, 144, 156, 148, 140, 164, 162, 142, 166, 166, 150, 156, 176, 142, 162, 170, 156, 166, 150, 172, 158, 146, 170, 162, 142, 154, 170, 136, 154, 166, 144, 156, 158, 156, 162, 156, 164, 170, 150, 174, 168, 142, 166, 174, 144, 148, 170, 148, 146, 152, 152, 154, 152, 150, 154, 148, 166, 170, 148, 160, 172, 146, 160, 174, 160, 162, 160, 166, 154, 150, 162, 154, 146, 170, 154, 136, 170, 162, 144, 162, 162, 156, 148, 164, 152, 160, 156, 168, 160, 152, 174, 164, 144, 158, 172, 142, 156, 166, 142, 150, 148, 150, 152, 152, 164, 152, 152, 166, 160, 148, 176, 174, 144, 168, 162, 152, 154, 160, 158, 158, 150, 154, 160, 146, 162, 160, 140, 152, 168, 134, 166, 162, 152, 156, 170, 152, 158, 162, 170, 166, 156, 170, 158, 136, 164, 168, 146, 154, 158, 144, 154, 158, 150, 150, 156, 150, 162, 150, 168, 166, 154, 160, 176, 146, 172, 168, 156, 154, 162, 146, 156, 154, 164, 148, 144, 162, 164, 138, 164}, + {170, 154, 170, 148, 172, 154, 142, 166, 162, 130, 156, 154, 142, 150, 164, 150, 158, 158, 162, 158, 152, 172, 170, 154, 172, 172, 142, 156, 174, 140, 158, 156, 154, 156, 146, 160, 162, 140, 164, 156, 148, 158, 176, 136, 170, 172, 146, 158, 172, 156, 158, 162, 158, 160, 154, 158, 164, 144, 160, 164, 134, 150, 170, 138, 158, 158, 166, 148, 150, 164, 164, 156, 164, 164, 154, 164, 172, 142, 168, 158, 146, 152, 168, 146, 148, 156, 152, 154, 146, 168, 160, 148, 174, 162, 148, 162, 182, 144, 162, 172, 158, 152, 162, 154, 154, 142, 170, 156, 142, 164, 164, 138, 158, 156, 136, 168, 168, 146, 150, 168, 150, 158, 146, 160, 156, 142, 164, 156, 136, 148, 158, 134, 144, 164, 134, 146, 142, 158, 156, 146, 166, 166, 146, 164, 164, 150, 156, 170, 134, 150, 158, 142, 144, 148, 142, 146, 142, 152, 150, 140, 164, 154, 138, 162, 172, 140, 160, 166, 154, 154, 164, 150, 154, 152, 154, 150, 130, 156, 152, 132, 154, 154, 140, 146, 158, 146, 142, 162, 156, 152, 152, 166, 164, 148, 178, 172, 148, 160, 168, 144, 154, 168, 144, 154, 156, 158, 156, 148, 152, 164, 140, 164, 158, 146, 158, 170, 138, 174, 168, 152, 156, 168, 164, 158, 152, 164, 166, 142, 166, 160, 146, 156, 166, 134, 158, 166, 144, 152, 154, 158, 154, 144, 176, 164, 152, 164, 172, 146, 162, 168, 148, 160, 162, 152, 144, 160, 148, 144, 150, 158, 150, 146, 164, 164, 144, 172, 170, 144, 158, 180, 148, 158, 166, 158, 156, 154, 160, 162, 142, 174, 160, 144, 158, 162, 142, 148, 170, 146, 158, 172, 154, 154, 160, 170, 156, 158, 174, 168, 152, 160, 162, 146, 154, 168, 138, 150, 166, 146, 146, 150, 164, 152, 146, 164, 164, 144, 168, 170, 152, 150, 184, 140, 158, 170, 156, 160, 156, 150, 160, 150, 162, 158, 142, 160, 168, 138, 158, 168, 142, 154, 164, 154, 162, 160, 166, 158, 160, 162, 162, 148, 164, 170, 136, 148, 168, 140, 152, 146, 160, 152}, + {146, 158, 168, 146, 154, 160, 162, 150, 152, 162, 146, 150, 160, 158, 148, 158, 168, 142, 166, 162, 156, 158, 166, 152, 150, 162, 160, 160, 148, 164, 164, 132, 164, 154, 150, 152, 164, 140, 154, 162, 156, 162, 156, 158, 158, 152, 168, 168, 154, 168, 166, 138, 162, 162, 146, 156, 158, 144, 146, 158, 150, 160, 144, 158, 164, 146, 162, 162, 154, 170, 170, 148, 164, 180, 150, 152, 160, 162, 154, 152, 164, 156, 138, 168, 156, 136, 160, 162, 150, 152, 158, 150, 150, 164, 164, 160, 158, 164, 162, 154, 162, 162, 144, 168, 170, 146, 148, 162, 150, 146, 154, 158, 152, 152, 162, 158, 150, 170, 156, 150, 166, 162, 152, 156, 162, 142, 144, 154, 140, 144, 144, 146, 148, 140, 160, 158, 138, 168, 158, 150, 154, 162, 154, 152, 166, 154, 158, 144, 168, 150, 142, 156, 152, 138, 154, 152, 140, 148, 154, 140, 142, 154, 152, 154, 150, 164, 158, 160, 164, 164, 142, 168, 160, 146, 154, 160, 142, 142, 148, 148, 142, 142, 146, 148, 138, 156, 158, 142, 158, 174, 144, 156, 164, 156, 158, 166, 160, 162, 158, 162, 170, 148, 166, 164, 138, 164, 154, 146, 156, 158, 140, 146, 170, 150, 158, 158, 160, 156, 146, 176, 164, 158, 166, 172, 138, 158, 168, 148, 146, 160, 148, 150, 148, 158, 154, 146, 162, 162, 148, 162, 166, 150, 154, 176, 150, 164, 170, 154, 164, 154, 156, 158, 146, 160, 162, 142, 168, 162, 138, 150, 166, 148, 154, 158, 158, 146, 158, 166, 166, 154, 168, 162, 154, 164, 168, 140, 164, 164, 148, 142, 158, 150, 152, 156, 150, 160, 146, 162, 158, 146, 168, 162, 158, 158, 172, 154, 160, 166, 158, 148, 164, 154, 152, 144, 160, 160, 142, 164, 162, 142, 160, 162, 148, 158, 160, 150, 158, 162, 162, 174, 148, 178, 162, 140, 172, 152, 148, 164, 164, 138, 150, 160, 148, 150, 146, 156, 156, 148, 164, 166, 152, 166, 168, 152, 168, 170, 146, 158, 166, 154, 152, 152, 162, 158, 152, 166, 148, 150, 154, 164}, + {162, 160, 152, 168, 156, 150, 152, 158, 144, 154, 160, 154, 146, 162, 154, 142, 158, 152, 162, 160, 162, 160, 160, 166, 176, 150, 162, 164, 150, 154, 160, 154, 154, 160, 142, 150, 144, 162, 158, 150, 152, 154, 152, 162, 168, 160, 168, 158, 158, 154, 170, 160, 158, 160, 158, 158, 148, 158, 156, 144, 156, 152, 146, 158, 156, 156, 146, 162, 156, 156, 158, 160, 166, 154, 170, 158, 160, 162, 160, 152, 150, 168, 148, 144, 162, 148, 148, 156, 152, 158, 152, 160, 160, 152, 168, 168, 148, 168, 164, 162, 156, 166, 152, 150, 152, 152, 156, 148, 156, 156, 146, 154, 162, 148, 162, 160, 156, 148, 156, 156, 158, 158, 158, 160, 152, 150, 146, 148, 154, 148, 144, 152, 146, 142, 138, 144, 150, 140, 156, 156, 160, 150, 158, 168, 142, 162, 160, 156, 160, 156, 152, 148, 148, 142, 140, 148, 142, 156, 136, 154, 148, 146, 160, 158, 154, 158, 162, 148, 156, 160, 166, 148, 162, 152, 156, 138, 154, 154, 140, 150, 150, 142, 152, 148, 152, 144, 150, 156, 152, 150, 160, 164, 148, 170, 162, 148, 168, 172, 154, 164, 164, 152, 152, 162, 154, 150, 152, 154, 146, 150, 158, 164, 138, 164, 168, 144, 162, 170, 164, 158, 164, 158, 154, 160, 166, 160, 152, 164, 166, 140, 160, 162, 150, 152, 152, 150, 152, 160, 150, 152, 162, 164, 164, 150, 164, 168, 154, 168, 160, 160, 162, 160, 154, 154, 164, 148, 146, 150, 150, 154, 148, 158, 158, 152, 160, 164, 152, 168, 160, 162, 162, 176, 154, 156, 162, 164, 154, 156, 148, 164, 150, 154, 156, 150, 162, 150, 156, 152, 158, 158, 150, 154, 160, 166, 154, 168, 168, 152, 162, 166, 146, 168, 152, 154, 156, 154, 150, 146, 150, 156, 154, 154, 158, 156, 152, 162, 152, 158, 170, 162, 156, 160, 166, 166, 148, 170, 150, 154, 148, 166, 158, 136, 160, 154, 150, 166, 158, 154, 152, 158, 150, 158, 166, 162, 166, 154, 168, 166, 154, 158, 164, 148, 162, 156, 146, 146, 166, 152, 144, 158}, + {168, 158, 154, 160, 156, 158, 158, 160, 154, 152, 154, 144, 152, 148, 154, 166, 152, 162, 152, 156, 168, 160, 158, 160, 160, 166, 160, 160, 158, 168, 152, 156, 148, 150, 160, 158, 150, 162, 146, 150, 162, 162, 154, 158, 152, 156, 166, 162, 162, 168, 152, 162, 160, 152, 160, 154, 154, 150, 156, 158, 146, 160, 156, 152, 146, 162, 162, 154, 158, 164, 158, 172, 156, 162, 162, 170, 146, 154, 164, 148, 164, 148, 156, 152, 148, 160, 158, 150, 160, 152, 154, 156, 162, 156, 158, 166, 170, 150, 162, 156, 168, 156, 160, 162, 148, 162, 152, 154, 148, 158, 150, 146, 152, 156, 154, 156, 150, 160, 170, 152, 158, 154, 162, 150, 158, 148, 150, 148, 136, 146, 142, 140, 146, 144, 150, 152, 150, 154, 152, 158, 148, 160, 164, 156, 160, 150, 160, 156, 148, 152, 146, 152, 148, 150, 144, 148, 150, 144, 148, 146, 150, 142, 146, 158, 154, 156, 150, 162, 158, 158, 152, 160, 148, 162, 148, 154, 148, 142, 150, 138, 152, 140, 150, 140, 140, 152, 152, 156, 148, 160, 164, 154, 158, 154, 164, 172, 154, 166, 158, 162, 152, 162, 154, 156, 154, 154, 156, 152, 162, 150, 156, 144, 158, 148, 152, 162, 160, 148, 164, 162, 158, 162, 168, 154, 164, 158, 152, 154, 158, 158, 152, 150, 152, 156, 150, 152, 156, 150, 160, 162, 156, 152, 158, 172, 162, 156, 168, 158, 172, 144, 158, 164, 154, 156, 146, 154, 160, 144, 162, 152, 152, 158, 148, 152, 152, 156, 156, 160, 164, 158, 158, 156, 164, 160, 164, 152, 158, 152, 162, 154, 150, 152, 158, 144, 144, 162, 144, 168, 158, 150, 162, 156, 168, 156, 160, 164, 158, 164, 150, 164, 162, 150, 162, 152, 148, 156, 154, 150, 154, 146, 158, 148, 154, 158, 166, 156, 168, 158, 156, 168, 162, 156, 164, 152, 160, 150, 158, 158, 152, 154, 148, 160, 148, 154, 146, 146, 152, 160, 162, 150, 166, 158, 152, 158, 168, 162, 168, 154, 154, 160, 156, 160, 146, 158, 154, 152, 150, 150, 158, 150}, + {160, 168, 156, 154, 158, 146, 158, 150, 152, 148, 162, 154, 144, 160, 160, 142, 160, 150, 164, 154, 160, 170, 160, 156, 170, 160, 152, 162, 154, 152, 156, 154, 160, 148, 148, 156, 146, 148, 158, 152, 154, 154, 150, 158, 160, 174, 154, 162, 160, 156, 170, 162, 162, 150, 156, 156, 156, 148, 156, 148, 152, 148, 150, 154, 158, 158, 158, 162, 158, 150, 164, 152, 176, 160, 162, 156, 158, 158, 156, 162, 146, 154, 164, 150, 148, 154, 150, 148, 150, 160, 158, 154, 154, 154, 168, 156, 162, 162, 160, 174, 164, 152, 158, 162, 152, 152, 158, 150, 152, 160, 146, 156, 154, 150, 156, 158, 156, 160, 154, 162, 166, 158, 146, 162, 146, 154, 158, 146, 146, 154, 146, 144, 148, 146, 140, 152, 144, 154, 156, 146, 164, 154, 148, 168, 148, 164, 154, 156, 152, 160, 152, 146, 148, 148, 152, 142, 144, 148, 142, 144, 150, 158, 146, 160, 152, 156, 170, 156, 152, 164, 154, 160, 162, 148, 158, 146, 150, 148, 138, 148, 138, 146, 138, 156, 148, 136, 152, 152, 156, 158, 144, 164, 158, 164, 168, 160, 162, 164, 160, 154, 172, 150, 158, 154, 164, 154, 150, 150, 154, 148, 150, 156, 148, 158, 156, 160, 146, 162, 166, 154, 160, 170, 162, 166, 154, 164, 152, 162, 150, 152, 150, 154, 154, 148, 152, 154, 152, 154, 156, 156, 156, 160, 154, 152, 166, 168, 154, 166, 158, 162, 154, 156, 164, 146, 158, 156, 150, 152, 152, 158, 150, 150, 160, 152, 162, 162, 158, 152, 164, 170, 154, 166, 166, 172, 148, 162, 160, 154, 150, 152, 150, 150, 152, 162, 150, 142, 160, 148, 152, 158, 160, 160, 162, 172, 158, 158, 166, 156, 166, 158, 154, 150, 164, 156, 156, 158, 148, 152, 158, 150, 156, 158, 152, 158, 150, 150, 168, 156, 166, 160, 162, 158, 174, 158, 160, 160, 156, 158, 148, 158, 154, 146, 150, 152, 160, 146, 166, 148, 148, 162, 154, 156, 174, 162, 166, 158, 156, 160, 166, 154, 160, 156, 156, 158, 152, 146, 162, 148, 150, 154}, + {154, 172, 160, 154, 168, 162, 146, 166, 162, 150, 152, 144, 162, 148, 142, 170, 150, 154, 158, 156, 148, 166, 166, 158, 156, 166, 164, 158, 156, 166, 156, 160, 154, 150, 154, 158, 144, 146, 158, 154, 156, 156, 168, 152, 158, 156, 168, 160, 158, 168, 154, 154, 164, 160, 148, 160, 158, 146, 158, 156, 148, 156, 148, 160, 152, 146, 160, 148, 152, 168, 156, 160, 174, 156, 162, 162, 166, 162, 156, 156, 164, 146, 150, 160, 144, 148, 160, 150, 142, 162, 150, 156, 160, 160, 152, 162, 166, 162, 162, 154, 162, 152, 158, 166, 154, 150, 160, 156, 146, 156, 156, 152, 146, 160, 152, 156, 156, 160, 156, 152, 158, 154, 152, 160, 158, 152, 148, 150, 142, 146, 144, 154, 136, 148, 154, 138, 146, 162, 146, 152, 164, 156, 162, 156, 166, 156, 160, 160, 160, 152, 150, 156, 142, 140, 150, 138, 146, 152, 144, 148, 148, 146, 150, 150, 162, 158, 146, 156, 166, 152, 156, 158, 150, 154, 164, 148, 146, 150, 156, 144, 152, 144, 158, 146, 134, 160, 144, 148, 160, 152, 158, 166, 152, 152, 162, 166, 162, 164, 164, 166, 146, 154, 162, 156, 146, 158, 148, 148, 156, 158, 142, 160, 158, 146, 158, 156, 166, 158, 160, 166, 164, 140, 170, 152, 156, 168, 166, 148, 164, 158, 154, 154, 154, 156, 154, 154, 152, 154, 152, 158, 152, 150, 162, 164, 146, 172, 164, 158, 160, 162, 162, 158, 152, 166, 148, 144, 160, 150, 148, 158, 146, 152, 156, 156, 154, 162, 164, 158, 156, 164, 168, 156, 152, 164, 152, 152, 166, 152, 156, 162, 156, 150, 152, 152, 154, 150, 154, 162, 162, 152, 162, 150, 152, 162, 154, 162, 166, 170, 160, 156, 162, 158, 160, 142, 166, 146, 146, 162, 146, 142, 164, 144, 148, 160, 156, 158, 156, 166, 164, 158, 154, 174, 152, 156, 166, 144, 150, 162, 152, 144, 166, 164, 144, 156, 152, 160, 150, 154, 168, 156, 152, 164, 154, 154, 162, 158, 160, 170, 158, 158, 156, 160, 156, 150, 148, 162, 148, 146, 158, 146}, + {164, 152, 164, 162, 148, 150, 168, 142, 140, 166, 140, 146, 162, 152, 150, 154, 160, 156, 162, 166, 162, 156, 158, 172, 154, 152, 168, 154, 144, 168, 150, 150, 166, 158, 150, 146, 162, 162, 142, 148, 164, 152, 136, 172, 148, 162, 164, 160, 158, 168, 168, 160, 152, 162, 158, 160, 150, 168, 150, 136, 168, 144, 148, 160, 154, 152, 160, 164, 156, 152, 160, 166, 158, 158, 166, 158, 150, 174, 148, 152, 160, 164, 140, 156, 158, 152, 154, 156, 158, 148, 146, 166, 154, 148, 176, 156, 148, 168, 156, 158, 170, 162, 156, 158, 166, 162, 148, 154, 166, 140, 142, 164, 150, 144, 168, 146, 148, 166, 160, 156, 160, 164, 162, 154, 152, 160, 150, 144, 158, 138, 134, 150, 144, 138, 152, 142, 138, 150, 162, 154, 154, 146, 162, 156, 154, 166, 152, 146, 170, 142, 152, 154, 146, 150, 142, 146, 144, 138, 152, 146, 146, 138, 158, 142, 142, 170, 154, 148, 168, 164, 152, 156, 166, 160, 146, 148, 156, 146, 134, 160, 136, 132, 156, 132, 150, 152, 152, 146, 146, 158, 160, 148, 162, 158, 160, 156, 168, 150, 146, 178, 162, 148, 166, 158, 152, 162, 160, 152, 154, 150, 158, 138, 148, 174, 148, 148, 164, 154, 150, 168, 164, 170, 154, 176, 162, 152, 156, 162, 152, 146, 164, 146, 150, 154, 146, 142, 164, 152, 150, 156, 166, 158, 158, 166, 178, 160, 154, 168, 158, 154, 170, 152, 144, 158, 162, 146, 156, 152, 152, 148, 156, 160, 150, 146, 168, 144, 148, 170, 162, 154, 164, 164, 166, 166, 168, 162, 152, 164, 160, 146, 142, 162, 150, 136, 166, 148, 142, 166, 142, 152, 158, 174, 152, 164, 166, 160, 162, 150, 170, 154, 158, 166, 144, 162, 156, 154, 148, 154, 154, 158, 146, 166, 156, 160, 148, 162, 150, 160, 166, 162, 156, 174, 160, 156, 162, 166, 152, 158, 160, 162, 140, 150, 162, 140, 142, 168, 140, 150, 160, 158, 158, 168, 158, 168, 162, 172, 160, 160, 160, 166, 154, 144, 164, 148, 150, 166, 142, 156, 160, 156}, + {168, 162, 154, 168, 152, 150, 160, 164, 150, 150, 164, 152, 146, 148, 162, 146, 148, 162, 154, 138, 174, 152, 158, 168, 170, 158, 166, 172, 162, 150, 164, 158, 142, 144, 166, 142, 136, 164, 148, 148, 160, 160, 154, 158, 162, 156, 160, 160, 170, 146, 156, 182, 150, 148, 172, 152, 146, 162, 150, 156, 144, 166, 148, 146, 152, 160, 152, 142, 168, 154, 154, 178, 156, 148, 178, 158, 162, 152, 170, 158, 152, 152, 168, 144, 144, 166, 146, 136, 172, 148, 150, 162, 156, 160, 152, 168, 160, 156, 160, 174, 154, 154, 170, 142, 142, 164, 150, 146, 160, 152, 152, 152, 152, 160, 146, 160, 166, 144, 152, 172, 150, 140, 168, 160, 142, 166, 146, 146, 150, 150, 150, 142, 152, 154, 140, 142, 158, 142, 138, 166, 140, 158, 170, 154, 158, 156, 168, 160, 152, 158, 156, 148, 146, 154, 142, 140, 158, 140, 136, 150, 146, 142, 158, 162, 152, 152, 158, 166, 148, 154, 174, 152, 140, 164, 152, 146, 162, 138, 150, 152, 148, 150, 144, 148, 146, 144, 142, 160, 150, 142, 160, 156, 148, 168, 158, 160, 170, 170, 164, 158, 166, 162, 150, 150, 170, 144, 136, 168, 142, 138, 168, 154, 148, 160, 156, 158, 160, 162, 160, 152, 158, 168, 160, 144, 180, 152, 156, 168, 156, 150, 162, 156, 148, 150, 162, 162, 138, 150, 164, 152, 142, 168, 152, 140, 172, 152, 160, 166, 168, 158, 152, 164, 168, 162, 148, 168, 144, 142, 170, 144, 142, 160, 150, 150, 158, 160, 158, 150, 170, 166, 152, 154, 168, 160, 144, 172, 150, 142, 166, 156, 152, 160, 156, 150, 146, 150, 170, 146, 152, 170, 146, 144, 176, 150, 148, 184, 158, 158, 168, 162, 156, 156, 166, 156, 146, 156, 154, 144, 144, 160, 154, 132, 168, 148, 156, 166, 154, 154, 168, 166, 160, 156, 158, 174, 158, 144, 168, 148, 138, 166, 156, 144, 152, 158, 146, 152, 160, 152, 156, 148, 164, 142, 162, 168, 154, 148, 176, 154, 148, 168, 156, 158, 158, 154, 156, 148, 156, 152, 142, 144}, + {174, 154, 160, 156, 160, 170, 152, 144, 174, 146, 132, 170, 144, 144, 160, 152, 148, 164, 156, 160, 152, 166, 168, 162, 152, 170, 154, 148, 172, 160, 138, 174, 156, 146, 156, 156, 160, 146, 154, 160, 142, 154, 166, 148, 142, 176, 160, 148, 168, 166, 154, 164, 170, 156, 150, 172, 158, 144, 158, 154, 150, 134, 168, 146, 144, 168, 154, 150, 162, 160, 158, 158, 164, 168, 152, 160, 178, 148, 142, 166, 158, 142, 158, 150, 146, 156, 152, 154, 150, 160, 158, 150, 150, 162, 154, 152, 172, 164, 152, 176, 160, 156, 158, 164, 166, 158, 156, 158, 144, 152, 160, 142, 140, 168, 148, 144, 154, 162, 152, 162, 170, 160, 154, 156, 170, 144, 148, 162, 136, 140, 156, 144, 128, 160, 140, 140, 154, 148, 152, 154, 154, 164, 142, 160, 162, 150, 146, 176, 150, 144, 168, 144, 142, 158, 142, 148, 140, 150, 148, 144, 142, 156, 140, 142, 170, 152, 142, 170, 162, 152, 162, 156, 154, 156, 158, 154, 148, 150, 154, 132, 146, 152, 138, 134, 160, 142, 138, 152, 152, 156, 162, 154, 160, 148, 164, 174, 148, 156, 162, 154, 148, 176, 156, 140, 170, 156, 150, 150, 158, 160, 144, 142, 166, 142, 156, 164, 154, 138, 178, 156, 148, 180, 154, 164, 160, 166, 156, 152, 164, 156, 142, 152, 162, 146, 136, 160, 156, 142, 168, 158, 152, 158, 164, 160, 158, 170, 164, 150, 154, 180, 148, 144, 168, 146, 146, 160, 156, 152, 154, 158, 146, 150, 152, 168, 142, 150, 160, 160, 148, 168, 164, 154, 172, 160, 164, 148, 166, 166, 148, 156, 166, 142, 146, 162, 144, 148, 164, 152, 146, 154, 164, 158, 154, 166, 162, 152, 160, 172, 142, 156, 172, 142, 148, 162, 156, 144, 166, 150, 148, 154, 152, 160, 146, 152, 164, 140, 158, 168, 156, 144, 186, 164, 146, 172, 154, 154, 166, 156, 166, 146, 152, 162, 142, 152, 166, 142, 138, 166, 144, 152, 168, 158, 152, 168, 164, 168, 150, 170, 172, 152, 158, 162, 152, 148, 172, 148, 134, 170, 156, 142}, + {148, 168, 174, 160, 136, 174, 152, 150, 160, 150, 160, 146, 152, 156, 146, 156, 158, 144, 150, 164, 148, 146, 178, 156, 158, 172, 156, 164, 156, 152, 162, 146, 160, 164, 140, 142, 160, 156, 136, 166, 156, 136, 164, 160, 160, 158, 154, 168, 156, 152, 176, 154, 152, 170, 154, 138, 168, 152, 142, 170, 138, 156, 152, 152, 162, 144, 158, 168, 144, 156, 164, 160, 144, 176, 160, 146, 174, 162, 160, 158, 148, 164, 146, 158, 166, 148, 146, 154, 140, 142, 170, 148, 150, 170, 156, 160, 168, 156, 166, 154, 158, 174, 150, 152, 164, 148, 146, 162, 154, 136, 164, 146, 150, 152, 150, 162, 152, 152, 174, 142, 158, 170, 146, 148, 164, 152, 146, 156, 150, 140, 148, 138, 150, 140, 148, 158, 132, 144, 162, 144, 146, 162, 166, 142, 172, 164, 158, 158, 158, 160, 148, 154, 158, 134, 146, 156, 142, 128, 160, 144, 130, 156, 146, 146, 160, 146, 162, 150, 154, 164, 148, 160, 168, 150, 150, 160, 156, 130, 164, 138, 140, 154, 144, 150, 136, 146, 158, 142, 156, 156, 154, 146, 172, 158, 146, 180, 160, 154, 172, 162, 168, 148, 158, 170, 144, 156, 164, 146, 136, 164, 152, 150, 154, 154, 144, 160, 152, 158, 154, 168, 170, 150, 156, 174, 160, 148, 172, 158, 142, 170, 160, 148, 158, 148, 156, 146, 150, 166, 140, 152, 166, 154, 152, 170, 158, 148, 170, 168, 150, 168, 164, 164, 150, 166, 164, 140, 158, 158, 144, 138, 164, 148, 138, 172, 156, 152, 168, 150, 164, 160, 158, 170, 154, 164, 176, 150, 148, 162, 156, 144, 164, 148, 144, 160, 152, 148, 148, 156, 162, 150, 156, 166, 154, 158, 176, 156, 154, 178, 162, 156, 166, 164, 162, 152, 148, 164, 142, 154, 166, 138, 150, 156, 154, 144, 166, 162, 146, 168, 156, 164, 158, 164, 170, 154, 160, 172, 142, 152, 162, 160, 136, 172, 148, 140, 158, 152, 160, 154, 152, 166, 146, 160, 162, 154, 156, 174, 162, 148, 174, 158, 144, 174, 146, 160, 156, 148, 164, 134, 150, 162}, + {156, 156, 164, 152, 168, 150, 162, 156, 142, 156, 152, 148, 146, 162, 150, 144, 164, 152, 156, 164, 156, 168, 152, 162, 166, 146, 166, 164, 160, 152, 166, 160, 142, 162, 150, 152, 154, 150, 162, 140, 150, 172, 150, 154, 160, 152, 162, 166, 160, 160, 174, 158, 156, 166, 152, 158, 154, 154, 164, 138, 156, 162, 150, 144, 154, 160, 134, 166, 158, 152, 170, 158, 170, 152, 160, 168, 152, 164, 160, 154, 158, 170, 152, 142, 168, 148, 140, 164, 152, 154, 146, 162, 164, 138, 160, 166, 152, 156, 172, 162, 154, 170, 158, 158, 164, 156, 160, 156, 146, 164, 150, 158, 158, 146, 148, 160, 152, 148, 166, 164, 146, 172, 154, 156, 152, 156, 162, 140, 146, 162, 142, 140, 158, 144, 132, 150, 146, 144, 156, 150, 156, 154, 142, 166, 152, 162, 166, 146, 152, 162, 156, 146, 162, 144, 134, 160, 138, 148, 140, 144, 160, 138, 140, 158, 146, 160, 164, 162, 150, 170, 164, 140, 172, 148, 160, 152, 148, 160, 136, 154, 142, 146, 140, 146, 142, 134, 162, 136, 144, 168, 142, 160, 156, 144, 172, 148, 164, 164, 152, 162, 168, 164, 142, 170, 156, 144, 160, 152, 160, 146, 150, 150, 148, 154, 166, 152, 154, 158, 154, 152, 164, 160, 160, 172, 152, 164, 158, 154, 160, 144, 152, 164, 140, 152, 162, 148, 138, 162, 158, 142, 162, 156, 150, 162, 154, 166, 160, 154, 174, 156, 152, 168, 160, 142, 160, 158, 146, 168, 144, 154, 158, 150, 158, 146, 154, 164, 138, 162, 168, 158, 154, 170, 160, 146, 172, 158, 154, 160, 162, 158, 142, 160, 166, 140, 150, 160, 146, 140, 166, 148, 144, 168, 152, 154, 162, 160, 164, 156, 162, 166, 150, 154, 156, 156, 148, 170, 158, 136, 160, 146, 146, 162, 152, 158, 146, 150, 174, 148, 162, 174, 150, 154, 164, 158, 158, 160, 160, 154, 162, 146, 160, 142, 156, 168, 136, 152, 154, 148, 154, 162, 154, 150, 172, 158, 154, 158, 160, 172, 152, 158, 166, 142, 166, 154, 152, 152, 152, 154, 138, 166}, + {166, 166, 162, 168, 156, 156, 152, 160, 160, 148, 172, 138, 152, 152, 146, 164, 144, 162, 150, 160, 154, 158, 164, 154, 176, 156, 156, 178, 154, 158, 156, 146, 162, 140, 158, 150, 152, 146, 150, 158, 144, 160, 150, 150, 164, 148, 164, 160, 162, 162, 154, 162, 168, 154, 162, 160, 148, 148, 158, 154, 148, 160, 140, 152, 154, 148, 162, 146, 156, 162, 144, 164, 164, 166, 154, 174, 158, 152, 170, 152, 142, 156, 152, 158, 144, 156, 158, 142, 144, 160, 152, 146, 160, 162, 150, 164, 156, 166, 168, 156, 164, 158, 158, 160, 150, 160, 158, 154, 144, 158, 152, 138, 160, 152, 148, 154, 152, 168, 150, 154, 172, 144, 156, 164, 162, 144, 164, 152, 148, 152, 140, 140, 150, 138, 152, 142, 144, 152, 142, 148, 158, 160, 150, 162, 154, 154, 174, 152, 154, 164, 146, 160, 148, 144, 158, 132, 146, 150, 142, 144, 144, 156, 140, 152, 150, 156, 158, 146, 158, 156, 162, 166, 148, 156, 158, 160, 154, 150, 146, 140, 160, 134, 144, 150, 144, 150, 140, 152, 156, 150, 160, 156, 160, 162, 156, 164, 150, 176, 152, 158, 174, 146, 168, 152, 158, 158, 138, 154, 156, 150, 146, 156, 148, 142, 168, 146, 152, 162, 154, 168, 158, 164, 164, 152, 164, 166, 162, 154, 166, 152, 150, 164, 150, 148, 158, 148, 162, 142, 154, 162, 148, 154, 168, 148, 160, 170, 156, 162, 172, 154, 160, 164, 150, 162, 156, 148, 164, 142, 156, 152, 152, 140, 160, 150, 138, 168, 162, 144, 166, 156, 170, 160, 164, 174, 154, 160, 162, 150, 152, 162, 154, 142, 160, 148, 146, 160, 150, 156, 150, 152, 172, 144, 160, 158, 164, 152, 168, 164, 152, 176, 158, 156, 166, 150, 158, 156, 142, 158, 148, 156, 156, 142, 146, 164, 156, 146, 158, 158, 154, 174, 158, 162, 162, 162, 166, 162, 152, 164, 150, 158, 154, 158, 142, 156, 158, 146, 158, 150, 156, 160, 142, 168, 146, 166, 172, 156, 156, 166, 174, 148, 172, 154, 154, 170, 146, 158, 156, 152, 154, 138}, + {160, 162, 154, 162, 172, 146, 158, 160, 144, 158, 140, 158, 154, 152, 152, 150, 150, 154, 158, 148, 162, 160, 154, 164, 154, 160, 156, 162, 164, 160, 156, 168, 154, 158, 142, 170, 144, 150, 164, 134, 158, 154, 152, 162, 150, 164, 158, 164, 160, 170, 160, 154, 168, 154, 156, 162, 156, 162, 162, 148, 150, 154, 152, 162, 150, 150, 156, 150, 150, 168, 154, 156, 170, 148, 166, 156, 160, 172, 152, 166, 170, 150, 154, 162, 150, 142, 158, 146, 154, 160, 148, 154, 150, 158, 162, 150, 166, 164, 160, 156, 168, 160, 150, 176, 156, 142, 170, 140, 166, 148, 146, 154, 144, 156, 156, 154, 150, 158, 158, 150, 160, 160, 160, 160, 146, 166, 150, 144, 152, 140, 150, 142, 150, 140, 150, 142, 138, 156, 144, 150, 164, 144, 162, 156, 148, 164, 154, 158, 158, 146, 152, 158, 156, 140, 148, 148, 146, 146, 138, 150, 144, 138, 152, 144, 154, 146, 164, 154, 158, 152, 160, 162, 158, 152, 160, 148, 156, 158, 140, 146, 150, 146, 146, 142, 140, 156, 142, 140, 146, 150, 156, 160, 152, 156, 168, 152, 164, 156, 160, 158, 160, 166, 156, 160, 152, 162, 164, 152, 166, 144, 148, 160, 142, 154, 150, 160, 156, 160, 156, 156, 164, 152, 172, 158, 156, 174, 150, 164, 160, 154, 158, 146, 154, 150, 150, 150, 146, 154, 148, 158, 152, 152, 164, 156, 154, 164, 154, 162, 158, 166, 160, 162, 160, 158, 152, 152, 164, 146, 150, 160, 142, 158, 160, 142, 168, 148, 156, 164, 150, 158, 162, 156, 154, 162, 158, 158, 166, 162, 154, 164, 148, 162, 146, 154, 148, 148, 146, 156, 152, 144, 160, 160, 150, 174, 148, 164, 164, 156, 164, 152, 160, 160, 152, 156, 166, 154, 150, 156, 146, 152, 160, 152, 154, 152, 150, 164, 152, 152, 162, 148, 162, 170, 160, 156, 166, 162, 154, 166, 146, 156, 162, 142, 154, 148, 142, 156, 148, 156, 150, 158, 152, 158, 156, 158, 166, 156, 166, 160, 150, 170, 156, 152, 158, 148, 156, 156, 152, 144, 154, 154}, + {160, 166, 164, 156, 158, 164, 154, 160, 148, 156, 150, 158, 150, 140, 158, 160, 148, 158, 154, 164, 152, 166, 160, 166, 168, 156, 162, 156, 162, 164, 152, 150, 162, 152, 158, 146, 154, 144, 150, 154, 154, 152, 152, 158, 158, 152, 160, 160, 158, 168, 152, 164, 156, 166, 162, 158, 158, 152, 146, 158, 152, 150, 150, 154, 142, 158, 156, 150, 156, 148, 162, 160, 158, 164, 164, 164, 158, 160, 164, 148, 158, 152, 156, 158, 152, 152, 152, 154, 152, 152, 150, 158, 156, 148, 162, 150, 162, 166, 154, 166, 166, 154, 172, 160, 152, 166, 152, 158, 152, 154, 148, 156, 148, 146, 156, 148, 154, 158, 156, 158, 162, 154, 156, 158, 158, 158, 156, 152, 152, 150, 144, 154, 130, 150, 146, 138, 148, 148, 148, 148, 152, 152, 154, 158, 162, 162, 154, 156, 164, 158, 158, 156, 148, 152, 152, 134, 146, 140, 148, 138, 148, 142, 144, 150, 148, 164, 136, 158, 158, 150, 162, 162, 156, 160, 158, 154, 152, 150, 148, 148, 142, 136, 148, 134, 156, 142, 138, 154, 152, 148, 152, 156, 160, 150, 156, 160, 160, 160, 168, 170, 150, 164, 170, 148, 162, 152, 144, 152, 152, 148, 154, 150, 154, 152, 150, 152, 160, 150, 162, 162, 156, 170, 154, 156, 162, 160, 164, 156, 150, 160, 158, 158, 152, 160, 148, 152, 160, 140, 156, 154, 150, 158, 150, 158, 158, 164, 166, 164, 160, 156, 168, 148, 154, 162, 150, 158, 152, 152, 146, 148, 158, 150, 150, 150, 156, 154, 152, 160, 154, 164, 166, 154, 166, 162, 160, 166, 156, 154, 154, 150, 158, 156, 156, 150, 156, 144, 150, 158, 146, 164, 156, 152, 158, 158, 162, 166, 162, 156, 168, 164, 160, 164, 152, 156, 154, 146, 164, 148, 150, 144, 152, 150, 146, 158, 152, 158, 160, 162, 158, 160, 162, 162, 156, 168, 160, 154, 162, 152, 156, 152, 158, 154, 160, 148, 150, 156, 146, 158, 158, 146, 164, 158, 148, 164, 162, 164, 154, 164, 162, 158, 166, 160, 160, 154, 158, 154, 146, 160, 152, 142}, + {164, 158, 162, 164, 152, 164, 160, 148, 168, 156, 150, 146, 158, 148, 142, 154, 152, 146, 158, 152, 160, 142, 168, 158, 150, 168, 170, 160, 156, 168, 160, 150, 158, 154, 154, 148, 158, 152, 146, 158, 156, 140, 162, 150, 150, 156, 160, 156, 158, 158, 172, 160, 162, 162, 162, 146, 154, 162, 152, 160, 152, 148, 148, 158, 148, 146, 154, 156, 160, 160, 158, 156, 152, 164, 166, 148, 168, 166, 152, 164, 154, 154, 158, 152, 150, 154, 144, 154, 156, 142, 154, 156, 146, 164, 156, 154, 158, 166, 162, 158, 154, 170, 158, 156, 158, 158, 148, 160, 158, 146, 158, 154, 146, 158, 144, 156, 148, 156, 152, 156, 158, 160, 166, 150, 154, 160, 146, 162, 154, 140, 146, 146, 148, 142, 150, 138, 152, 142, 146, 154, 144, 164, 156, 146, 166, 162, 160, 150, 158, 150, 150, 164, 150, 148, 148, 152, 144, 142, 142, 154, 138, 150, 142, 146, 156, 156, 156, 156, 166, 158, 162, 164, 152, 160, 150, 158, 150, 148, 152, 152, 136, 150, 146, 150, 132, 152, 144, 142, 146, 156, 152, 150, 150, 164, 150, 170, 160, 160, 156, 166, 170, 154, 166, 160, 152, 162, 152, 158, 144, 164, 148, 144, 158, 156, 146, 152, 158, 154, 148, 160, 162, 158, 164, 164, 160, 158, 166, 172, 146, 158, 154, 150, 156, 156, 152, 138, 150, 162, 144, 154, 152, 158, 156, 160, 152, 154, 164, 160, 156, 168, 166, 162, 162, 156, 160, 162, 152, 158, 156, 142, 154, 156, 146, 154, 162, 144, 156, 154, 154, 164, 166, 162, 164, 160, 162, 160, 168, 152, 164, 150, 158, 158, 146, 150, 156, 152, 152, 150, 152, 148, 154, 154, 158, 150, 162, 168, 152, 164, 166, 154, 170, 162, 156, 154, 158, 158, 142, 164, 152, 154, 146, 154, 156, 144, 160, 154, 146, 152, 168, 152, 158, 172, 156, 158, 168, 160, 156, 166, 156, 162, 142, 152, 152, 144, 156, 152, 154, 144, 160, 154, 150, 164, 162, 156, 158, 156, 164, 154, 162, 162, 156, 160, 164, 148, 152, 156, 158, 144, 152, 154}, + {164, 152, 160, 164, 160, 148, 166, 154, 152, 158, 158, 150, 144, 160, 158, 146, 162, 160, 144, 160, 158, 158, 156, 170, 168, 146, 160, 168, 154, 158, 162, 160, 142, 160, 158, 148, 150, 158, 146, 140, 158, 160, 144, 170, 156, 164, 144, 174, 166, 148, 168, 158, 154, 164, 168, 160, 150, 154, 156, 144, 162, 150, 154, 138, 160, 152, 148, 156, 152, 146, 160, 164, 164, 148, 172, 164, 156, 162, 160, 158, 164, 156, 156, 146, 160, 154, 148, 148, 156, 156, 142, 160, 154, 148, 158, 164, 154, 158, 170, 158, 154, 158, 166, 158, 150, 168, 156, 148, 160, 158, 142, 148, 158, 146, 156, 152, 156, 144, 162, 156, 152, 162, 162, 160, 156, 156, 162, 142, 154, 158, 138, 144, 150, 138, 138, 154, 142, 140, 148, 154, 148, 146, 160, 154, 144, 162, 168, 162, 156, 164, 164, 136, 162, 156, 138, 148, 148, 146, 140, 144, 146, 140, 152, 148, 140, 150, 152, 152, 146, 162, 158, 154, 166, 162, 152, 152, 164, 152, 142, 150, 158, 144, 142, 142, 150, 132, 152, 148, 142, 154, 158, 152, 156, 158, 162, 150, 168, 158, 158, 158, 160, 162, 152, 164, 156, 144, 162, 166, 148, 144, 162, 146, 140, 156, 162, 146, 162, 160, 166, 144, 160, 170, 144, 172, 166, 154, 154, 164, 164, 148, 166, 146, 150, 154, 156, 154, 140, 152, 160, 140, 166, 156, 148, 156, 174, 156, 156, 170, 162, 156, 156, 162, 162, 148, 154, 154, 142, 160, 154, 154, 142, 162, 152, 142, 158, 164, 150, 156, 164, 150, 148, 170, 158, 154, 168, 164, 154, 160, 162, 156, 148, 154, 156, 148, 146, 154, 154, 148, 152, 158, 146, 156, 158, 156, 160, 166, 168, 152, 160, 164, 152, 156, 164, 154, 148, 162, 158, 144, 156, 152, 144, 152, 158, 152, 142, 162, 160, 150, 156, 166, 160, 154, 166, 162, 156, 168, 160, 146, 160, 158, 156, 154, 152, 152, 148, 154, 150, 152, 140, 162, 156, 144, 160, 164, 162, 162, 168, 166, 152, 170, 166, 146, 158, 158, 160, 146, 156, 160, 148, 150}, + {174, 166, 152, 164, 168, 162, 142, 164, 166, 140, 154, 152, 146, 142, 156, 152, 136, 158, 164, 142, 160, 164, 160, 152, 166, 158, 160, 164, 174, 156, 152, 166, 158, 146, 164, 160, 142, 148, 156, 146, 148, 152, 158, 130, 164, 158, 154, 148, 174, 166, 142, 176, 166, 152, 164, 162, 164, 150, 164, 160, 134, 160, 152, 148, 144, 164, 154, 138, 168, 160, 148, 160, 160, 164, 150, 162, 168, 144, 170, 166, 152, 152, 164, 160, 142, 162, 154, 148, 142, 156, 160, 138, 162, 162, 144, 160, 164, 150, 160, 170, 158, 154, 166, 170, 152, 156, 158, 152, 146, 164, 150, 150, 156, 148, 140, 152, 156, 158, 148, 162, 166, 148, 162, 164, 158, 148, 158, 160, 140, 148, 156, 136, 146, 154, 148, 130, 152, 144, 142, 144, 162, 150, 154, 164, 158, 140, 170, 158, 148, 158, 160, 162, 140, 160, 148, 136, 148, 144, 144, 138, 152, 146, 140, 148, 158, 146, 158, 164, 152, 150, 164, 166, 152, 162, 156, 152, 152, 160, 156, 134, 144, 146, 142, 144, 154, 144, 130, 156, 152, 132, 162, 154, 154, 152, 150, 168, 152, 168, 166, 158, 162, 170, 158, 150, 170, 156, 148, 156, 162, 146, 148, 162, 146, 144, 156, 160, 140, 160, 158, 156, 150, 172, 170, 142, 162, 172, 152, 164, 162, 164, 146, 166, 154, 146, 156, 156, 144, 150, 150, 164, 140, 162, 160, 156, 150, 172, 164, 150, 170, 168, 150, 166, 174, 156, 154, 162, 162, 142, 160, 148, 150, 140, 158, 158, 134, 158, 156, 152, 158, 168, 164, 154, 170, 162, 146, 170, 168, 154, 160, 156, 164, 144, 162, 154, 148, 154, 154, 148, 144, 164, 158, 150, 162, 166, 148, 152, 174, 162, 158, 168, 164, 156, 156, 170, 158, 150, 156, 160, 138, 156, 158, 142, 148, 158, 158, 148, 158, 160, 150, 166, 166, 164, 156, 174, 160, 150, 162, 170, 154, 152, 164, 146, 146, 166, 152, 142, 154, 154, 152, 148, 158, 158, 146, 160, 164, 152, 160, 166, 164, 154, 162, 170, 146, 162, 154, 154, 148, 162, 146, 144}, + {150, 170, 162, 152, 164, 168, 158, 146, 156, 168, 140, 166, 162, 142, 146, 154, 158, 140, 160, 160, 146, 154, 162, 164, 146, 180, 160, 146, 162, 170, 156, 152, 156, 158, 142, 156, 154, 152, 150, 162, 146, 148, 164, 166, 142, 160, 164, 154, 156, 170, 160, 152, 160, 168, 146, 158, 164, 154, 144, 162, 164, 140, 156, 162, 142, 146, 154, 162, 146, 156, 160, 148, 164, 170, 162, 160, 168, 172, 144, 168, 166, 148, 152, 162, 156, 136, 160, 158, 144, 152, 156, 156, 146, 156, 160, 148, 164, 172, 152, 158, 166, 164, 154, 160, 164, 148, 166, 158, 154, 144, 164, 154, 134, 158, 158, 146, 152, 156, 162, 144, 162, 160, 148, 162, 160, 150, 152, 160, 162, 136, 150, 156, 136, 136, 152, 144, 134, 156, 140, 138, 156, 160, 140, 144, 166, 170, 142, 174, 162, 148, 152, 158, 156, 144, 156, 150, 132, 154, 148, 140, 140, 152, 148, 134, 152, 160, 138, 154, 162, 160, 146, 170, 154, 144, 162, 156, 148, 150, 156, 152, 134, 152, 148, 126, 146, 148, 148, 138, 150, 158, 142, 160, 156, 152, 156, 170, 162, 144, 172, 166, 146, 164, 164, 158, 150, 160, 162, 144, 156, 150, 146, 144, 170, 150, 134, 160, 162, 142, 158, 166, 158, 156, 162, 168, 158, 160, 166, 150, 154, 162, 160, 138, 166, 160, 136, 152, 164, 144, 148, 150, 154, 140, 158, 156, 154, 154, 176, 158, 142, 172, 166, 150, 156, 166, 150, 152, 164, 154, 138, 160, 156, 140, 148, 162, 160, 142, 168, 160, 140, 156, 164, 160, 150, 166, 172, 144, 162, 168, 150, 158, 152, 158, 144, 160, 150, 146, 152, 156, 156, 140, 160, 158, 142, 162, 166, 158, 160, 164, 162, 144, 170, 166, 144, 156, 160, 156, 146, 158, 158, 136, 154, 160, 140, 154, 154, 150, 146, 162, 160, 152, 168, 160, 166, 150, 172, 162, 152, 160, 156, 144, 154, 164, 154, 138, 154, 162, 136, 158, 156, 144, 160, 158, 160, 142, 174, 156, 154, 162, 168, 158, 150, 170, 164, 140, 170, 146, 150, 148, 158, 148}, + {170, 144, 178, 164, 146, 164, 164, 152, 150, 158, 154, 138, 156, 156, 142, 146, 154, 164, 134, 162, 166, 138, 162, 168, 162, 150, 168, 168, 146, 168, 162, 156, 154, 164, 160, 136, 166, 148, 138, 154, 156, 152, 140, 154, 158, 144, 164, 160, 158, 150, 176, 166, 146, 172, 178, 142, 154, 170, 148, 142, 160, 154, 140, 150, 152, 144, 158, 154, 156, 140, 166, 166, 142, 172, 162, 154, 160, 158, 166, 150, 158, 158, 152, 152, 160, 160, 132, 162, 156, 138, 152, 160, 142, 160, 166, 156, 138, 168, 166, 150, 166, 174, 164, 150, 176, 156, 138, 166, 154, 152, 148, 154, 156, 134, 150, 162, 144, 156, 156, 162, 148, 164, 168, 154, 158, 166, 146, 152, 152, 164, 134, 150, 146, 140, 144, 148, 150, 134, 160, 154, 128, 160, 164, 164, 150, 154, 162, 146, 166, 160, 148, 156, 158, 154, 134, 162, 148, 136, 152, 156, 136, 136, 156, 142, 136, 160, 154, 144, 156, 164, 156, 154, 170, 166, 140, 164, 168, 146, 152, 156, 148, 134, 152, 150, 136, 150, 142, 146, 134, 154, 158, 136, 166, 162, 148, 152, 162, 168, 154, 168, 168, 146, 166, 170, 160, 148, 162, 164, 134, 170, 154, 146, 142, 160, 158, 140, 166, 154, 154, 156, 158, 158, 150, 170, 168, 144, 180, 162, 158, 154, 158, 158, 140, 156, 158, 148, 146, 160, 146, 150, 164, 162, 140, 166, 166, 150, 154, 170, 168, 152, 160, 170, 148, 164, 160, 154, 142, 168, 158, 134, 162, 160, 140, 150, 156, 156, 142, 166, 156, 150, 166, 164, 162, 156, 172, 168, 150, 166, 166, 148, 162, 160, 152, 138, 158, 154, 134, 156, 154, 150, 150, 156, 160, 142, 162, 172, 148, 164, 170, 166, 152, 166, 170, 140, 158, 156, 158, 144, 164, 160, 136, 154, 162, 138, 162, 156, 160, 148, 164, 158, 146, 170, 162, 154, 158, 176, 166, 146, 174, 158, 150, 154, 164, 150, 142, 158, 148, 140, 158, 158, 142, 144, 174, 162, 150, 172, 166, 150, 162, 180, 156, 160, 160, 162, 136, 168, 162, 148, 154, 156}, + {166, 162, 150, 166, 164, 148, 160, 164, 156, 148, 164, 162, 136, 156, 166, 142, 150, 156, 152, 146, 156, 164, 142, 166, 156, 164, 148, 174, 168, 140, 168, 170, 144, 160, 150, 166, 134, 168, 150, 140, 158, 150, 154, 148, 160, 168, 138, 174, 168, 150, 160, 166, 162, 150, 160, 166, 152, 156, 162, 158, 140, 166, 162, 126, 168, 152, 140, 150, 158, 166, 136, 166, 158, 148, 164, 168, 158, 156, 172, 170, 144, 170, 156, 152, 156, 160, 148, 138, 156, 154, 138, 156, 164, 148, 144, 166, 166, 140, 176, 164, 146, 160, 168, 162, 150, 162, 162, 144, 166, 156, 148, 148, 156, 158, 138, 164, 162, 142, 160, 154, 148, 154, 164, 162, 142, 168, 160, 148, 152, 154, 148, 132, 156, 154, 128, 148, 148, 146, 130, 150, 156, 138, 154, 156, 154, 154, 164, 174, 140, 172, 164, 146, 162, 154, 152, 138, 146, 148, 132, 144, 144, 144, 140, 154, 154, 134, 166, 164, 138, 158, 170, 154, 156, 162, 156, 146, 160, 156, 142, 140, 154, 150, 132, 150, 158, 122, 156, 158, 138, 142, 162, 156, 136, 158, 164, 148, 170, 160, 166, 144, 168, 172, 138, 164, 164, 152, 154, 156, 162, 130, 160, 152, 144, 150, 152, 158, 132, 168, 162, 140, 170, 162, 156, 160, 156, 168, 142, 172, 160, 152, 158, 160, 162, 144, 160, 154, 134, 162, 156, 146, 146, 160, 162, 138, 172, 152, 154, 154, 170, 164, 144, 172, 174, 142, 166, 162, 150, 146, 162, 154, 136, 150, 150, 146, 152, 152, 162, 142, 168, 160, 142, 170, 162, 156, 152, 166, 162, 150, 162, 162, 144, 160, 158, 162, 138, 160, 162, 130, 158, 160, 150, 158, 162, 156, 144, 166, 162, 142, 168, 162, 162, 152, 178, 162, 144, 170, 154, 148, 150, 150, 156, 140, 158, 156, 138, 156, 160, 158, 142, 164, 172, 142, 174, 164, 156, 154, 164, 166, 136, 164, 158, 144, 144, 162, 154, 138, 164, 164, 130, 162, 166, 150, 150, 156, 158, 152, 172, 162, 150, 160, 164, 156, 150, 164, 168, 136, 162, 166, 134, 150}, + {162, 162, 170, 144, 178, 174, 140, 162, 164, 150, 146, 166, 148, 142, 152, 144, 148, 150, 160, 162, 142, 166, 170, 142, 174, 172, 152, 158, 172, 156, 148, 162, 164, 146, 160, 148, 164, 136, 160, 166, 128, 164, 160, 142, 148, 162, 158, 134, 180, 160, 154, 164, 162, 168, 152, 164, 166, 140, 162, 162, 142, 148, 156, 154, 136, 160, 154, 150, 158, 150, 172, 146, 166, 170, 146, 168, 160, 154, 160, 164, 170, 146, 164, 152, 148, 152, 156, 160, 136, 164, 162, 128, 160, 158, 152, 154, 160, 162, 152, 166, 164, 150, 164, 166, 166, 148, 170, 160, 138, 164, 164, 144, 150, 148, 160, 136, 154, 156, 144, 158, 168, 162, 148, 176, 166, 134, 168, 156, 150, 158, 154, 140, 138, 146, 146, 132, 146, 148, 148, 134, 162, 164, 136, 170, 152, 146, 164, 150, 172, 144, 162, 156, 138, 162, 152, 146, 140, 150, 152, 128, 160, 146, 136, 142, 152, 148, 136, 164, 158, 142, 154, 162, 170, 144, 168, 168, 138, 166, 162, 148, 148, 148, 144, 136, 148, 152, 132, 142, 142, 146, 140, 162, 166, 136, 164, 164, 146, 166, 172, 158, 156, 166, 166, 150, 166, 158, 154, 154, 158, 162, 136, 158, 162, 136, 160, 156, 148, 140, 166, 162, 138, 170, 160, 158, 158, 166, 180, 140, 168, 166, 142, 168, 148, 158, 144, 160, 152, 136, 160, 148, 150, 150, 158, 166, 140, 170, 178, 152, 164, 166, 164, 148, 164, 168, 144, 160, 162, 152, 148, 156, 164, 132, 164, 154, 142, 160, 152, 160, 146, 160, 166, 150, 170, 166, 156, 160, 166, 170, 140, 170, 164, 142, 158, 156, 152, 142, 150, 160, 142, 154, 156, 148, 142, 166, 172, 138, 178, 176, 140, 172, 166, 160, 148, 164, 158, 140, 166, 150, 146, 148, 158, 154, 130, 164, 168, 138, 166, 160, 152, 160, 162, 164, 146, 176, 164, 156, 160, 162, 166, 138, 174, 154, 138, 164, 156, 146, 140, 156, 160, 136, 160, 154, 148, 154, 168, 164, 142, 176, 176, 144, 172, 168, 160, 148, 160, 160, 142, 158, 154, 148}, + {146, 166, 164, 158, 146, 170, 168, 142, 156, 162, 150, 142, 160, 164, 128, 172, 156, 138, 158, 152, 158, 138, 162, 164, 146, 170, 160, 166, 150, 172, 176, 142, 168, 162, 144, 162, 156, 152, 144, 148, 154, 138, 158, 150, 154, 146, 168, 168, 138, 176, 166, 148, 168, 166, 156, 158, 162, 162, 148, 162, 158, 148, 146, 154, 158, 134, 158, 160, 138, 168, 148, 156, 154, 160, 170, 146, 172, 162, 156, 156, 164, 164, 142, 170, 162, 140, 158, 154, 154, 136, 154, 160, 138, 162, 156, 158, 148, 160, 170, 136, 178, 172, 142, 174, 166, 156, 146, 160, 162, 144, 154, 152, 146, 150, 154, 158, 136, 170, 162, 132, 160, 162, 154, 154, 162, 164, 144, 164, 156, 142, 142, 162, 150, 130, 158, 152, 126, 156, 152, 134, 136, 160, 158, 138, 164, 162, 144, 162, 166, 162, 144, 172, 164, 130, 170, 150, 136, 144, 154, 146, 122, 158, 142, 146, 144, 150, 164, 134, 164, 166, 138, 170, 162, 154, 150, 162, 154, 140, 158, 156, 134, 148, 144, 148, 132, 148, 154, 130, 158, 152, 144, 146, 156, 162, 138, 168, 164, 148, 162, 164, 166, 142, 174, 170, 140, 164, 164, 144, 150, 156, 158, 138, 154, 148, 142, 154, 160, 160, 140, 158, 170, 140, 176, 162, 162, 164, 156, 168, 144, 164, 160, 142, 162, 152, 154, 136, 160, 166, 130, 164, 160, 142, 158, 156, 156, 144, 162, 156, 150, 164, 154, 168, 148, 168, 166, 142, 170, 162, 142, 158, 146, 156, 136, 156, 160, 138, 162, 148, 168, 148, 156, 172, 142, 172, 162, 156, 162, 168, 170, 138, 160, 162, 148, 148, 154, 156, 134, 162, 160, 132, 164, 154, 148, 154, 156, 168, 150, 160, 170, 144, 162, 166, 162, 150, 170, 160, 138, 176, 160, 142, 158, 154, 150, 138, 158, 158, 140, 152, 164, 150, 154, 172, 168, 134, 174, 170, 150, 170, 160, 154, 144, 166, 164, 128, 156, 152, 148, 150, 156, 168, 130, 168, 166, 146, 158, 168, 166, 148, 160, 162, 148, 164, 160, 158, 154, 156, 166, 134, 170, 158}, + {166, 148, 162, 170, 166, 146, 172, 164, 146, 174, 156, 144, 150, 160, 152, 128, 158, 154, 146, 160, 156, 166, 146, 162, 172, 138, 174, 164, 150, 166, 162, 168, 138, 164, 162, 144, 152, 154, 154, 136, 160, 166, 128, 170, 152, 156, 146, 160, 162, 148, 172, 156, 152, 162, 162, 164, 146, 158, 164, 132, 168, 160, 144, 152, 158, 152, 138, 158, 160, 136, 162, 154, 166, 150, 168, 178, 140, 174, 166, 152, 162, 164, 154, 142, 162, 148, 146, 154, 146, 154, 146, 152, 164, 134, 168, 160, 144, 162, 166, 164, 158, 160, 174, 140, 164, 162, 162, 150, 154, 168, 132, 168, 156, 142, 154, 152, 156, 132, 160, 170, 144, 166, 154, 166, 150, 162, 164, 140, 166, 156, 138, 148, 150, 142, 130, 148, 144, 138, 144, 150, 154, 142, 156, 166, 134, 172, 162, 152, 168, 160, 158, 142, 158, 160, 134, 156, 150, 140, 140, 154, 150, 126, 156, 148, 134, 158, 154, 144, 148, 164, 166, 134, 174, 162, 156, 144, 166, 166, 136, 168, 154, 132, 160, 144, 142, 140, 146, 144, 134, 150, 148, 158, 154, 150, 172, 142, 168, 170, 144, 172, 162, 156, 156, 164, 168, 150, 156, 160, 156, 144, 158, 164, 126, 168, 160, 136, 160, 148, 166, 154, 158, 164, 148, 168, 154, 158, 152, 168, 180, 144, 172, 162, 136, 166, 170, 142, 146, 150, 152, 138, 154, 160, 148, 146, 166, 170, 140, 176, 170, 144, 180, 160, 162, 150, 162, 158, 140, 160, 150, 146, 152, 152, 164, 134, 160, 164, 134, 164, 158, 146, 162, 162, 164, 144, 176, 158, 152, 156, 158, 170, 144, 162, 158, 138, 166, 158, 142, 142, 154, 168, 132, 170, 156, 152, 152, 152, 170, 148, 170, 172, 146, 176, 164, 156, 144, 168, 158, 132, 162, 154, 138, 150, 160, 154, 140, 160, 166, 136, 166, 172, 150, 156, 168, 164, 152, 166, 158, 154, 160, 162, 160, 144, 158, 170, 138, 162, 158, 142, 152, 150, 152, 140, 162, 158, 142, 174, 158, 168, 154, 172, 180, 142, 178, 160, 146, 162, 154, 156, 136, 160}, + {174, 172, 142, 170, 162, 156, 152, 164, 160, 140, 152, 156, 150, 144, 156, 168, 138, 152, 160, 140, 166, 156, 152, 162, 156, 170, 148, 170, 164, 152, 156, 152, 174, 142, 164, 166, 134, 162, 158, 146, 144, 156, 154, 138, 156, 150, 164, 154, 158, 176, 140, 170, 170, 144, 176, 160, 166, 156, 160, 162, 140, 160, 152, 146, 150, 152, 158, 134, 168, 168, 132, 170, 160, 148, 156, 162, 164, 146, 166, 174, 154, 150, 164, 162, 142, 162, 164, 136, 168, 150, 144, 148, 154, 160, 134, 170, 160, 144, 164, 160, 164, 148, 162, 178, 146, 178, 154, 148, 152, 164, 158, 142, 156, 154, 142, 148, 152, 164, 138, 158, 166, 138, 172, 158, 156, 156, 154, 162, 136, 164, 162, 136, 150, 142, 154, 134, 152, 150, 128, 154, 148, 144, 150, 160, 166, 134, 164, 156, 154, 160, 158, 162, 146, 158, 166, 134, 158, 152, 132, 142, 154, 148, 132, 146, 148, 138, 152, 154, 162, 140, 160, 170, 140, 180, 158, 154, 160, 160, 150, 138, 150, 150, 134, 146, 140, 148, 134, 154, 158, 126, 158, 154, 140, 168, 150, 156, 154, 166, 164, 150, 166, 164, 166, 154, 162, 170, 140, 168, 160, 140, 156, 158, 148, 130, 156, 152, 142, 162, 144, 164, 146, 160, 176, 140, 180, 166, 152, 166, 158, 168, 142, 158, 166, 140, 150, 158, 150, 144, 152, 168, 130, 170, 160, 148, 156, 160, 160, 152, 170, 162, 142, 166, 166, 166, 152, 170, 160, 144, 166, 164, 138, 156, 148, 156, 136, 154, 160, 140, 158, 164, 156, 158, 162, 176, 138, 176, 170, 146, 176, 158, 150, 146, 170, 154, 130, 162, 152, 148, 144, 148, 168, 132, 166, 160, 144, 174, 158, 166, 156, 158, 168, 146, 170, 164, 162, 152, 152, 172, 136, 162, 154, 140, 156, 156, 148, 146, 158, 162, 140, 156, 160, 162, 144, 170, 170, 138, 176, 170, 144, 162, 160, 154, 150, 152, 150, 144, 146, 150, 154, 146, 154, 168, 138, 168, 160, 144, 172, 162, 154, 158, 162, 164, 144, 166, 150, 154, 152, 160, 164, 130}, + {150, 166, 156, 154, 172, 152, 180, 142, 162, 170, 138, 172, 162, 142, 158, 146, 144, 146, 158, 156, 142, 156, 154, 160, 150, 170, 176, 136, 172, 168, 150, 176, 164, 150, 150, 154, 162, 136, 156, 146, 156, 140, 154, 166, 142, 170, 158, 142, 168, 160, 160, 156, 160, 176, 146, 164, 158, 154, 148, 156, 172, 134, 170, 154, 138, 152, 152, 150, 142, 156, 168, 138, 164, 160, 166, 154, 164, 172, 142, 174, 168, 148, 170, 160, 156, 146, 158, 148, 138, 154, 152, 152, 142, 158, 168, 134, 164, 162, 146, 170, 166, 160, 158, 164, 164, 142, 168, 160, 156, 154, 154, 162, 130, 160, 162, 134, 164, 156, 146, 150, 160, 160, 138, 170, 160, 154, 154, 156, 174, 134, 158, 156, 128, 162, 140, 136, 138, 150, 146, 134, 154, 142, 150, 146, 148, 178, 142, 168, 172, 146, 172, 154, 146, 154, 158, 156, 132, 146, 148, 144, 134, 144, 152, 130, 152, 154, 138, 164, 146, 160, 154, 154, 164, 150, 162, 156, 156, 148, 150, 172, 134, 156, 150, 130, 160, 144, 134, 144, 150, 152, 134, 156, 152, 150, 148, 160, 168, 138, 172, 176, 140, 174, 158, 152, 156, 158, 160, 144, 154, 160, 152, 144, 156, 166, 144, 156, 160, 134, 174, 158, 148, 160, 162, 166, 144, 170, 160, 156, 162, 154, 166, 146, 158, 164, 134, 170, 160, 142, 148, 146, 160, 128, 162, 154, 148, 158, 154, 168, 144, 170, 180, 138, 178, 158, 154, 148, 166, 156, 140, 158, 154, 144, 148, 152, 162, 136, 164, 168, 138, 166, 156, 152, 164, 162, 164, 148, 168, 164, 152, 158, 164, 158, 146, 162, 162, 134, 166, 152, 144, 154, 154, 154, 140, 162, 156, 140, 170, 158, 166, 148, 164, 178, 136, 174, 160, 144, 168, 152, 152, 142, 158, 150, 146, 152, 144, 160, 142, 160, 170, 140, 172, 160, 150, 168, 168, 166, 144, 166, 166, 152, 156, 150, 164, 142, 158, 164, 132, 172, 152, 138, 162, 148, 162, 148, 156, 164, 148, 158, 166, 166, 150, 164, 180, 140, 176, 160, 136, 162, 148, 158}, + {170, 148, 170, 170, 146, 178, 150, 162, 158, 162, 160, 134, 154, 152, 144, 152, 150, 160, 130, 162, 158, 140, 170, 166, 150, 156, 166, 166, 150, 158, 166, 150, 158, 158, 160, 146, 162, 164, 136, 166, 150, 144, 152, 150, 158, 136, 168, 158, 142, 160, 164, 172, 146, 162, 178, 144, 180, 160, 146, 160, 148, 162, 142, 152, 156, 142, 148, 160, 160, 148, 152, 168, 138, 172, 158, 154, 162, 162, 174, 142, 164, 166, 142, 154, 150, 164, 138, 160, 162, 130, 168, 160, 138, 156, 152, 166, 146, 162, 160, 156, 158, 168, 160, 150, 168, 176, 144, 172, 158, 142, 158, 154, 158, 140, 154, 152, 144, 154, 150, 166, 142, 162, 172, 136, 178, 158, 144, 168, 152, 154, 146, 148, 150, 136, 148, 144, 156, 136, 144, 160, 130, 162, 162, 144, 168, 146, 156, 156, 160, 162, 140, 168, 154, 154, 144, 154, 160, 130, 158, 146, 126, 154, 154, 140, 142, 146, 152, 142, 162, 150, 164, 150, 158, 174, 146, 170, 158, 146, 168, 146, 154, 134, 158, 142, 130, 152, 142, 144, 138, 142, 160, 134, 170, 156, 144, 158, 164, 162, 150, 160, 166, 152, 164, 162, 168, 150, 162, 168, 140, 162, 160, 142, 158, 148, 142, 146, 156, 160, 134, 164, 156, 150, 160, 160, 176, 144, 176, 168, 148, 174, 160, 152, 150, 164, 162, 134, 154, 148, 146, 140, 158, 170, 138, 168, 166, 138, 178, 156, 162, 158, 160, 170, 142, 170, 160, 160, 150, 154, 174, 138, 160, 156, 140, 154, 152, 146, 144, 158, 162, 140, 162, 158, 164, 156, 164, 170, 144, 170, 174, 144, 168, 158, 152, 144, 160, 158, 142, 154, 148, 150, 142, 156, 172, 138, 158, 170, 146, 174, 162, 158, 162, 166, 162, 148, 166, 152, 158, 154, 154, 166, 138, 162, 154, 136, 172, 150, 142, 158, 150, 164, 138, 172, 164, 154, 162, 152, 174, 150, 166, 164, 146, 178, 148, 148, 152, 146, 150, 136, 156, 154, 150, 156, 146, 172, 144, 168, 174, 142, 176, 164, 156, 164, 158, 166, 136, 164, 158, 148, 152, 150}, + {162, 156, 152, 164, 166, 140, 166, 166, 150, 152, 156, 170, 146, 162, 156, 132, 164, 150, 158, 144, 162, 162, 142, 164, 156, 164, 152, 158, 176, 150, 172, 168, 148, 168, 154, 150, 144, 160, 150, 136, 154, 154, 148, 150, 152, 168, 138, 162, 168, 148, 174, 160, 160, 156, 162, 170, 140, 168, 162, 150, 166, 144, 166, 132, 160, 158, 136, 154, 156, 140, 158, 154, 162, 142, 168, 158, 160, 152, 156, 178, 152, 170, 166, 146, 178, 150, 146, 152, 150, 160, 130, 152, 152, 152, 154, 144, 170, 140, 164, 170, 152, 174, 158, 154, 162, 162, 164, 144, 154, 154, 152, 150, 148, 162, 136, 156, 158, 134, 168, 152, 148, 156, 156, 170, 148, 162, 158, 154, 156, 146, 168, 138, 152, 150, 130, 158, 138, 138, 152, 136, 148, 134, 148, 150, 148, 150, 164, 160, 148, 176, 176, 134, 172, 152, 146, 158, 148, 148, 138, 144, 156, 130, 140, 140, 152, 136, 150, 162, 138, 172, 152, 146, 160, 154, 164, 144, 162, 156, 146, 158, 152, 154, 136, 150, 156, 124, 164, 148, 132, 146, 152, 152, 138, 158, 160, 152, 158, 150, 174, 146, 164, 176, 138, 176, 162, 156, 164, 150, 162, 142, 158, 144, 142, 154, 152, 162, 138, 160, 170, 134, 170, 162, 150, 168, 164, 160, 146, 160, 172, 146, 158, 156, 160, 148, 150, 166, 136, 166, 156, 140, 154, 156, 156, 138, 160, 158, 142, 166, 158, 166, 154, 158, 178, 146, 176, 160, 146, 168, 142, 152, 144, 156, 150, 148, 152, 154, 154, 144, 156, 166, 142, 170, 162, 146, 168, 168, 164, 154, 158, 160, 146, 154, 148, 176, 138, 152, 160, 136, 164, 158, 138, 168, 146, 160, 156, 150, 160, 150, 162, 164, 166, 150, 164, 176, 146, 172, 158, 136, 168, 146, 154, 144, 154, 150, 140, 154, 150, 160, 142, 160, 172, 138, 176, 168, 148, 178, 158, 156, 156, 160, 156, 134, 168, 158, 154, 154, 152, 168, 132, 156, 156, 136, 170, 152, 154, 148, 168, 168, 138, 168, 162, 160, 154, 166, 178, 138, 168, 162, 140, 164}, + {162, 164, 172, 152, 164, 182, 148, 172, 160, 146, 168, 146, 154, 142, 152, 154, 140, 158, 146, 156, 144, 150, 176, 136, 174, 164, 150, 166, 164, 158, 144, 170, 162, 152, 158, 154, 170, 134, 158, 168, 132, 162, 158, 136, 162, 146, 164, 142, 156, 158, 154, 164, 160, 166, 150, 162, 180, 140, 166, 160, 140, 172, 148, 152, 146, 158, 150, 144, 152, 158, 162, 142, 152, 172, 142, 176, 162, 158, 172, 158, 156, 150, 158, 158, 140, 166, 150, 158, 152, 144, 172, 134, 160, 158, 136, 170, 160, 152, 158, 168, 160, 144, 170, 158, 166, 150, 158, 174, 142, 172, 158, 138, 168, 152, 144, 146, 148, 158, 138, 156, 158, 158, 148, 150, 176, 142, 170, 162, 138, 174, 142, 148, 144, 156, 142, 128, 152, 142, 144, 140, 144, 162, 142, 168, 158, 146, 164, 162, 156, 154, 158, 156, 144, 168, 148, 152, 146, 142, 152, 134, 148, 156, 130, 160, 150, 142, 142, 152, 154, 136, 170, 156, 156, 166, 160, 172, 138, 168, 168, 130, 168, 148, 142, 142, 148, 150, 124, 148, 148, 140, 142, 146, 164, 142, 156, 162, 140, 178, 148, 160, 160, 156, 176, 136, 174, 162, 154, 158, 150, 174, 138, 166, 156, 134, 172, 144, 150, 148, 156, 162, 138, 156, 158, 162, 152, 166, 176, 144, 168, 176, 146, 176, 152, 146, 158, 152, 156, 136, 154, 152, 146, 142, 150, 172, 140, 162, 168, 150, 176, 156, 152, 164, 164, 162, 150, 164, 154, 156, 160, 152, 170, 140, 156, 154, 136, 164, 156, 146, 160, 160, 154, 142, 170, 164, 154, 162, 156, 176, 152, 168, 170, 142, 174, 148, 146, 156, 152, 152, 142, 144, 154, 148, 154, 146, 168, 146, 168, 174, 146, 176, 154, 154, 164, 162, 160, 146, 162, 156, 144, 156, 144, 160, 136, 152, 162, 142, 172, 150, 150, 158, 158, 168, 146, 172, 156, 156, 162, 158, 178, 148, 164, 168, 136, 166, 156, 134, 158, 154, 148, 148, 150, 156, 144, 158, 156, 160, 148, 168, 180, 142, 176, 164, 152, 162, 150, 160, 146, 156, 160, 142}, + {142, 178, 160, 152, 158, 160, 166, 144, 162, 156, 152, 158, 152, 170, 134, 158, 162, 132, 166, 158, 146, 160, 150, 160, 146, 164, 162, 154, 158, 168, 170, 146, 166, 166, 142, 174, 148, 148, 158, 150, 160, 134, 148, 150, 152, 158, 144, 180, 142, 168, 168, 152, 182, 156, 156, 168, 156, 164, 148, 156, 154, 150, 148, 152, 156, 142, 156, 164, 134, 168, 154, 144, 160, 158, 168, 148, 162, 152, 158, 162, 154, 180, 144, 162, 166, 138, 170, 158, 140, 162, 142, 160, 146, 154, 150, 144, 150, 158, 164, 148, 164, 182, 142, 176, 162, 154, 170, 156, 156, 144, 164, 156, 136, 152, 152, 156, 146, 156, 164, 134, 164, 158, 152, 168, 160, 164, 144, 160, 160, 138, 158, 160, 148, 138, 152, 156, 126, 158, 146, 134, 150, 148, 148, 142, 158, 158, 142, 160, 158, 168, 148, 158, 172, 132, 172, 158, 146, 158, 144, 148, 132, 148, 140, 132, 144, 144, 154, 146, 154, 170, 136, 164, 158, 148, 170, 152, 156, 144, 152, 172, 132, 158, 140, 146, 138, 142, 160, 122, 154, 152, 134, 154, 150, 154, 148, 162, 156, 146, 170, 158, 166, 154, 158, 180, 144, 168, 160, 140, 174, 150, 154, 142, 158, 154, 134, 152, 146, 156, 144, 154, 178, 142, 168, 168, 152, 174, 152, 166, 154, 160, 158, 150, 160, 154, 166, 142, 150, 166, 138, 160, 158, 138, 172, 148, 156, 150, 156, 160, 146, 168, 164, 162, 158, 154, 174, 140, 168, 162, 134, 168, 146, 150, 148, 152, 148, 146, 148, 152, 158, 136, 166, 168, 140, 174, 168, 148, 174, 154, 156, 158, 160, 162, 140, 162, 152, 150, 144, 150, 168, 140, 154, 162, 138, 174, 152, 154, 156, 158, 168, 142, 172, 168, 160, 154, 162, 168, 140, 162, 158, 140, 170, 152, 146, 148, 148, 152, 130, 160, 160, 150, 162, 144, 178, 144, 170, 170, 142, 174, 154, 160, 148, 162, 160, 142, 156, 154, 144, 146, 150, 162, 138, 162, 162, 146, 168, 158, 152, 158, 162, 166, 144, 162, 166, 158, 158, 154, 166, 144, 158, 162}, + {168, 148, 164, 168, 164, 152, 166, 182, 148, 170, 162, 140, 164, 146, 148, 142, 154, 156, 136, 150, 152, 154, 146, 158, 172, 146, 172, 168, 150, 174, 158, 164, 158, 158, 158, 140, 164, 150, 152, 152, 142, 166, 140, 156, 160, 138, 168, 148, 154, 152, 166, 158, 144, 168, 156, 164, 158, 158, 174, 144, 166, 158, 144, 164, 146, 144, 146, 152, 154, 140, 156, 160, 158, 152, 148, 184, 148, 178, 170, 142, 180, 152, 162, 150, 162, 160, 134, 158, 152, 148, 144, 140, 166, 136, 158, 162, 144, 168, 158, 152, 166, 162, 158, 150, 162, 158, 158, 160, 160, 168, 138, 164, 162, 138, 172, 148, 140, 148, 156, 162, 142, 164, 150, 152, 160, 160, 168, 146, 158, 170, 136, 166, 150, 136, 148, 144, 146, 132, 146, 146, 138, 142, 152, 158, 140, 158, 170, 140, 176, 154, 158, 158, 160, 162, 132, 162, 152, 142, 140, 138, 162, 130, 154, 152, 138, 154, 142, 144, 160, 150, 166, 142, 156, 160, 160, 164, 158, 166, 146, 154, 174, 130, 164, 144, 136, 152, 136, 150, 136, 146, 146, 142, 154, 150, 166, 140, 160, 170, 146, 178, 158, 156, 168, 166, 164, 154, 160, 164, 140, 158, 150, 166, 140, 154, 168, 136, 168, 150, 142, 164, 150, 156, 148, 164, 158, 152, 172, 148, 178, 148, 160, 172, 138, 172, 154, 146, 164, 146, 150, 144, 152, 152, 144, 152, 148, 170, 152, 158, 174, 148, 174, 158, 148, 180, 160, 168, 144, 164, 162, 138, 158, 146, 160, 140, 154, 164, 140, 164, 152, 156, 156, 160, 166, 150, 168, 152, 158, 168, 150, 174, 152, 154, 164, 146, 172, 156, 144, 166, 140, 150, 146, 148, 156, 140, 160, 156, 154, 156, 164, 176, 140, 176, 166, 148, 172, 162, 154, 154, 162, 158, 140, 148, 146, 152, 148, 150, 172, 138, 160, 160, 140, 184, 148, 170, 156, 156, 170, 146, 172, 160, 164, 150, 152, 170, 140, 168, 160, 140, 156, 150, 148, 144, 156, 158, 146, 152, 160, 166, 152, 160, 182, 148, 172, 168, 148, 168, 154, 156, 150, 146}, + {156, 170, 148, 172, 162, 154, 172, 152, 162, 146, 156, 158, 152, 156, 150, 160, 140, 152, 164, 136, 172, 160, 142, 156, 156, 168, 150, 160, 158, 156, 160, 148, 178, 150, 160, 168, 144, 170, 160, 142, 162, 148, 148, 148, 150, 152, 146, 162, 150, 166, 154, 162, 178, 146, 172, 162, 148, 170, 152, 156, 152, 162, 152, 138, 158, 150, 156, 142, 152, 168, 136, 164, 156, 148, 170, 156, 158, 160, 154, 170, 148, 168, 164, 164, 154, 150, 170, 142, 164, 154, 138, 162, 152, 158, 142, 156, 164, 142, 156, 162, 158, 152, 160, 184, 146, 172, 166, 150, 164, 150, 160, 144, 162, 148, 138, 154, 154, 154, 142, 150, 168, 140, 168, 162, 152, 174, 160, 152, 156, 154, 164, 136, 154, 142, 148, 140, 144, 158, 130, 150, 154, 136, 156, 156, 152, 152, 156, 156, 142, 162, 160, 158, 144, 158, 168, 134, 162, 150, 134, 168, 142, 136, 136, 148, 148, 136, 152, 144, 154, 150, 146, 178, 142, 164, 172, 146, 170, 150, 148, 156, 148, 154, 138, 144, 142, 142, 140, 138, 152, 134, 154, 154, 136, 166, 148, 154, 156, 156, 164, 148, 164, 162, 154, 152, 158, 178, 146, 164, 168, 138, 168, 150, 146, 150, 146, 152, 140, 154, 152, 150, 150, 158, 166, 144, 170, 170, 144, 180, 154, 160, 164, 158, 158, 142, 164, 154, 138, 150, 152, 164, 138, 156, 162, 142, 174, 154, 148, 158, 162, 162, 146, 170, 162, 152, 158, 164, 170, 142, 162, 162, 142, 166, 154, 144, 148, 146, 156, 138, 162, 160, 150, 156, 148, 174, 142, 180, 172, 140, 178, 164, 156, 156, 162, 156, 138, 158, 152, 140, 158, 148, 158, 142, 156, 166, 142, 168, 160, 150, 162, 160, 166, 144, 164, 168, 152, 152, 160, 164, 146, 152, 164, 142, 170, 152, 144, 156, 156, 160, 138, 158, 156, 144, 164, 156, 172, 150, 162, 182, 142, 172, 160, 148, 168, 150, 150, 140, 152, 150, 146, 146, 154, 158, 140, 156, 172, 144, 174, 162, 150, 170, 156, 164, 152, 156, 162, 160, 154, 142, 174, 144}, + {164, 160, 164, 150, 162, 158, 164, 156, 158, 172, 144, 160, 158, 138, 168, 150, 144, 154, 152, 154, 138, 152, 164, 148, 160, 144, 172, 152, 168, 174, 144, 184, 146, 156, 156, 160, 158, 134, 160, 148, 146, 152, 146, 166, 142, 158, 162, 140, 168, 164, 148, 166, 160, 160, 152, 162, 162, 152, 164, 156, 158, 142, 160, 166, 134, 172, 146, 144, 156, 148, 158, 138, 162, 160, 144, 160, 160, 168, 156, 162, 174, 146, 174, 154, 146, 170, 146, 158, 142, 154, 152, 140, 148, 148, 162, 142, 154, 172, 142, 174, 164, 152, 164, 154, 166, 148, 168, 162, 152, 158, 148, 170, 138, 156, 166, 136, 164, 154, 144, 160, 156, 158, 146, 152, 162, 152, 158, 158, 158, 146, 154, 168, 134, 158, 142, 132, 148, 142, 146, 134, 148, 144, 132, 150, 152, 166, 136, 158, 174, 148, 178, 158, 156, 170, 148, 158, 142, 156, 150, 126, 148, 144, 154, 136, 140, 158, 130, 154, 156, 138, 172, 148, 156, 152, 164, 162, 142, 172, 152, 162, 146, 150, 162, 134, 160, 148, 134, 156, 146, 142, 138, 148, 152, 144, 158, 150, 160, 148, 152, 176, 148, 176, 164, 156, 172, 154, 164, 148, 162, 164, 138, 164, 148, 156, 138, 148, 168, 136, 164, 158, 150, 162, 160, 164, 158, 162, 160, 154, 168, 152, 172, 156, 156, 170, 138, 164, 160, 140, 166, 148, 148, 144, 152, 158, 132, 160, 158, 160, 160, 160, 180, 142, 172, 168, 144, 170, 154, 154, 152, 160, 152, 140, 148, 148, 152, 146, 148, 168, 138, 162, 162, 142, 180, 156, 166, 152, 160, 174, 136, 172, 160, 160, 148, 152, 174, 138, 160, 154, 140, 160, 148, 152, 154, 152, 162, 142, 158, 158, 166, 158, 156, 182, 146, 168, 172, 152, 168, 150, 154, 154, 146, 158, 136, 156, 144, 148, 142, 152, 172, 140, 164, 168, 148, 176, 162, 156, 162, 160, 168, 152, 162, 150, 154, 152, 150, 170, 138, 162, 154, 138, 166, 154, 148, 156, 152, 158, 142, 168, 164, 154, 164, 156, 174, 150, 166, 162, 144, 178, 148, 148}, + {156, 156, 166, 176, 148, 168, 166, 148, 176, 154, 156, 150, 162, 158, 132, 160, 150, 148, 138, 156, 164, 140, 156, 170, 142, 174, 162, 156, 160, 158, 166, 144, 176, 166, 156, 158, 152, 170, 138, 166, 156, 136, 158, 148, 148, 144, 160, 164, 142, 154, 162, 164, 148, 164, 178, 146, 172, 174, 146, 170, 158, 152, 152, 154, 154, 138, 154, 152, 148, 146, 154, 174, 138, 162, 168, 146, 178, 160, 156, 156, 166, 168, 142, 162, 158, 154, 156, 150, 166, 134, 164, 156, 140, 166, 154, 146, 154, 152, 154, 142, 162, 160, 164, 164, 158, 174, 146, 170, 162, 142, 180, 152, 148, 152, 150, 154, 138, 146, 148, 158, 150, 144, 174, 142, 162, 172, 148, 174, 154, 150, 156, 156, 154, 138, 150, 150, 142, 138, 140, 158, 130, 152, 160, 138, 164, 148, 154, 158, 152, 162, 148, 158, 156, 148, 156, 146, 172, 132, 152, 156, 130, 156, 144, 134, 154, 146, 148, 142, 154, 150, 148, 156, 154, 164, 152, 168, 172, 134, 172, 152, 146, 156, 144, 146, 132, 152, 148, 134, 138, 144, 154, 136, 152, 164, 134, 168, 158, 152, 166, 162, 166, 150, 170, 156, 152, 164, 164, 164, 146, 156, 164, 132, 170, 154, 144, 154, 150, 154, 136, 158, 162, 150, 154, 150, 168, 146, 166, 176, 138, 174, 162, 150, 162, 148, 168, 142, 160, 150, 140, 152, 156, 156, 140, 156, 176, 142, 162, 158, 148, 170, 156, 164, 152, 168, 168, 156, 162, 156, 162, 146, 156, 162, 140, 166, 150, 144, 156, 154, 148, 140, 162, 156, 148, 166, 152, 170, 148, 158, 184, 142, 174, 160, 146, 174, 156, 146, 148, 162, 150, 140, 150, 146, 160, 142, 150, 174, 138, 170, 166, 144, 174, 158, 164, 158, 154, 160, 154, 160, 146, 170, 142, 150, 164, 138, 170, 154, 140, 164, 152, 154, 152, 158, 164, 148, 160, 160, 162, 150, 154, 176, 142, 172, 160, 140, 166, 150, 152, 142, 152, 152, 142, 152, 148, 162, 140, 160, 170, 140, 174, 172, 148, 170, 164, 158, 160, 164, 156, 134, 164, 154}, + {158, 148, 162, 162, 160, 150, 158, 178, 144, 164, 152, 162, 144, 156, 170, 130, 166, 156, 142, 154, 152, 154, 148, 158, 158, 144, 162, 166, 168, 150, 164, 182, 140, 170, 160, 142, 170, 142, 156, 140, 154, 152, 142, 160, 152, 154, 142, 150, 172, 140, 172, 162, 156, 166, 158, 170, 150, 162, 166, 144, 156, 150, 168, 142, 154, 164, 134, 162, 154, 140, 166, 144, 162, 148, 150, 164, 154, 160, 166, 166, 146, 164, 180, 148, 170, 156, 140, 164, 148, 156, 138, 160, 148, 138, 154, 148, 166, 142, 164, 174, 146, 172, 168, 148, 174, 160, 156, 152, 158, 164, 136, 162, 150, 154, 152, 146, 170, 138, 158, 156, 138, 168, 152, 156, 160, 162, 164, 140, 162, 156, 152, 144, 152, 166, 130, 152, 146, 130, 154, 144, 144, 140, 144, 154, 138, 160, 156, 156, 156, 154, 178, 146, 168, 164, 138, 172, 148, 152, 140, 152, 148, 128, 154, 142, 140, 134, 142, 164, 136, 166, 158, 144, 164, 164, 150, 158, 164, 154, 142, 160, 154, 154, 148, 148, 152, 130, 148, 152, 132, 158, 150, 146, 148, 150, 164, 134, 162, 156, 154, 164, 152, 172, 142, 174, 172, 144, 178, 158, 150, 156, 158, 160, 138, 152, 150, 144, 146, 154, 164, 140, 160, 166, 142, 178, 152, 158, 168, 160, 170, 144, 170, 162, 152, 158, 146, 174, 136, 162, 160, 138, 158, 148, 146, 154, 148, 160, 144, 156, 158, 162, 162, 158, 170, 142, 168, 168, 142, 172, 158, 148, 156, 154, 158, 142, 158, 144, 154, 150, 158, 170, 138, 162, 166, 146, 178, 160, 160, 170, 156, 162, 150, 158, 152, 148, 148, 154, 164, 138, 156, 158, 140, 166, 150, 142, 164, 152, 164, 142, 166, 166, 150, 164, 152, 172, 152, 166, 166, 138, 174, 152, 154, 156, 148, 154, 138, 148, 156, 146, 154, 154, 162, 148, 160, 176, 144, 180, 164, 154, 170, 160, 170, 144, 162, 160, 140, 158, 148, 162, 138, 154, 166, 136, 168, 150, 154, 156, 160, 174, 148, 164, 160, 156, 160, 156, 176, 150, 158, 176, 138, 168}, + {162, 158, 160, 156, 166, 174, 144, 162, 170, 142, 168, 156, 150, 154, 150, 158, 142, 148, 156, 146, 148, 156, 162, 146, 160, 166, 144, 176, 158, 156, 156, 166, 168, 148, 164, 160, 154, 162, 144, 166, 136, 154, 164, 126, 168, 158, 146, 164, 152, 160, 142, 164, 156, 160, 164, 154, 172, 154, 166, 164, 144, 178, 150, 140, 162, 148, 156, 140, 154, 150, 146, 156, 144, 174, 146, 164, 170, 148, 176, 154, 156, 168, 158, 162, 142, 166, 154, 146, 156, 148, 162, 132, 156, 162, 140, 168, 154, 148, 154, 160, 162, 152, 160, 162, 154, 162, 158, 182, 144, 166, 164, 138, 174, 160, 134, 158, 148, 148, 148, 152, 154, 144, 152, 162, 156, 148, 168, 174, 138, 176, 154, 144, 154, 148, 148, 134, 152, 154, 134, 142, 144, 154, 136, 150, 170, 134, 170, 154, 146, 164, 152, 170, 148, 158, 158, 142, 152, 156, 150, 140, 144, 158, 124, 160, 148, 134, 146, 148, 146, 134, 162, 164, 144, 156, 164, 166, 148, 164, 176, 134, 168, 156, 144, 154, 146, 156, 138, 156, 150, 140, 144, 152, 150, 144, 154, 172, 136, 166, 160, 144, 176, 166, 160, 152, 160, 164, 144, 164, 154, 160, 150, 150, 168, 132, 166, 154, 144, 162, 156, 154, 146, 154, 158, 142, 172, 160, 164, 152, 156, 182, 144, 170, 166, 140, 176, 144, 152, 140, 156, 162, 136, 154, 150, 154, 150, 150, 170, 140, 170, 166, 148, 174, 160, 164, 154, 164, 162, 148, 152, 158, 154, 142, 154, 166, 132, 164, 154, 136, 164, 150, 154, 154, 160, 164, 146, 156, 162, 160, 156, 162, 178, 148, 174, 164, 144, 162, 150, 148, 148, 150, 150, 142, 158, 154, 154, 146, 162, 172, 140, 170, 174, 144, 176, 158, 156, 156, 158, 164, 138, 164, 152, 144, 150, 148, 164, 138, 158, 164, 136, 168, 156, 148, 150, 162, 166, 142, 164, 168, 154, 154, 162, 168, 140, 164, 166, 138, 172, 150, 146, 148, 150, 160, 132, 158, 158, 150, 156, 148, 176, 144, 170, 170, 148, 174, 158, 160, 152, 152, 166, 142}, + {138, 168, 168, 146, 168, 164, 162, 160, 170, 168, 146, 156, 152, 166, 142, 148, 164, 134, 162, 160, 136, 164, 152, 160, 148, 154, 170, 148, 164, 168, 160, 150, 162, 178, 144, 164, 158, 142, 168, 156, 152, 146, 154, 158, 134, 150, 148, 160, 146, 156, 174, 146, 176, 166, 146, 174, 162, 152, 158, 162, 162, 140, 162, 162, 144, 152, 148, 168, 132, 160, 166, 136, 170, 156, 146, 152, 164, 164, 144, 174, 164, 154, 154, 158, 176, 140, 170, 158, 136, 170, 152, 152, 146, 144, 162, 134, 156, 156, 156, 154, 154, 178, 144, 172, 168, 146, 176, 154, 164, 148, 166, 160, 132, 160, 154, 144, 148, 154, 160, 136, 168, 160, 142, 166, 164, 156, 156, 160, 156, 144, 162, 158, 150, 146, 144, 152, 130, 148, 150, 126, 162, 146, 138, 148, 148, 162, 132, 172, 156, 152, 174, 154, 170, 142, 164, 170, 134, 168, 152, 134, 146, 144, 146, 126, 152, 144, 146, 140, 154, 164, 140, 158, 174, 136, 170, 154, 160, 156, 152, 166, 140, 162, 166, 146, 158, 150, 172, 144, 158, 160, 144, 164, 160, 138, 156, 156, 164, 144, 156, 166, 154, 152, 160, 172, 148, 168, 178, 140, 174, 152, 144, 158, 154, 158, 140, 154, 148, 142, 146, 146, 168, 140, 160, 170, 144, 172, 156, 158, 170, 158, 164, 154, 158, 162, 146, 162, 152, 166, 142, 150, 164, 132, 164, 158, 142, 164, 156, 158, 148, 162, 160, 148, 170, 154, 170, 150, 166, 172, 140, 172, 158, 140, 160, 146, 152, 142, 150, 160, 138, 158, 152, 166, 144, 160, 174, 148, 178, 160, 148, 164, 160, 162, 138, 162, 156, 142, 160, 152, 154, 140, 154, 160, 134, 168, 154, 148, 158, 156, 160, 156, 166, 164, 148, 166, 168, 170, 154, 154, 168, 138, 174, 158, 140, 156, 158, 146, 144, 140, 168, 136, 158, 160, 156, 158, 160, 180, 140, 172, 166, 150, 172, 156, 160, 140, 166, 156, 138, 154, 150, 154, 142, 150, 174, 144, 162, 162, 140, 178, 150, 168, 156, 160, 156, 154, 172, 156, 162, 156, 150, 170}, + {156, 150, 158, 166, 150, 166, 154, 166, 150, 160, 168, 146, 174, 152, 142, 166, 154, 150, 138, 150, 150, 150, 158, 146, 170, 144, 158, 174, 148, 170, 164, 150, 170, 158, 166, 146, 162, 158, 140, 148, 154, 160, 142, 146, 172, 134, 174, 152, 146, 160, 152, 162, 150, 168, 166, 152, 166, 152, 170, 142, 160, 170, 136, 166, 164, 136, 158, 148, 154, 138, 148, 164, 140, 154, 166, 162, 152, 160, 178, 138, 174, 168, 152, 168, 160, 158, 140, 168, 156, 134, 158, 146, 154, 150, 150, 170, 136, 164, 162, 146, 162, 158, 164, 154, 158, 170, 138, 172, 164, 156, 150, 158, 172, 136, 168, 160, 138, 154, 156, 154, 136, 158, 168, 134, 164, 154, 162, 148, 164, 164, 134, 170, 160, 138, 152, 142, 148, 134, 152, 146, 130, 144, 154, 148, 146, 158, 174, 134, 166, 166, 142, 176, 158, 154, 146, 152, 164, 132, 152, 150, 146, 138, 154, 154, 122, 154, 150, 132, 158, 152, 150, 146, 152, 164, 144, 168, 162, 166, 152, 164, 184, 150, 170, 168, 144, 176, 146, 146, 152, 152, 148, 138, 150, 154, 148, 150, 150, 170, 138, 168, 172, 146, 176, 162, 156, 156, 160, 166, 146, 160, 162, 152, 144, 152, 166, 134, 158, 158, 136, 172, 150, 160, 150, 158, 166, 148, 172, 160, 158, 164, 158, 174, 142, 168, 166, 134, 172, 154, 140, 150, 150, 152, 134, 154, 166, 142, 148, 166, 166, 144, 178, 174, 140, 180, 160, 158, 156, 158, 170, 138, 158, 168, 140, 154, 150, 162, 138, 156, 164, 136, 168, 152, 150, 160, 168, 164, 144, 168, 170, 152, 160, 166, 174, 140, 172, 160, 138, 170, 152, 142, 146, 154, 164, 130, 156, 162, 150, 160, 156, 172, 148, 164, 174, 140, 174, 164, 156, 154, 168, 162, 136, 156, 154, 138, 142, 158, 158, 146, 160, 166, 142, 166, 164, 150, 162, 164, 170, 148, 164, 164, 150, 158, 160, 166, 136, 156, 164, 138, 166, 154, 136, 156, 152, 150, 144, 158, 164, 146, 166, 152, 168, 152, 172, 174, 134, 172, 162, 138, 170, 150}, + {164, 168, 146, 174, 172, 138, 176, 166, 158, 162, 160, 156, 144, 154, 162, 144, 148, 154, 164, 138, 160, 162, 138, 166, 154, 150, 162, 160, 168, 144, 170, 164, 152, 158, 160, 170, 138, 168, 168, 138, 166, 152, 142, 150, 146, 160, 126, 164, 158, 154, 154, 162, 170, 142, 170, 172, 140, 186, 162, 160, 158, 156, 156, 144, 156, 152, 140, 148, 152, 160, 138, 164, 168, 134, 170, 154, 152, 168, 160, 166, 148, 162, 168, 158, 154, 164, 158, 146, 162, 166, 132, 168, 150, 138, 150, 152, 160, 136, 162, 164, 144, 174, 158, 168, 148, 166, 188, 134, 178, 162, 146, 154, 158, 154, 138, 154, 156, 144, 146, 150, 162, 138, 156, 174, 136, 174, 162, 160, 162, 164, 154, 140, 162, 158, 142, 150, 136, 158, 130, 150, 158, 122, 154, 148, 140, 154, 150, 162, 138, 158, 166, 144, 156, 160, 158, 152, 154, 174, 134, 158, 148, 136, 136, 150, 148, 138, 148, 146, 138, 156, 146, 166, 144, 158, 172, 138, 178, 160, 152, 166, 160, 154, 152, 162, 156, 142, 162, 150, 158, 142, 162, 162, 134, 160, 164, 138, 162, 158, 158, 150, 162, 160, 144, 170, 164, 164, 152, 160, 168, 138, 172, 158, 142, 162, 150, 152, 146, 158, 158, 138, 160, 148, 160, 148, 162, 174, 140, 174, 164, 150, 168, 158, 168, 146, 156, 160, 136, 160, 152, 150, 144, 154, 170, 128, 164, 156, 142, 164, 156, 158, 152, 160, 172, 138, 170, 160, 160, 146, 164, 166, 140, 164, 160, 136, 160, 154, 148, 146, 152, 160, 136, 166, 158, 148, 160, 164, 172, 140, 170, 174, 146, 172, 152, 152, 142, 172, 162, 132, 156, 158, 150, 142, 148, 168, 138, 166, 162, 144, 162, 158, 166, 156, 160, 168, 144, 162, 164, 154, 146, 156, 170, 142, 162, 166, 132, 160, 156, 140, 146, 156, 160, 140, 154, 166, 156, 152, 158, 178, 140, 176, 172, 152, 164, 152, 162, 148, 156, 156, 136, 152, 158, 148, 142, 154, 174, 140, 162, 164, 144, 180, 168, 148, 156, 166, 166, 154, 164, 158, 156, 148}, + {152, 164, 154, 154, 164, 170, 150, 164, 160, 158, 150, 166, 168, 142, 162, 162, 140, 156, 148, 154, 138, 156, 158, 140, 158, 156, 154, 160, 158, 174, 142, 174, 170, 146, 172, 160, 152, 150, 156, 156, 132, 164, 154, 146, 144, 160, 168, 132, 164, 160, 142, 164, 160, 164, 160, 152, 176, 140, 162, 166, 150, 156, 156, 170, 140, 168, 156, 142, 160, 146, 152, 138, 156, 168, 132, 168, 162, 154, 152, 168, 180, 138, 170, 168, 146, 164, 164, 152, 146, 154, 156, 132, 160, 152, 152, 146, 154, 172, 140, 160, 172, 138, 170, 166, 158, 162, 152, 170, 148, 162, 156, 150, 150, 162, 160, 134, 158, 164, 128, 168, 152, 148, 160, 158, 162, 136, 162, 166, 150, 150, 162, 164, 140, 158, 156, 128, 164, 140, 142, 136, 146, 156, 136, 154, 142, 152, 150, 154, 174, 140, 172, 180, 140, 168, 158, 146, 154, 154, 158, 134, 144, 150, 144, 138, 152, 154, 126, 154, 158, 132, 166, 148, 164, 154, 156, 162, 146, 168, 162, 154, 162, 168, 170, 144, 172, 172, 134, 172, 162, 140, 144, 158, 154, 138, 154, 166, 144, 148, 160, 160, 150, 168, 180, 140, 174, 166, 158, 164, 164, 158, 140, 164, 164, 136, 152, 150, 156, 136, 156, 164, 136, 170, 164, 144, 158, 164, 168, 142, 170, 164, 148, 164, 164, 164, 150, 162, 170, 138, 168, 160, 140, 150, 142, 168, 136, 164, 166, 138, 160, 158, 166, 148, 170, 182, 132, 188, 168, 158, 156, 162, 160, 138, 154, 158, 142, 148, 154, 154, 138, 164, 170, 132, 166, 166, 152, 162, 162, 166, 148, 160, 164, 154, 166, 158, 158, 140, 158, 166, 130, 158, 156, 146, 162, 160, 152, 142, 162, 158, 144, 168, 160, 168, 150, 168, 186, 140, 174, 172, 146, 162, 148, 152, 138, 154, 160, 134, 154, 156, 156, 144, 156, 172, 142, 170, 170, 152, 168, 156, 170, 144, 164, 156, 154, 162, 148, 162, 148, 160, 164, 134, 156, 158, 140, 160, 146, 166, 148, 156, 164, 144, 156, 170, 168, 150, 168, 176, 136, 170, 156, 144}, + {154, 150, 162, 170, 148, 166, 176, 138, 174, 172, 154, 154, 154, 160, 144, 158, 156, 140, 158, 150, 156, 138, 164, 168, 134, 172, 166, 148, 160, 168, 162, 150, 168, 162, 148, 158, 166, 152, 150, 162, 164, 128, 162, 164, 144, 150, 154, 152, 142, 172, 170, 136, 168, 160, 160, 152, 166, 176, 142, 174, 168, 144, 154, 160, 158, 134, 164, 148, 140, 158, 154, 156, 144, 158, 170, 138, 164, 170, 152, 164, 156, 170, 152, 168, 168, 142, 160, 158, 154, 146, 154, 172, 124, 166, 160, 144, 154, 152, 164, 148, 158, 166, 144, 166, 164, 158, 150, 170, 172, 140, 168, 164, 148, 152, 158, 152, 142, 154, 152, 140, 160, 160, 146, 138, 160, 174, 142, 174, 166, 146, 160, 158, 158, 142, 152, 152, 132, 150, 142, 148, 134, 142, 158, 124, 160, 160, 148, 160, 154, 150, 152, 154, 170, 138, 166, 164, 146, 150, 160, 156, 132, 156, 146, 130, 152, 138, 154, 132, 148, 162, 138, 162, 150, 154, 150, 162, 178, 142, 180, 170, 144, 170, 160, 162, 144, 154, 162, 140, 146, 164, 146, 142, 156, 158, 132, 162, 160, 144, 162, 164, 150, 158, 166, 162, 148, 168, 158, 154, 152, 166, 166, 138, 162, 168, 136, 160, 154, 146, 144, 160, 152, 140, 156, 170, 144, 162, 166, 174, 140, 174, 174, 136, 172, 156, 150, 150, 156, 160, 128, 156, 160, 144, 150, 148, 164, 140, 156, 172, 140, 166, 166, 160, 156, 158, 170, 140, 164, 160, 154, 154, 154, 166, 142, 156, 162, 134, 162, 156, 144, 146, 158, 164, 140, 162, 160, 152, 158, 164, 178, 142, 168, 168, 146, 166, 160, 154, 146, 154, 164, 140, 158, 150, 140, 144, 156, 170, 138, 164, 168, 142, 166, 166, 152, 158, 154, 168, 146, 156, 160, 146, 158, 160, 160, 132, 158, 162, 132, 160, 158, 150, 152, 156, 160, 146, 162, 164, 154, 164, 156, 174, 152, 170, 168, 140, 174, 154, 144, 152, 146, 162, 132, 156, 160, 134, 158, 152, 166, 142, 166, 176, 146, 170, 164, 154, 154, 164, 172, 142, 162, 158}, + {162, 142, 168, 158, 166, 158, 168, 168, 152, 162, 162, 150, 152, 158, 166, 130, 166, 164, 134, 160, 156, 152, 142, 152, 162, 138, 156, 168, 158, 156, 162, 170, 144, 172, 178, 146, 166, 164, 146, 150, 164, 152, 136, 154, 148, 146, 144, 166, 160, 136, 158, 172, 146, 168, 176, 156, 160, 164, 164, 146, 162, 162, 148, 160, 152, 164, 132, 160, 166, 130, 160, 156, 140, 156, 158, 164, 136, 172, 166, 150, 168, 156, 166, 148, 166, 172, 142, 164, 162, 148, 150, 150, 158, 130, 154, 154, 148, 152, 152, 164, 146, 160, 178, 144, 172, 164, 160, 158, 158, 176, 144, 160, 154, 148, 150, 154, 160, 136, 164, 158, 132, 156, 166, 166, 152, 154, 164, 150, 162, 168, 144, 156, 158, 154, 138, 150, 156, 126, 152, 152, 138, 148, 142, 154, 132, 154, 158, 140, 160, 168, 156, 148, 172, 168, 134, 164, 168, 142, 150, 150, 148, 136, 150, 154, 132, 142, 144, 154, 138, 156, 164, 130, 166, 160, 146, 156, 156, 168, 148, 168, 168, 146, 166, 162, 160, 142, 162, 164, 134, 166, 164, 142, 148, 156, 156, 138, 162, 156, 150, 154, 166, 164, 146, 172, 174, 142, 178, 170, 150, 158, 156, 158, 146, 160, 156, 136, 160, 152, 154, 134, 166, 162, 138, 164, 168, 146, 164, 166, 160, 150, 166, 168, 154, 164, 166, 148, 156, 158, 166, 138, 156, 164, 136, 156, 154, 150, 148, 160, 162, 140, 172, 162, 154, 160, 162, 182, 142, 170, 164, 144, 166, 154, 152, 150, 158, 152, 132, 158, 154, 150, 146, 156, 170, 142, 166, 176, 144, 166, 158, 170, 150, 160, 178, 142, 160, 156, 158, 146, 150, 160, 128, 160, 164, 138, 162, 150, 164, 148, 160, 162, 154, 162, 170, 156, 158, 168, 172, 142, 170, 166, 142, 156, 162, 154, 146, 150, 152, 138, 154, 166, 146, 142, 162, 172, 140, 174, 170, 148, 172, 162, 164, 156, 158, 166, 138, 162, 158, 148, 150, 154, 162, 132, 158, 168, 138, 162, 164, 150, 148, 160, 170, 150, 164, 168, 158, 158, 166, 162, 142, 168}, + {154, 164, 140, 170, 160, 158, 154, 164, 168, 142, 174, 168, 152, 162, 152, 162, 140, 156, 158, 136, 154, 152, 150, 146, 160, 168, 138, 168, 162, 154, 164, 162, 164, 148, 158, 164, 148, 160, 166, 154, 142, 168, 160, 128, 162, 166, 140, 152, 158, 164, 144, 162, 158, 148, 160, 166, 156, 150, 170, 174, 144, 170, 160, 142, 158, 156, 156, 138, 150, 154, 144, 156, 164, 146, 148, 164, 170, 136, 170, 176, 154, 166, 168, 160, 152, 156, 170, 144, 162, 156, 148, 146, 156, 162, 132, 156, 164, 140, 162, 160, 154, 154, 168, 160, 140, 170, 174, 152, 158, 168, 164, 140, 166, 168, 134, 164, 150, 154, 140, 154, 162, 140, 154, 154, 152, 156, 162, 166, 142, 156, 168, 138, 164, 156, 152, 144, 154, 150, 136, 146, 146, 140, 138, 154, 154, 134, 160, 168, 136, 160, 170, 152, 158, 160, 160, 150, 152, 168, 140, 146, 152, 146, 130, 150, 156, 130, 154, 144, 142, 138, 162, 154, 138, 162, 162, 152, 166, 162, 168, 144, 170, 174, 140, 166, 170, 156, 158, 154, 164, 132, 156, 154, 140, 150, 156, 160, 136, 164, 166, 140, 166, 152, 168, 156, 162, 164, 146, 168, 166, 152, 158, 158, 158, 136, 160, 160, 134, 158, 156, 152, 148, 156, 166, 140, 162, 162, 142, 164, 168, 162, 144, 168, 170, 140, 164, 164, 152, 150, 156, 154, 136, 154, 158, 142, 156, 162, 156, 142, 162, 162, 146, 166, 176, 152, 156, 160, 172, 150, 156, 164, 142, 160, 160, 148, 138, 160, 166, 130, 158, 160, 144, 160, 158, 156, 142, 166, 168, 150, 158, 170, 158, 152, 164, 172, 140, 164, 162, 152, 156, 152, 162, 138, 152, 158, 134, 156, 158, 154, 144, 160, 176, 142, 168, 168, 158, 160, 162, 170, 142, 160, 160, 144, 150, 156, 156, 138, 166, 162, 132, 158, 164, 154, 154, 156, 168, 152, 158, 164, 148, 160, 170, 158, 148, 160, 172, 134, 162, 170, 136, 150, 152, 152, 144, 150, 160, 140, 156, 162, 154, 156, 166, 170, 140, 172, 170, 148, 160, 166, 158, 144}, + {146, 160, 174, 144, 174, 162, 162, 160, 164, 162, 142, 160, 156, 156, 154, 164, 152, 138, 156, 162, 138, 154, 168, 144, 160, 154, 166, 142, 170, 166, 144, 164, 168, 166, 156, 166, 166, 140, 158, 154, 152, 144, 156, 158, 140, 150, 156, 148, 156, 152, 160, 148, 168, 168, 148, 170, 172, 154, 160, 158, 166, 140, 162, 164, 140, 156, 156, 152, 142, 154, 158, 132, 154, 160, 160, 152, 156, 170, 146, 168, 166, 138, 166, 172, 158, 148, 164, 158, 142, 160, 170, 140, 144, 158, 154, 144, 154, 158, 138, 158, 164, 154, 148, 168, 178, 138, 166, 174, 150, 164, 162, 160, 142, 162, 162, 136, 158, 152, 148, 140, 156, 166, 140, 160, 160, 150, 158, 166, 172, 156, 158, 162, 140, 158, 158, 142, 128, 150, 154, 124, 154, 150, 136, 142, 150, 152, 140, 158, 164, 146, 154, 166, 162, 146, 174, 164, 142, 158, 164, 148, 146, 156, 144, 134, 148, 148, 138, 146, 150, 142, 142, 164, 168, 136, 162, 168, 144, 160, 166, 164, 154, 158, 172, 146, 166, 156, 150, 150, 166, 160, 138, 162, 162, 140, 152, 162, 154, 146, 154, 166, 146, 174, 164, 156, 154, 174, 166, 152, 162, 168, 144, 162, 158, 158, 150, 156, 154, 136, 156, 154, 148, 154, 152, 164, 146, 162, 172, 152, 166, 170, 160, 156, 158, 182, 130, 164, 156, 156, 148, 162, 152, 138, 158, 168, 132, 152, 160, 166, 148, 168, 158, 146, 168, 168, 150, 160, 164, 170, 146, 166, 162, 140, 160, 164, 148, 142, 158, 148, 144, 154, 162, 142, 146, 170, 168, 142, 170, 176, 150, 162, 174, 158, 164, 158, 154, 146, 162, 154, 142, 152, 152, 158, 134, 156, 164, 138, 162, 164, 152, 152, 168, 158, 154, 172, 168, 152, 158, 166, 164, 140, 166, 164, 140, 158, 154, 154, 146, 156, 160, 140, 158, 154, 150, 160, 154, 168, 152, 168, 176, 150, 166, 166, 162, 152, 158, 162, 140, 152, 162, 148, 146, 162, 148, 144, 160, 166, 138, 158, 170, 150, 152, 166, 170, 156, 162, 174, 152, 164, 158, 164}, + {158, 144, 162, 162, 144, 172, 168, 152, 158, 174, 166, 152, 160, 164, 144, 156, 160, 150, 146, 150, 152, 142, 156, 156, 142, 158, 160, 158, 140, 174, 172, 156, 162, 172, 156, 158, 160, 162, 150, 162, 160, 150, 152, 156, 148, 142, 154, 164, 136, 164, 160, 154, 148, 170, 162, 144, 170, 164, 152, 164, 164, 166, 142, 162, 162, 144, 154, 164, 146, 144, 158, 166, 144, 154, 154, 152, 156, 158, 162, 148, 166, 182, 142, 164, 174, 156, 150, 162, 164, 144, 154, 158, 146, 150, 154, 154, 140, 162, 162, 146, 160, 166, 158, 150, 166, 160, 156, 166, 162, 152, 158, 162, 154, 146, 160, 168, 140, 148, 166, 146, 148, 150, 160, 140, 166, 150, 150, 158, 162, 158, 146, 160, 162, 138, 156, 160, 144, 146, 144, 152, 128, 152, 152, 134, 150, 154, 158, 142, 160, 162, 142, 162, 162, 160, 152, 154, 164, 136, 156, 154, 142, 142, 150, 146, 134, 148, 150, 136, 150, 150, 150, 146, 154, 162, 146, 162, 158, 162, 158, 168, 160, 154, 164, 172, 142, 162, 168, 146, 150, 162, 158, 140, 146, 162, 138, 150, 156, 158, 148, 158, 166, 142, 170, 162, 158, 156, 168, 162, 154, 154, 160, 150, 156, 156, 148, 142, 158, 158, 138, 154, 166, 138, 164, 160, 160, 146, 162, 166, 146, 162, 178, 152, 160, 162, 174, 144, 164, 150, 150, 142, 166, 150, 142, 146, 162, 146, 156, 156, 150, 150, 164, 166, 148, 160, 176, 148, 162, 168, 168, 146, 162, 168, 140, 154, 160, 150, 144, 162, 154, 136, 158, 162, 150, 152, 152, 166, 150, 164, 160, 150, 164, 166, 160, 150, 172, 158, 146, 158, 166, 144, 144, 158, 148, 146, 158, 166, 136, 160, 164, 150, 148, 174, 168, 142, 162, 178, 148, 166, 162, 162, 148, 158, 156, 142, 154, 152, 144, 144, 158, 164, 136, 160, 162, 148, 156, 168, 160, 156, 156, 166, 144, 172, 162, 158, 146, 162, 162, 136, 156, 162, 140, 150, 154, 158, 142, 156, 160, 150, 158, 160, 164, 156, 168, 158, 144, 166, 170, 146, 156, 156}, + {162, 156, 150, 156, 178, 140, 164, 166, 156, 156, 172, 164, 138, 164, 156, 150, 154, 162, 150, 142, 164, 150, 140, 160, 164, 148, 154, 168, 158, 154, 162, 164, 152, 164, 166, 152, 146, 168, 160, 148, 156, 156, 146, 146, 164, 154, 148, 152, 158, 142, 158, 162, 148, 158, 168, 162, 144, 176, 170, 154, 166, 160, 158, 146, 158, 156, 144, 154, 164, 146, 144, 148, 162, 144, 162, 160, 154, 158, 166, 168, 146, 158, 168, 156, 162, 170, 162, 150, 156, 164, 138, 162, 152, 144, 150, 156, 154, 138, 154, 166, 144, 160, 162, 160, 156, 172, 164, 148, 168, 172, 162, 158, 160, 160, 146, 154, 156, 146, 150, 158, 144, 152, 158, 160, 144, 172, 162, 154, 160, 166, 154, 154, 154, 160, 140, 146, 160, 138, 142, 146, 150, 128, 144, 162, 130, 150, 154, 154, 152, 160, 160, 146, 172, 166, 148, 160, 154, 168, 146, 160, 150, 140, 136, 154, 138, 142, 148, 148, 136, 156, 150, 144, 156, 156, 164, 142, 160, 170, 150, 166, 162, 166, 154, 164, 172, 142, 158, 162, 150, 152, 150, 154, 140, 160, 160, 144, 152, 162, 156, 146, 158, 164, 152, 174, 166, 154, 158, 168, 160, 154, 160, 166, 144, 156, 160, 152, 144, 154, 156, 144, 154, 160, 144, 148, 164, 156, 150, 172, 166, 158, 158, 170, 158, 158, 158, 160, 146, 156, 164, 146, 148, 160, 150, 142, 158, 158, 140, 160, 164, 154, 146, 168, 164, 154, 168, 170, 150, 160, 162, 160, 142, 154, 164, 140, 162, 150, 150, 146, 158, 154, 138, 160, 158, 160, 160, 166, 156, 150, 166, 168, 148, 164, 168, 160, 150, 162, 162, 144, 154, 154, 148, 148, 158, 150, 140, 156, 164, 148, 158, 164, 156, 152, 174, 160, 152, 162, 166, 142, 162, 162, 154, 150, 162, 160, 142, 148, 166, 144, 148, 150, 158, 146, 158, 162, 154, 160, 164, 164, 158, 162, 176, 148, 156, 166, 154, 156, 160, 156, 146, 154, 156, 134, 156, 154, 154, 144, 162, 162, 142, 162, 166, 158, 162, 164, 176, 150, 168, 172, 148, 162}, + {154, 164, 150, 156, 160, 166, 156, 166, 172, 150, 160, 162, 162, 146, 158, 160, 142, 152, 152, 150, 144, 154, 162, 134, 156, 160, 150, 156, 158, 166, 158, 168, 168, 150, 166, 172, 160, 148, 158, 160, 144, 160, 154, 146, 148, 156, 148, 142, 164, 158, 152, 160, 160, 150, 164, 160, 166, 154, 158, 170, 154, 160, 160, 158, 154, 160, 154, 150, 144, 154, 154, 154, 154, 154, 142, 156, 158, 148, 164, 166, 164, 156, 162, 166, 156, 158, 158, 158, 150, 156, 162, 140, 160, 156, 136, 152, 156, 160, 148, 156, 156, 150, 158, 166, 156, 154, 164, 170, 148, 162, 166, 146, 162, 156, 152, 152, 154, 148, 150, 148, 158, 148, 154, 160, 158, 142, 158, 160, 154, 158, 162, 150, 164, 154, 160, 142, 148, 154, 140, 140, 154, 154, 138, 144, 148, 134, 156, 160, 148, 152, 164, 164, 148, 158, 170, 146, 160, 154, 160, 142, 150, 152, 148, 144, 150, 148, 136, 150, 148, 134, 146, 156, 146, 156, 162, 160, 146, 170, 166, 148, 170, 164, 168, 156, 162, 162, 148, 154, 164, 150, 152, 154, 154, 146, 152, 160, 144, 154, 158, 150, 158, 156, 168, 148, 168, 164, 152, 160, 172, 158, 152, 156, 162, 144, 158, 154, 150, 146, 156, 148, 144, 154, 164, 152, 154, 160, 160, 152, 164, 162, 156, 162, 166, 154, 160, 158, 166, 160, 152, 156, 150, 148, 156, 152, 148, 150, 158, 142, 160, 156, 162, 158, 170, 162, 150, 164, 176, 156, 166, 164, 162, 154, 158, 158, 136, 160, 156, 140, 154, 154, 164, 144, 162, 150, 156, 152, 172, 170, 152, 164, 172, 154, 166, 168, 156, 156, 152, 162, 140, 160, 156, 144, 150, 158, 164, 144, 150, 164, 150, 160, 160, 158, 156, 172, 158, 160, 166, 170, 162, 160, 164, 156, 144, 154, 162, 142, 156, 150, 142, 158, 158, 154, 150, 162, 168, 150, 156, 166, 162, 156, 168, 164, 162, 156, 158, 146, 156, 162, 156, 144, 160, 164, 144, 148, 156, 156, 150, 156, 166, 144, 162, 164, 154, 160, 156, 166, 156, 160, 160, 152}, + {148, 160, 156, 154, 162, 164, 164, 154, 158, 168, 154, 162, 154, 164, 150, 158, 164, 140, 168, 152, 152, 150, 154, 160, 146, 160, 156, 154, 150, 170, 164, 154, 164, 168, 148, 166, 166, 152, 162, 154, 156, 150, 150, 154, 152, 146, 162, 152, 142, 158, 158, 146, 170, 154, 152, 166, 166, 160, 156, 156, 166, 158, 156, 150, 162, 148, 158, 152, 146, 156, 152, 140, 158, 152, 152, 164, 158, 162, 154, 158, 162, 168, 152, 162, 166, 160, 160, 158, 156, 152, 160, 154, 144, 152, 162, 146, 150, 146, 162, 148, 160, 164, 144, 162, 170, 156, 162, 160, 166, 162, 158, 154, 160, 146, 162, 154, 150, 154, 158, 144, 148, 162, 146, 152, 154, 162, 150, 164, 164, 150, 160, 152, 162, 140, 154, 158, 142, 146, 148, 140, 142, 148, 136, 148, 152, 148, 140, 154, 162, 152, 150, 156, 162, 154, 156, 158, 148, 162, 152, 156, 144, 150, 146, 140, 140, 140, 150, 142, 152, 144, 146, 154, 156, 146, 160, 156, 162, 148, 162, 166, 158, 160, 162, 168, 152, 162, 162, 154, 152, 158, 146, 154, 154, 146, 150, 152, 156, 148, 158, 164, 154, 156, 164, 164, 154, 170, 158, 156, 164, 166, 156, 158, 154, 160, 154, 152, 156, 148, 148, 158, 160, 138, 154, 160, 156, 158, 156, 158, 160, 164, 170, 152, 168, 168, 156, 154, 154, 160, 144, 160, 150, 144, 154, 154, 144, 158, 150, 156, 160, 160, 150, 156, 152, 166, 164, 156, 158, 162, 148, 162, 148, 156, 152, 162, 156, 150, 150, 156, 148, 152, 148, 166, 140, 162, 154, 150, 162, 162, 164, 156, 156, 156, 158, 158, 154, 162, 154, 154, 156, 144, 158, 154, 144, 148, 148, 150, 156, 150, 156, 156, 162, 160, 160, 156, 164, 170, 140, 166, 158, 148, 150, 158, 158, 152, 158, 148, 152, 154, 148, 148, 156, 156, 154, 152, 152, 160, 156, 170, 160, 162, 164, 162, 156, 152, 162, 162, 148, 148, 156, 152, 138, 152, 152, 148, 158, 154, 154, 158, 160, 162, 160, 158, 166, 156, 166, 162, 164, 156, 158, 162}, + {152, 154, 162, 150, 162, 156, 166, 166, 156, 174, 164, 150, 170, 152, 164, 154, 152, 162, 140, 152, 150, 152, 152, 148, 158, 150, 164, 154, 156, 164, 156, 164, 164, 158, 168, 156, 166, 154, 156, 154, 160, 154, 150, 160, 144, 148, 150, 156, 150, 158, 150, 158, 154, 164, 160, 162, 160, 168, 172, 156, 170, 164, 150, 160, 150, 154, 158, 156, 148, 148, 158, 150, 148, 148, 158, 158, 152, 160, 158, 156, 166, 158, 164, 164, 160, 158, 162, 152, 148, 168, 144, 154, 164, 144, 154, 148, 152, 162, 144, 152, 166, 158, 156, 160, 168, 160, 166, 156, 156, 172, 156, 162, 160, 152, 158, 154, 156, 148, 150, 152, 152, 144, 152, 160, 152, 154, 166, 148, 164, 166, 156, 160, 152, 158, 154, 154, 148, 148, 146, 140, 146, 138, 150, 148, 142, 150, 154, 146, 150, 156, 160, 156, 158, 162, 166, 158, 158, 154, 156, 154, 156, 142, 152, 146, 142, 152, 136, 142, 152, 148, 140, 150, 158, 156, 144, 160, 152, 166, 152, 164, 172, 150, 174, 156, 156, 156, 160, 158, 156, 150, 156, 148, 146, 164, 154, 142, 162, 158, 144, 162, 150, 160, 164, 158, 164, 164, 166, 160, 158, 158, 156, 160, 150, 156, 150, 144, 158, 156, 142, 158, 146, 160, 158, 154, 150, 160, 160, 160, 168, 152, 166, 168, 150, 170, 162, 150, 164, 152, 162, 154, 158, 148, 148, 150, 150, 154, 146, 158, 154, 150, 170, 156, 164, 166, 162, 162, 162, 164, 164, 160, 160, 146, 174, 146, 158, 156, 140, 156, 154, 144, 154, 146, 158, 168, 154, 158, 160, 162, 156, 172, 150, 172, 162, 162, 162, 154, 148, 164, 154, 156, 150, 154, 148, 154, 156, 146, 164, 150, 164, 162, 142, 166, 162, 172, 160, 160, 164, 164, 166, 158, 164, 150, 156, 154, 140, 162, 144, 152, 154, 156, 144, 162, 156, 160, 154, 160, 158, 154, 168, 164, 164, 154, 164, 174, 150, 162, 160, 158, 158, 152, 154, 150, 150, 156, 148, 156, 152, 152, 152, 160, 156, 164, 160, 162, 154, 172, 158, 160, 160, 164}, + {170, 154, 144, 172, 150, 162, 162, 160, 154, 160, 170, 154, 156, 160, 152, 164, 148, 154, 160, 148, 152, 148, 148, 156, 148, 152, 156, 156, 156, 156, 164, 154, 172, 152, 166, 158, 154, 168, 152, 158, 154, 154, 150, 150, 160, 144, 156, 150, 150, 158, 146, 164, 158, 150, 168, 160, 152, 166, 154, 160, 166, 162, 148, 166, 160, 150, 164, 138, 164, 152, 144, 158, 156, 150, 162, 148, 156, 164, 154, 160, 162, 162, 158, 166, 160, 162, 164, 156, 164, 148, 158, 158, 142, 148, 152, 156, 142, 154, 158, 144, 160, 146, 164, 158, 148, 174, 152, 162, 174, 152, 158, 164, 160, 154, 164, 160, 140, 166, 142, 148, 154, 150, 162, 146, 148, 164, 152, 156, 162, 158, 154, 166, 156, 150, 156, 142, 152, 148, 136, 156, 142, 150, 150, 136, 142, 152, 140, 154, 156, 156, 154, 158, 148, 166, 156, 152, 156, 162, 144, 160, 146, 148, 148, 146, 144, 150, 152, 136, 140, 142, 150, 154, 140, 166, 160, 148, 166, 152, 160, 168, 156, 156, 160, 168, 156, 164, 150, 162, 162, 150, 156, 154, 152, 152, 142, 152, 154, 154, 152, 152, 168, 148, 162, 156, 156, 172, 150, 168, 152, 162, 164, 152, 164, 158, 158, 158, 148, 150, 148, 156, 150, 148, 156, 150, 162, 154, 148, 164, 156, 160, 164, 154, 162, 164, 166, 148, 166, 148, 150, 158, 146, 158, 156, 146, 154, 148, 156, 158, 152, 150, 156, 158, 150, 168, 154, 166, 164, 156, 168, 156, 158, 164, 144, 156, 158, 148, 150, 158, 148, 152, 156, 154, 150, 158, 152, 164, 156, 152, 172, 150, 164, 162, 160, 162, 168, 160, 144, 164, 152, 150, 158, 144, 160, 148, 144, 166, 144, 150, 156, 156, 154, 162, 156, 152, 162, 156, 160, 164, 152, 162, 154, 156, 158, 156, 158, 154, 150, 146, 154, 150, 152, 150, 152, 156, 162, 146, 168, 160, 148, 170, 156, 158, 164, 150, 158, 152, 154, 150, 158, 148, 154, 156, 142, 156, 160, 144, 158, 156, 152, 162, 156, 154, 168, 162, 160, 160, 160, 156, 160, 146}, + {150, 156, 152, 154, 162, 154, 168, 158, 168, 168, 146, 172, 160, 156, 164, 140, 156, 160, 150, 146, 158, 152, 150, 154, 154, 154, 158, 148, 170, 152, 158, 174, 150, 162, 170, 156, 162, 156, 166, 144, 168, 148, 154, 158, 142, 162, 146, 148, 160, 144, 158, 162, 152, 156, 154, 164, 154, 168, 158, 156, 168, 158, 162, 146, 152, 164, 150, 150, 150, 148, 156, 150, 150, 144, 166, 148, 152, 162, 150, 166, 160, 160, 164, 160, 162, 164, 152, 154, 164, 160, 144, 168, 152, 150, 156, 140, 168, 148, 152, 164, 146, 158, 164, 154, 162, 166, 166, 148, 168, 162, 154, 164, 154, 164, 152, 144, 166, 140, 156, 160, 146, 148, 160, 156, 144, 164, 152, 154, 168, 156, 162, 152, 158, 160, 152, 152, 154, 146, 148, 144, 148, 130, 156, 144, 142, 156, 142, 158, 156, 150, 166, 148, 168, 158, 160, 152, 172, 146, 160, 156, 156, 142, 156, 138, 146, 134, 142, 158, 140, 144, 160, 138, 154, 158, 156, 148, 160, 160, 154, 164, 156, 172, 162, 152, 176, 156, 154, 162, 146, 158, 154, 156, 148, 150, 158, 144, 152, 154, 160, 158, 148, 166, 146, 164, 172, 152, 158, 172, 166, 150, 164, 158, 144, 166, 150, 150, 152, 154, 164, 148, 144, 170, 134, 154, 160, 154, 154, 162, 172, 152, 170, 156, 166, 158, 160, 164, 144, 164, 166, 152, 154, 156, 152, 144, 158, 152, 144, 162, 152, 156, 154, 156, 172, 160, 156, 172, 148, 166, 166, 164, 146, 162, 158, 144, 166, 146, 154, 150, 152, 154, 148, 152, 164, 142, 154, 158, 158, 158, 162, 170, 148, 176, 156, 156, 156, 154, 166, 148, 150, 164, 140, 152, 152, 152, 148, 154, 158, 144, 168, 148, 164, 164, 162, 166, 154, 168, 170, 150, 164, 166, 164, 148, 166, 152, 134, 168, 152, 144, 158, 144, 164, 146, 156, 160, 148, 160, 162, 162, 158, 174, 156, 154, 170, 160, 162, 160, 154, 162, 148, 154, 164, 138, 158, 158, 142, 150, 160, 162, 148, 162, 148, 170, 160, 158, 172, 158, 158, 172, 158, 160}, + {166, 146, 160, 154, 154, 170, 148, 164, 166, 152, 164, 172, 162, 146, 166, 156, 150, 154, 150, 156, 146, 150, 162, 142, 154, 162, 150, 158, 152, 156, 154, 172, 166, 150, 172, 158, 162, 168, 148, 164, 142, 166, 154, 140, 150, 166, 150, 142, 160, 156, 136, 162, 150, 158, 164, 162, 174, 158, 156, 180, 150, 158, 166, 156, 148, 172, 154, 146, 170, 146, 146, 152, 148, 160, 138, 160, 168, 138, 158, 172, 164, 148, 176, 152, 154, 174, 160, 162, 154, 156, 166, 140, 152, 162, 144, 152, 154, 150, 140, 166, 158, 144, 170, 146, 156, 160, 156, 176, 156, 158, 174, 146, 150, 162, 156, 150, 168, 152, 138, 160, 150, 152, 156, 152, 162, 148, 148, 172, 142, 162, 160, 150, 150, 160, 152, 148, 160, 138, 144, 156, 132, 164, 132, 144, 160, 132, 146, 156, 148, 148, 162, 160, 138, 172, 160, 152, 166, 148, 166, 146, 150, 158, 136, 148, 148, 152, 134, 150, 140, 132, 158, 146, 150, 160, 146, 168, 148, 152, 176, 142, 168, 162, 154, 160, 166, 162, 150, 168, 154, 154, 158, 142, 158, 142, 150, 162, 144, 150, 158, 148, 152, 162, 160, 152, 170, 156, 168, 164, 156, 176, 154, 156, 166, 142, 164, 162, 146, 142, 156, 154, 142, 160, 158, 152, 158, 156, 170, 148, 156, 168, 154, 156, 180, 150, 156, 164, 164, 134, 170, 148, 146, 162, 144, 156, 150, 148, 160, 138, 158, 166, 152, 152, 168, 156, 150, 164, 166, 152, 166, 156, 168, 156, 158, 170, 142, 156, 160, 148, 140, 160, 152, 140, 166, 158, 148, 168, 156, 164, 160, 162, 168, 158, 166, 166, 158, 154, 168, 154, 148, 166, 148, 150, 158, 148, 162, 148, 152, 162, 144, 152, 166, 154, 154, 170, 160, 144, 166, 168, 158, 162, 150, 166, 150, 150, 176, 140, 150, 164, 140, 152, 156, 156, 146, 170, 156, 150, 170, 148, 168, 162, 162, 174, 154, 162, 166, 146, 160, 158, 156, 140, 154, 154, 140, 160, 146, 158, 156, 146, 168, 144, 162, 160, 152, 160, 170, 156, 158, 170, 158, 150}, + {134, 162, 164, 156, 148, 166, 162, 146, 174, 160, 156, 164, 156, 168, 148, 158, 172, 144, 150, 162, 146, 144, 164, 148, 144, 172, 150, 156, 162, 156, 166, 152, 162, 172, 150, 160, 172, 146, 152, 170, 152, 140, 172, 154, 154, 150, 152, 160, 148, 156, 162, 144, 158, 170, 144, 148, 168, 160, 156, 164, 166, 154, 160, 166, 160, 146, 154, 166, 132, 156, 164, 144, 146, 160, 160, 136, 158, 166, 152, 164, 154, 166, 164, 162, 178, 142, 162, 168, 148, 156, 160, 156, 150, 164, 150, 146, 154, 150, 158, 150, 156, 170, 144, 162, 172, 154, 152, 166, 162, 156, 168, 170, 152, 168, 148, 160, 146, 156, 162, 140, 148, 162, 138, 144, 164, 154, 154, 166, 160, 158, 166, 160, 162, 152, 148, 172, 140, 150, 158, 130, 148, 150, 148, 134, 148, 152, 140, 150, 152, 162, 154, 152, 170, 146, 156, 178, 142, 154, 164, 150, 146, 158, 150, 138, 156, 134, 154, 142, 148, 160, 136, 142, 164, 136, 150, 168, 158, 146, 164, 166, 150, 170, 164, 162, 164, 158, 168, 146, 158, 168, 142, 150, 162, 156, 138, 166, 146, 150, 164, 150, 158, 154, 160, 166, 154, 162, 168, 148, 160, 162, 156, 152, 168, 154, 146, 156, 152, 154, 152, 156, 158, 146, 154, 158, 148, 148, 160, 158, 150, 172, 160, 158, 168, 166, 156, 166, 152, 170, 138, 162, 166, 136, 154, 160, 146, 150, 160, 166, 138, 158, 158, 160, 162, 162, 174, 154, 156, 180, 150, 160, 160, 150, 148, 156, 158, 142, 164, 150, 148, 152, 144, 170, 136, 156, 172, 138, 154, 166, 154, 150, 178, 158, 148, 170, 158, 152, 158, 158, 162, 144, 160, 162, 140, 148, 158, 148, 144, 164, 156, 152, 166, 156, 156, 162, 162, 174, 154, 150, 176, 154, 152, 166, 146, 150, 170, 154, 138, 158, 154, 150, 152, 144, 168, 146, 152, 168, 146, 166, 176, 148, 148, 172, 152, 156, 168, 154, 158, 164, 148, 166, 150, 146, 166, 142, 150, 164, 138, 150, 160, 164, 140, 170, 162, 156, 162, 164, 174, 152, 156, 172}, + {160, 142, 160, 156, 162, 156, 166, 176, 160, 152, 180, 148, 158, 166, 156, 142, 162, 160, 144, 150, 154, 158, 152, 150, 160, 138, 154, 170, 144, 150, 172, 156, 150, 178, 162, 154, 164, 168, 162, 154, 156, 168, 142, 150, 166, 142, 144, 152, 156, 138, 166, 160, 144, 156, 168, 158, 162, 164, 172, 152, 158, 180, 146, 150, 168, 152, 144, 166, 156, 148, 154, 154, 154, 150, 156, 166, 146, 154, 168, 146, 154, 172, 148, 154, 164, 170, 154, 158, 160, 156, 156, 152, 162, 142, 152, 168, 134, 148, 168, 142, 144, 162, 160, 146, 158, 164, 160, 164, 160, 174, 148, 156, 180, 136, 160, 164, 144, 144, 172, 144, 146, 162, 162, 154, 152, 150, 168, 148, 154, 166, 150, 150, 174, 144, 154, 168, 150, 142, 152, 146, 146, 146, 148, 150, 138, 142, 158, 140, 150, 162, 144, 148, 170, 154, 152, 162, 164, 152, 160, 156, 166, 144, 152, 154, 130, 150, 156, 138, 136, 154, 144, 142, 154, 156, 152, 162, 154, 164, 154, 152, 178, 150, 160, 174, 150, 154, 166, 158, 150, 164, 160, 152, 154, 154, 158, 148, 148, 164, 138, 156, 168, 150, 144, 172, 158, 152, 166, 170, 160, 172, 172, 154, 150, 156, 168, 144, 146, 166, 144, 140, 162, 146, 146, 168, 160, 154, 160, 156, 162, 156, 164, 172, 148, 158, 178, 148, 158, 166, 152, 138, 162, 160, 148, 150, 152, 158, 150, 138, 172, 146, 154, 166, 148, 150, 166, 160, 160, 168, 168, 156, 158, 168, 164, 158, 152, 162, 142, 150, 168, 136, 146, 162, 156, 142, 158, 162, 152, 164, 170, 164, 158, 156, 182, 138, 166, 180, 140, 150, 162, 154, 138, 160, 154, 148, 154, 152, 158, 152, 154, 170, 140, 158, 170, 154, 150, 172, 158, 166, 180, 158, 152, 158, 154, 160, 146, 154, 162, 144, 146, 168, 142, 146, 168, 150, 154, 162, 156, 154, 166, 170, 162, 160, 164, 176, 152, 154, 166, 144, 152, 166, 150, 146, 154, 154, 140, 160, 162, 156, 160, 150, 172, 144, 158, 180, 146, 154, 172, 162, 154, 164}, + {144, 162, 146, 152, 164, 146, 156, 164, 160, 158, 164, 164, 162, 160, 160, 162, 158, 146, 172, 146, 152, 160, 138, 148, 158, 156, 146, 156, 162, 160, 158, 166, 164, 154, 156, 178, 150, 162, 166, 150, 146, 168, 150, 150, 152, 162, 144, 160, 150, 160, 150, 154, 170, 154, 142, 170, 154, 154, 174, 152, 158, 164, 164, 158, 156, 162, 158, 152, 150, 164, 138, 148, 168, 138, 146, 162, 156, 148, 172, 164, 156, 156, 172, 166, 164, 154, 176, 152, 152, 164, 156, 142, 166, 150, 144, 152, 164, 144, 154, 162, 160, 150, 156, 164, 156, 154, 184, 148, 154, 168, 162, 148, 166, 164, 154, 158, 160, 154, 148, 150, 162, 142, 142, 164, 140, 150, 166, 150, 150, 160, 166, 154, 154, 158, 158, 152, 154, 162, 140, 144, 160, 130, 140, 154, 144, 142, 156, 152, 142, 158, 154, 160, 152, 160, 162, 146, 158, 164, 142, 152, 160, 146, 140, 148, 152, 144, 148, 146, 142, 142, 148, 158, 140, 144, 170, 142, 150, 170, 148, 162, 166, 164, 154, 168, 170, 162, 160, 158, 160, 144, 148, 166, 140, 146, 162, 144, 148, 160, 154, 148, 160, 162, 160, 150, 166, 178, 148, 152, 174, 142, 152, 170, 154, 150, 166, 160, 146, 156, 158, 150, 150, 156, 160, 146, 152, 164, 146, 150, 176, 154, 152, 174, 162, 154, 166, 170, 152, 158, 160, 164, 154, 146, 170, 142, 148, 164, 142, 148, 166, 154, 152, 160, 170, 154, 162, 162, 166, 152, 152, 182, 146, 148, 170, 144, 148, 172, 154, 146, 152, 164, 152, 148, 156, 164, 150, 152, 170, 144, 150, 176, 148, 158, 162, 168, 152, 160, 168, 158, 156, 158, 166, 150, 152, 162, 140, 142, 166, 140, 148, 168, 158, 154, 162, 162, 160, 166, 158, 170, 148, 152, 172, 146, 156, 166, 152, 146, 160, 148, 146, 156, 156, 152, 152, 156, 160, 152, 154, 166, 150, 152, 174, 150, 154, 166, 160, 154, 158, 160, 158, 158, 156, 154, 150, 144, 162, 146, 136, 168, 144, 150, 162, 154, 158, 166, 166, 160, 162, 160, 174, 154}, + {148, 164, 156, 154, 154, 168, 156, 164, 164, 166, 154, 160, 170, 148, 160, 166, 142, 160, 154, 154, 146, 156, 162, 148, 148, 158, 154, 154, 154, 164, 150, 150, 174, 156, 156, 162, 164, 156, 158, 164, 164, 152, 158, 166, 140, 146, 166, 136, 148, 168, 144, 148, 160, 152, 162, 166, 166, 156, 160, 166, 170, 162, 154, 172, 138, 152, 170, 146, 150, 166, 148, 146, 154, 156, 154, 152, 154, 166, 146, 154, 164, 158, 156, 180, 146, 162, 166, 162, 156, 160, 158, 154, 158, 152, 162, 146, 136, 168, 142, 146, 166, 148, 148, 174, 152, 152, 164, 172, 164, 162, 158, 176, 154, 154, 166, 150, 146, 168, 144, 152, 156, 158, 146, 158, 158, 152, 162, 160, 164, 154, 158, 168, 160, 146, 166, 144, 144, 156, 142, 142, 146, 154, 144, 146, 146, 150, 146, 138, 158, 148, 154, 172, 152, 152, 164, 162, 152, 158, 164, 154, 158, 156, 156, 146, 140, 154, 136, 136, 162, 138, 142, 154, 150, 142, 156, 158, 154, 158, 158, 164, 152, 166, 162, 152, 156, 178, 146, 158, 166, 148, 160, 156, 160, 158, 148, 162, 152, 150, 154, 160, 144, 152, 164, 152, 150, 162, 164, 160, 168, 170, 160, 156, 158, 168, 152, 152, 164, 144, 152, 166, 140, 138, 164, 146, 146, 162, 160, 158, 154, 166, 164, 154, 164, 178, 146, 160, 170, 134, 152, 160, 152, 146, 160, 152, 148, 156, 154, 160, 144, 160, 162, 146, 148, 172, 154, 154, 176, 150, 166, 160, 170, 158, 152, 168, 152, 150, 156, 162, 144, 140, 162, 150, 142, 162, 148, 152, 166, 166, 154, 164, 166, 164, 164, 152, 170, 156, 146, 164, 152, 142, 166, 146, 148, 150, 160, 150, 152, 162, 154, 150, 156, 158, 156, 152, 176, 148, 160, 170, 162, 158, 160, 154, 154, 156, 156, 160, 154, 150, 160, 146, 146, 162, 146, 144, 166, 152, 154, 160, 170, 162, 158, 174, 166, 160, 160, 166, 156, 144, 172, 138, 144, 172, 138, 156, 158, 160, 154, 156, 154, 164, 156, 160, 164, 150, 160, 174, 150, 158, 164, 160}, + {160, 144, 156, 162, 156, 146, 170, 146, 158, 176, 156, 158, 164, 170, 152, 154, 160, 158, 150, 154, 162, 146, 144, 166, 144, 146, 170, 146, 156, 166, 162, 156, 154, 170, 162, 160, 164, 164, 154, 154, 160, 154, 150, 154, 156, 152, 154, 158, 150, 152, 158, 158, 154, 158, 160, 150, 150, 172, 158, 158, 164, 158, 160, 158, 162, 164, 146, 156, 164, 146, 152, 162, 146, 156, 158, 146, 154, 156, 152, 154, 160, 162, 160, 150, 168, 170, 156, 162, 168, 150, 150, 168, 150, 148, 158, 148, 166, 148, 152, 158, 150, 156, 160, 148, 164, 162, 150, 162, 162, 160, 156, 162, 158, 152, 164, 152, 154, 152, 158, 148, 150, 154, 166, 146, 144, 166, 144, 154, 164, 152, 150, 168, 146, 164, 156, 164, 156, 148, 150, 150, 144, 144, 146, 142, 144, 152, 140, 148, 156, 152, 152, 148, 158, 158, 156, 162, 162, 160, 150, 158, 152, 148, 154, 148, 140, 152, 154, 144, 142, 148, 142, 144, 146, 156, 150, 148, 168, 150, 156, 170, 156, 156, 176, 158, 162, 162, 164, 160, 152, 164, 156, 152, 150, 158, 140, 142, 156, 150, 144, 166, 156, 162, 154, 166, 154, 164, 164, 170, 152, 164, 164, 156, 156, 168, 154, 156, 160, 152, 144, 150, 160, 156, 152, 160, 156, 152, 154, 158, 158, 150, 172, 156, 156, 162, 162, 168, 158, 166, 162, 152, 154, 164, 140, 154, 158, 154, 144, 162, 148, 148, 166, 152, 162, 156, 160, 170, 154, 166, 168, 158, 154, 170, 152, 142, 162, 152, 148, 158, 146, 156, 152, 152, 162, 146, 156, 172, 148, 148, 166, 156, 162, 168, 154, 162, 176, 156, 156, 162, 160, 162, 156, 154, 156, 154, 150, 152, 152, 140, 168, 152, 148, 166, 152, 152, 166, 166, 164, 158, 166, 172, 156, 158, 158, 156, 150, 156, 146, 144, 164, 156, 148, 160, 154, 158, 152, 160, 158, 156, 162, 164, 162, 148, 166, 158, 152, 166, 154, 160, 152, 166, 152, 146, 158, 148, 148, 148, 154, 146, 154, 162, 154, 146, 170, 158, 156, 164, 166, 156, 162, 164}, + {162, 154, 150, 160, 158, 156, 160, 164, 166, 154, 162, 162, 164, 158, 166, 152, 156, 160, 154, 148, 160, 148, 158, 148, 158, 150, 144, 166, 154, 150, 158, 162, 166, 160, 168, 162, 154, 164, 166, 156, 162, 156, 160, 154, 156, 152, 144, 162, 146, 156, 154, 154, 152, 150, 170, 158, 156, 160, 166, 162, 156, 168, 164, 158, 164, 156, 158, 152, 154, 152, 154, 152, 144, 152, 146, 148, 160, 156, 158, 162, 156, 156, 168, 170, 156, 162, 154, 160, 160, 156, 166, 152, 156, 160, 148, 152, 152, 154, 154, 150, 158, 150, 162, 156, 150, 164, 166, 154, 168, 156, 168, 158, 168, 166, 148, 154, 166, 148, 148, 162, 148, 146, 154, 150, 152, 156, 158, 150, 164, 150, 168, 158, 166, 152, 158, 144, 166, 144, 140, 156, 142, 146, 150, 142, 152, 142, 146, 144, 152, 148, 154, 156, 162, 156, 158, 162, 156, 156, 156, 158, 152, 148, 156, 148, 156, 142, 150, 142, 146, 144, 162, 144, 142, 156, 152, 154, 152, 156, 156, 156, 154, 166, 154, 166, 160, 164, 158, 158, 156, 148, 160, 152, 152, 162, 154, 156, 154, 152, 160, 148, 160, 154, 156, 160, 162, 160, 152, 170, 158, 156, 164, 164, 156, 152, 156, 162, 146, 164, 160, 146, 146, 154, 150, 144, 160, 156, 152, 172, 154, 160, 158, 168, 164, 154, 170, 152, 164, 152, 156, 162, 150, 162, 158, 144, 156, 148, 154, 142, 158, 160, 150, 160, 162, 160, 156, 160, 170, 158, 164, 156, 162, 156, 152, 174, 154, 156, 164, 148, 154, 156, 146, 164, 144, 160, 150, 150, 154, 160, 154, 162, 162, 156, 164, 164, 152, 166, 162, 160, 146, 164, 146, 156, 154, 148, 156, 162, 150, 160, 150, 160, 158, 150, 158, 170, 152, 166, 158, 160, 154, 166, 158, 152, 166, 152, 156, 160, 158, 158, 146, 146, 154, 154, 152, 154, 154, 156, 160, 162, 152, 168, 154, 172, 164, 164, 160, 160, 162, 158, 158, 152, 152, 158, 152, 160, 148, 148, 164, 152, 152, 160, 152, 166, 150, 164, 164, 160, 158, 166, 164, 156}, + {150, 160, 152, 150, 156, 160, 162, 156, 158, 166, 166, 162, 162, 164, 150, 160, 160, 158, 146, 158, 150, 162, 144, 154, 146, 158, 162, 148, 154, 156, 156, 156, 156, 162, 158, 164, 164, 158, 166, 152, 160, 166, 148, 164, 152, 154, 152, 150, 154, 150, 148, 158, 154, 160, 152, 162, 154, 164, 162, 162, 162, 168, 158, 160, 152, 160, 148, 156, 158, 158, 146, 150, 162, 152, 160, 162, 150, 152, 164, 154, 158, 156, 168, 152, 164, 162, 164, 168, 156, 160, 150, 162, 160, 146, 166, 144, 154, 148, 150, 158, 144, 158, 158, 158, 160, 156, 158, 156, 172, 166, 156, 170, 166, 148, 168, 150, 158, 160, 158, 150, 154, 150, 156, 154, 156, 158, 152, 164, 150, 160, 156, 158, 156, 160, 150, 168, 154, 156, 160, 142, 148, 144, 146, 156, 140, 150, 144, 150, 144, 146, 162, 150, 152, 162, 160, 148, 162, 162, 154, 164, 158, 158, 146, 154, 144, 152, 144, 152, 140, 144, 146, 144, 148, 150, 154, 150, 160, 160, 152, 166, 164, 154, 168, 160, 172, 152, 164, 162, 154, 164, 154, 156, 148, 156, 156, 148, 156, 156, 142, 158, 154, 152, 160, 150, 160, 156, 166, 158, 168, 168, 164, 160, 158, 162, 164, 140, 168, 146, 150, 152, 156, 150, 158, 160, 144, 166, 150, 150, 164, 154, 172, 164, 162, 158, 162, 166, 160, 154, 168, 152, 162, 152, 152, 150, 156, 154, 148, 160, 158, 148, 154, 160, 158, 152, 156, 172, 150, 168, 158, 168, 162, 160, 164, 146, 160, 156, 146, 162, 150, 152, 154, 144, 162, 150, 158, 158, 160, 152, 164, 164, 160, 172, 160, 160, 164, 162, 158, 156, 164, 148, 156, 160, 154, 156, 142, 152, 152, 152, 160, 150, 156, 160, 156, 158, 166, 156, 168, 156, 170, 158, 166, 164, 150, 158, 158, 154, 148, 156, 154, 154, 156, 138, 154, 164, 154, 152, 162, 152, 156, 160, 168, 156, 166, 158, 168, 152, 156, 166, 154, 160, 160, 148, 150, 144, 158, 152, 156, 154, 152, 154, 160, 152, 164, 164, 158, 152, 162, 168, 152, 166}, + {152, 158, 150, 170, 152, 160, 154, 158, 164, 160, 156, 168, 160, 154, 170, 162, 152, 162, 162, 148, 154, 148, 162, 144, 152, 160, 144, 156, 158, 164, 152, 172, 152, 158, 162, 168, 152, 172, 160, 162, 156, 148, 160, 156, 150, 160, 152, 148, 160, 160, 144, 160, 160, 148, 158, 158, 156, 154, 164, 168, 164, 146, 168, 168, 152, 160, 162, 154, 156, 158, 148, 156, 152, 150, 154, 144, 158, 154, 148, 164, 162, 150, 166, 170, 152, 168, 170, 150, 158, 172, 152, 156, 148, 160, 148, 154, 156, 158, 146, 162, 166, 134, 166, 154, 144, 158, 168, 162, 160, 152, 166, 158, 160, 166, 154, 158, 158, 164, 146, 152, 158, 150, 154, 154, 150, 154, 154, 154, 152, 154, 168, 166, 146, 162, 162, 146, 162, 150, 144, 148, 152, 138, 148, 142, 150, 138, 148, 144, 154, 144, 154, 168, 148, 158, 158, 158, 156, 166, 156, 158, 148, 162, 146, 144, 156, 148, 146, 140, 156, 140, 148, 148, 142, 150, 152, 156, 154, 150, 164, 152, 152, 164, 162, 158, 162, 172, 150, 162, 160, 150, 162, 162, 154, 152, 152, 156, 146, 148, 164, 152, 150, 164, 160, 156, 162, 158, 156, 162, 170, 152, 162, 166, 156, 154, 146, 170, 148, 156, 166, 154, 142, 162, 156, 138, 160, 150, 160, 162, 154, 156, 148, 158, 166, 160, 154, 170, 168, 152, 156, 166, 152, 156, 166, 144, 154, 158, 160, 146, 146, 160, 150, 150, 158, 158, 156, 160, 174, 150, 172, 168, 154, 160, 156, 164, 148, 150, 166, 152, 144, 154, 164, 150, 156, 160, 142, 158, 166, 152, 156, 156, 168, 154, 158, 166, 162, 158, 164, 168, 146, 168, 154, 142, 154, 164, 146, 152, 156, 152, 144, 160, 154, 156, 152, 162, 160, 156, 168, 168, 150, 170, 158, 152, 158, 162, 162, 152, 158, 156, 144, 156, 152, 162, 148, 162, 152, 156, 154, 168, 150, 164, 162, 166, 154, 168, 156, 170, 150, 156, 160, 148, 156, 160, 152, 164, 150, 152, 152, 148, 164, 150, 150, 168, 152, 144, 166, 168, 160, 166, 170, 158}, + {146, 138, 176, 150, 144, 160, 166, 156, 164, 170, 150, 170, 172, 154, 154, 154, 164, 154, 148, 168, 152, 144, 156, 156, 148, 158, 162, 144, 160, 158, 154, 150, 164, 172, 162, 150, 172, 156, 156, 166, 160, 148, 168, 160, 146, 158, 162, 140, 150, 154, 156, 148, 150, 168, 152, 148, 174, 160, 146, 174, 168, 152, 164, 164, 156, 162, 154, 154, 156, 144, 162, 152, 138, 166, 162, 146, 160, 162, 148, 164, 164, 150, 156, 164, 166, 164, 156, 174, 154, 138, 170, 158, 152, 158, 166, 140, 154, 162, 144, 146, 156, 156, 156, 148, 170, 158, 146, 168, 170, 152, 168, 170, 150, 156, 170, 146, 162, 148, 162, 146, 154, 162, 152, 140, 160, 154, 148, 160, 168, 146, 162, 164, 154, 154, 162, 154, 150, 152, 152, 146, 142, 154, 150, 132, 152, 148, 142, 154, 152, 148, 152, 152, 156, 154, 158, 162, 156, 144, 172, 152, 150, 162, 160, 140, 152, 152, 132, 152, 146, 146, 144, 140, 158, 148, 140, 158, 162, 144, 166, 168, 146, 172, 166, 158, 160, 158, 168, 154, 158, 168, 160, 136, 172, 160, 142, 158, 164, 142, 152, 168, 140, 158, 156, 162, 152, 160, 168, 162, 148, 176, 162, 152, 170, 166, 150, 154, 166, 144, 154, 156, 154, 144, 150, 168, 150, 152, 166, 156, 144, 170, 166, 158, 158, 176, 152, 164, 164, 156, 166, 150, 156, 154, 138, 174, 150, 134, 160, 162, 144, 162, 166, 150, 158, 164, 148, 160, 154, 164, 166, 148, 174, 160, 152, 160, 160, 152, 158, 160, 152, 152, 150, 150, 150, 152, 158, 158, 138, 168, 160, 150, 164, 176, 154, 158, 178, 154, 158, 160, 154, 158, 150, 170, 156, 140, 164, 154, 138, 164, 168, 134, 164, 162, 150, 156, 162, 166, 156, 164, 170, 164, 152, 164, 164, 150, 154, 166, 142, 158, 164, 148, 154, 158, 150, 146, 162, 152, 158, 148, 170, 156, 142, 182, 166, 154, 170, 160, 156, 162, 156, 150, 150, 158, 154, 148, 144, 160, 156, 146, 154, 164, 152, 162, 168, 156, 164, 168, 158, 160, 156, 172}, + {170, 144, 150, 162, 150, 160, 158, 162, 158, 156, 170, 160, 142, 172, 170, 146, 164, 162, 150, 160, 162, 146, 154, 160, 148, 150, 150, 168, 156, 146, 162, 168, 142, 160, 174, 152, 164, 180, 152, 158, 160, 158, 162, 152, 158, 158, 136, 166, 158, 132, 172, 162, 142, 156, 166, 146, 154, 160, 166, 158, 164, 172, 160, 152, 170, 168, 144, 162, 174, 144, 156, 160, 156, 148, 148, 156, 154, 154, 160, 156, 152, 168, 162, 138, 178, 162, 158, 162, 174, 158, 152, 158, 152, 156, 146, 174, 148, 130, 172, 162, 140, 164, 164, 146, 158, 172, 156, 162, 160, 166, 160, 154, 178, 162, 144, 172, 158, 140, 166, 170, 140, 150, 166, 144, 154, 158, 154, 154, 148, 166, 156, 136, 174, 160, 142, 170, 164, 138, 152, 160, 150, 148, 146, 154, 142, 142, 154, 152, 136, 160, 154, 138, 168, 162, 150, 158, 172, 148, 160, 164, 150, 152, 154, 156, 150, 126, 170, 146, 130, 164, 150, 138, 148, 156, 146, 152, 156, 152, 156, 152, 168, 154, 150, 170, 166, 148, 176, 176, 142, 162, 162, 148, 156, 160, 148, 152, 150, 162, 158, 130, 176, 154, 144, 164, 166, 148, 166, 172, 152, 162, 174, 154, 154, 158, 156, 162, 150, 160, 156, 136, 160, 162, 146, 160, 166, 136, 162, 162, 152, 160, 158, 162, 164, 156, 170, 160, 146, 170, 164, 144, 164, 166, 144, 152, 156, 156, 156, 148, 158, 150, 148, 160, 166, 132, 174, 166, 146, 172, 172, 156, 166, 164, 158, 148, 164, 154, 160, 150, 158, 160, 136, 168, 158, 138, 160, 166, 152, 160, 162, 154, 160, 150, 170, 166, 146, 180, 162, 146, 168, 160, 144, 154, 162, 144, 156, 160, 150, 152, 142, 174, 150, 150, 166, 160, 140, 168, 168, 148, 164, 168, 156, 154, 160, 156, 160, 154, 160, 154, 144, 162, 154, 138, 164, 162, 136, 164, 166, 158, 152, 164, 168, 156, 158, 170, 154, 158, 164, 154, 140, 178, 170, 136, 160, 156, 146, 160, 152, 150, 158, 152, 158, 152, 150, 164, 162, 146, 174, 168, 150, 172}, + {148, 158, 158, 142, 172, 156, 142, 166, 170, 148, 166, 166, 164, 164, 162, 164, 158, 152, 162, 154, 142, 162, 162, 130, 166, 160, 138, 158, 166, 142, 164, 148, 162, 158, 162, 170, 164, 140, 172, 162, 146, 168, 164, 142, 160, 158, 150, 152, 162, 148, 150, 146, 158, 162, 144, 174, 166, 142, 168, 162, 150, 160, 178, 146, 164, 146, 160, 160, 142, 164, 158, 142, 160, 164, 138, 164, 164, 138, 156, 166, 146, 160, 158, 170, 162, 156, 166, 164, 144, 168, 162, 144, 168, 166, 142, 156, 166, 146, 152, 144, 162, 154, 144, 168, 154, 150, 162, 158, 148, 170, 176, 150, 162, 170, 152, 166, 158, 156, 148, 148, 156, 162, 140, 166, 160, 132, 172, 154, 146, 162, 170, 146, 160, 156, 158, 158, 144, 172, 144, 140, 150, 154, 138, 158, 160, 126, 154, 152, 142, 146, 152, 160, 158, 154, 158, 164, 148, 166, 160, 132, 174, 170, 136, 160, 160, 144, 144, 150, 144, 146, 138, 154, 142, 144, 154, 154, 142, 174, 162, 146, 162, 168, 152, 164, 162, 168, 156, 156, 166, 162, 150, 170, 160, 136, 168, 166, 140, 154, 156, 148, 154, 168, 146, 164, 154, 168, 148, 154, 174, 166, 142, 176, 156, 150, 168, 164, 148, 162, 160, 152, 148, 154, 140, 154, 144, 166, 160, 146, 172, 164, 148, 162, 170, 152, 162, 174, 158, 162, 150, 168, 156, 148, 164, 158, 142, 168, 152, 140, 160, 170, 146, 156, 154, 160, 156, 150, 170, 160, 150, 168, 164, 150, 172, 176, 138, 166, 166, 144, 158, 160, 150, 156, 144, 164, 154, 140, 164, 154, 146, 178, 162, 144, 182, 164, 154, 158, 160, 162, 156, 146, 158, 148, 152, 162, 154, 140, 166, 168, 138, 152, 170, 150, 162, 166, 152, 160, 164, 164, 168, 148, 182, 162, 144, 174, 162, 142, 168, 166, 130, 160, 156, 144, 156, 146, 162, 152, 146, 158, 164, 148, 162, 172, 144, 166, 176, 152, 160, 166, 154, 152, 154, 162, 156, 154, 156, 154, 152, 162, 160, 136, 164, 170, 142, 166, 162, 152, 164, 160, 164, 154}, + {142, 158, 156, 148, 154, 152, 158, 158, 148, 162, 164, 158, 172, 168, 150, 158, 164, 150, 160, 158, 156, 150, 152, 154, 150, 150, 160, 158, 146, 170, 162, 150, 174, 152, 152, 166, 162, 160, 172, 158, 160, 156, 154, 160, 156, 150, 168, 148, 142, 164, 160, 148, 160, 160, 152, 158, 154, 162, 162, 160, 170, 172, 148, 176, 162, 156, 162, 166, 152, 162, 160, 142, 160, 148, 156, 152, 142, 160, 160, 144, 168, 164, 150, 166, 168, 156, 162, 174, 156, 160, 162, 148, 162, 148, 158, 160, 146, 152, 158, 150, 160, 158, 148, 164, 162, 148, 152, 168, 156, 174, 144, 172, 158, 150, 172, 166, 146, 166, 166, 144, 164, 156, 146, 154, 146, 160, 150, 154, 158, 166, 146, 170, 152, 150, 164, 170, 150, 156, 166, 140, 158, 146, 134, 150, 140, 154, 148, 140, 156, 162, 136, 156, 160, 148, 164, 162, 148, 154, 168, 162, 154, 148, 158, 152, 136, 156, 150, 142, 154, 154, 142, 154, 150, 142, 156, 150, 152, 148, 150, 166, 154, 154, 160, 178, 154, 170, 168, 158, 154, 164, 152, 160, 146, 160, 152, 150, 150, 156, 146, 158, 160, 142, 160, 160, 144, 166, 166, 150, 168, 168, 156, 162, 162, 162, 152, 158, 160, 158, 144, 168, 158, 146, 170, 160, 142, 162, 154, 148, 160, 154, 158, 168, 144, 166, 168, 152, 170, 164, 150, 156, 170, 148, 160, 158, 144, 152, 152, 154, 150, 140, 164, 164, 152, 172, 162, 160, 162, 174, 148, 170, 170, 152, 166, 142, 162, 164, 142, 164, 162, 140, 160, 156, 140, 156, 162, 150, 162, 164, 148, 156, 152, 162, 164, 160, 164, 164, 150, 168, 164, 156, 166, 170, 146, 152, 162, 144, 154, 140, 156, 158, 144, 156, 160, 152, 166, 162, 150, 168, 176, 146, 164, 166, 156, 158, 150, 156, 152, 144, 172, 154, 146, 166, 158, 150, 164, 158, 148, 164, 158, 148, 168, 162, 168, 160, 156, 162, 168, 146, 170, 166, 148, 156, 164, 140, 160, 156, 144, 152, 154, 154, 160, 146, 174, 162, 152, 164, 168, 156, 180, 168}, + {152, 150, 154, 164, 158, 154, 172, 156, 158, 160, 156, 156, 162, 158, 164, 154, 160, 152, 168, 150, 164, 154, 158, 162, 152, 156, 158, 154, 152, 158, 152, 156, 162, 156, 162, 170, 158, 162, 164, 158, 164, 152, 158, 158, 156, 146, 154, 164, 142, 160, 148, 152, 160, 148, 158, 158, 162, 162, 162, 152, 172, 158, 156, 166, 160, 148, 168, 154, 158, 158, 146, 156, 158, 150, 158, 146, 162, 160, 154, 148, 164, 150, 156, 154, 164, 156, 168, 158, 166, 164, 152, 166, 156, 158, 166, 158, 144, 166, 154, 142, 154, 150, 154, 158, 154, 156, 170, 154, 164, 152, 170, 166, 166, 156, 158, 152, 162, 160, 146, 154, 152, 154, 152, 162, 148, 160, 154, 154, 162, 152, 158, 164, 156, 152, 170, 148, 152, 164, 152, 146, 152, 148, 150, 148, 150, 154, 144, 136, 156, 136, 150, 158, 150, 152, 164, 154, 154, 162, 148, 166, 154, 168, 164, 142, 152, 158, 144, 142, 158, 138, 136, 148, 142, 152, 150, 154, 154, 162, 150, 166, 158, 150, 168, 154, 156, 166, 158, 160, 166, 154, 158, 170, 148, 164, 146, 158, 166, 150, 150, 160, 154, 154, 156, 156, 150, 168, 154, 162, 164, 158, 166, 166, 164, 164, 154, 158, 160, 158, 152, 150, 146, 154, 156, 146, 160, 160, 152, 168, 156, 158, 160, 158, 162, 168, 170, 154, 168, 158, 156, 164, 150, 160, 154, 152, 160, 154, 148, 162, 156, 154, 152, 156, 148, 154, 154, 156, 156, 158, 164, 168, 156, 170, 154, 162, 166, 154, 156, 166, 134, 158, 156, 152, 150, 158, 154, 150, 164, 150, 160, 160, 160, 170, 160, 160, 170, 166, 156, 164, 154, 150, 162, 146, 150, 166, 152, 156, 166, 154, 166, 148, 158, 168, 152, 154, 160, 166, 156, 166, 148, 168, 168, 154, 168, 158, 154, 164, 158, 154, 164, 146, 146, 156, 140, 152, 152, 162, 158, 162, 152, 156, 162, 158, 168, 160, 158, 172, 152, 158, 162, 152, 152, 166, 146, 152, 158, 148, 158, 156, 152, 166, 150, 156, 166, 150, 154, 164, 160, 152, 162, 158}, + {160, 142, 160, 154, 152, 152, 156, 162, 154, 166, 170, 166, 162, 172, 164, 158, 162, 168, 152, 160, 158, 146, 150, 158, 156, 138, 156, 164, 144, 160, 162, 156, 160, 160, 164, 150, 168, 174, 158, 166, 158, 168, 146, 164, 162, 154, 158, 152, 160, 144, 160, 158, 144, 164, 160, 154, 150, 162, 158, 150, 160, 170, 160, 160, 170, 160, 154, 158, 162, 148, 160, 166, 142, 158, 158, 158, 138, 158, 166, 148, 158, 162, 162, 156, 160, 168, 162, 162, 170, 150, 158, 162, 160, 150, 152, 160, 156, 154, 158, 158, 148, 160, 166, 152, 152, 168, 148, 156, 162, 170, 148, 170, 166, 152, 162, 164, 154, 152, 164, 162, 148, 156, 158, 146, 152, 156, 158, 142, 160, 162, 150, 156, 164, 156, 144, 168, 168, 146, 162, 162, 142, 146, 160, 148, 130, 154, 146, 148, 146, 160, 150, 142, 164, 156, 154, 156, 170, 148, 154, 166, 154, 136, 166, 162, 134, 154, 148, 144, 138, 166, 158, 138, 158, 154, 138, 146, 164, 148, 154, 156, 166, 156, 156, 170, 158, 156, 168, 164, 150, 164, 166, 146, 160, 158, 160, 144, 154, 158, 146, 150, 158, 154, 154, 166, 164, 152, 158, 162, 156, 162, 178, 154, 156, 160, 162, 146, 162, 160, 152, 160, 160, 160, 140, 162, 156, 146, 158, 150, 162, 148, 170, 160, 148, 164, 162, 160, 156, 166, 160, 156, 160, 162, 150, 164, 158, 154, 148, 150, 166, 140, 156, 166, 152, 152, 162, 170, 152, 166, 176, 154, 166, 168, 160, 152, 162, 168, 148, 160, 166, 150, 146, 166, 156, 144, 150, 174, 140, 156, 162, 156, 146, 156, 164, 150, 168, 162, 160, 156, 162, 170, 150, 164, 170, 146, 142, 158, 146, 148, 158, 158, 142, 160, 162, 158, 156, 162, 164, 148, 174, 166, 158, 170, 158, 162, 148, 168, 144, 148, 166, 154, 152, 150, 166, 160, 148, 156, 164, 150, 160, 168, 160, 150, 176, 162, 154, 168, 168, 160, 154, 168, 156, 156, 162, 160, 152, 148, 162, 144, 148, 162, 150, 156, 152, 160, 156, 156, 170, 166, 156, 168}, + {156, 166, 146, 152, 168, 156, 146, 166, 156, 150, 164, 164, 162, 160, 162, 164, 152, 156, 178, 144, 158, 168, 142, 156, 158, 168, 144, 154, 170, 146, 154, 164, 160, 148, 162, 170, 144, 162, 172, 158, 146, 166, 162, 148, 158, 162, 152, 154, 154, 160, 148, 150, 174, 136, 152, 174, 156, 146, 172, 166, 152, 162, 172, 156, 160, 164, 166, 146, 164, 168, 138, 160, 170, 142, 138, 164, 158, 146, 158, 164, 156, 154, 164, 162, 148, 174, 180, 148, 152, 186, 150, 152, 174, 160, 148, 162, 152, 146, 146, 160, 158, 150, 146, 170, 148, 156, 176, 142, 154, 166, 166, 156, 168, 180, 148, 158, 166, 158, 150, 162, 172, 140, 150, 178, 144, 150, 166, 154, 148, 158, 170, 152, 150, 168, 154, 150, 160, 170, 138, 144, 168, 142, 140, 158, 148, 136, 160, 152, 144, 142, 154, 154, 136, 164, 166, 148, 156, 176, 140, 154, 168, 162, 148, 156, 168, 138, 158, 154, 150, 132, 146, 156, 128, 152, 162, 146, 138, 166, 156, 150, 166, 164, 158, 152, 176, 156, 162, 162, 170, 154, 154, 172, 146, 154, 164, 150, 146, 158, 160, 154, 154, 164, 152, 148, 156, 168, 148, 170, 162, 156, 156, 176, 162, 150, 168, 168, 152, 160, 168, 148, 148, 162, 158, 140, 150, 170, 144, 150, 168, 152, 152, 166, 170, 154, 164, 176, 160, 162, 156, 172, 140, 158, 168, 144, 152, 162, 154, 144, 158, 174, 144, 154, 168, 156, 152, 160, 164, 142, 158, 180, 146, 144, 176, 154, 156, 164, 158, 148, 154, 166, 150, 142, 166, 162, 148, 144, 176, 146, 154, 178, 156, 154, 166, 178, 152, 166, 172, 160, 156, 152, 166, 146, 148, 176, 148, 152, 170, 146, 136, 166, 158, 152, 152, 168, 156, 154, 160, 166, 144, 162, 182, 142, 148, 174, 150, 150, 172, 164, 146, 158, 162, 150, 152, 162, 154, 144, 152, 166, 146, 154, 166, 158, 156, 168, 172, 148, 160, 166, 164, 158, 156, 154, 144, 154, 170, 142, 152, 166, 146, 156, 166, 156, 150, 166, 166, 154, 158, 174, 162, 148}, + {148, 156, 158, 148, 150, 162, 164, 152, 160, 174, 142, 162, 178, 150, 154, 176, 152, 164, 156, 164, 156, 152, 160, 154, 150, 150, 164, 144, 140, 184, 138, 152, 174, 156, 152, 162, 174, 164, 154, 174, 166, 150, 154, 172, 150, 154, 178, 138, 146, 174, 144, 152, 158, 164, 154, 154, 160, 162, 154, 158, 172, 154, 156, 184, 144, 150, 172, 160, 144, 160, 160, 154, 148, 162, 162, 144, 160, 166, 144, 154, 166, 144, 150, 172, 154, 154, 160, 166, 162, 156, 160, 170, 150, 158, 170, 146, 154, 172, 140, 148, 176, 142, 154, 162, 152, 156, 160, 172, 158, 150, 166, 164, 156, 150, 180, 152, 148, 164, 152, 152, 156, 162, 150, 144, 162, 160, 156, 150, 170, 152, 150, 174, 156, 146, 178, 150, 150, 158, 160, 156, 142, 160, 160, 138, 144, 160, 138, 136, 168, 134, 146, 160, 152, 150, 154, 162, 154, 150, 168, 160, 160, 150, 170, 146, 142, 166, 142, 134, 172, 148, 142, 154, 154, 146, 146, 156, 158, 144, 160, 162, 150, 148, 174, 142, 158, 190, 144, 160, 168, 154, 162, 154, 168, 160, 156, 158, 164, 146, 152, 166, 146, 140, 178, 148, 154, 164, 164, 150, 162, 170, 168, 154, 168, 166, 152, 148, 172, 142, 152, 178, 142, 146, 174, 154, 150, 144, 172, 148, 156, 156, 160, 152, 154, 180, 142, 156, 186, 144, 162, 166, 164, 152, 160, 158, 164, 152, 148, 170, 148, 150, 172, 142, 148, 174, 150, 150, 172, 164, 160, 162, 172, 170, 156, 162, 166, 146, 160, 168, 146, 144, 174, 144, 138, 166, 152, 148, 160, 158, 164, 150, 156, 166, 152, 158, 178, 144, 150, 176, 156, 150, 170, 156, 164, 150, 154, 158, 152, 158, 164, 150, 144, 170, 152, 148, 174, 150, 160, 168, 168, 156, 164, 180, 168, 152, 160, 166, 150, 152, 166, 148, 146, 172, 142, 148, 168, 156, 152, 162, 162, 162, 148, 162, 168, 160, 152, 182, 154, 152, 174, 142, 154, 170, 154, 150, 156, 162, 154, 150, 156, 162, 136, 162, 168, 150, 142, 184, 134, 156, 176, 166}, + {162, 152, 152, 170, 148, 150, 174, 150, 148, 166, 160, 174, 160, 158, 174, 156, 154, 172, 138, 154, 168, 148, 156, 170, 134, 160, 162, 150, 158, 152, 156, 162, 156, 154, 168, 152, 160, 172, 150, 162, 172, 158, 154, 168, 146, 172, 146, 162, 158, 146, 164, 158, 142, 162, 160, 150, 150, 174, 140, 166, 162, 158, 170, 158, 164, 172, 146, 162, 164, 154, 146, 172, 148, 152, 166, 138, 154, 168, 140, 162, 162, 166, 160, 154, 158, 176, 154, 156, 176, 146, 160, 170, 140, 162, 158, 154, 156, 150, 154, 166, 144, 158, 156, 152, 156, 172, 132, 154, 178, 146, 160, 184, 146, 170, 160, 164, 166, 158, 152, 180, 144, 152, 162, 150, 152, 166, 140, 158, 160, 146, 162, 160, 150, 162, 142, 156, 168, 156, 146, 160, 144, 150, 156, 138, 150, 156, 138, 156, 142, 150, 164, 148, 148, 158, 160, 150, 172, 140, 152, 166, 150, 160, 166, 146, 156, 156, 142, 162, 144, 142, 156, 142, 142, 158, 144, 138, 162, 146, 152, 172, 144, 170, 160, 162, 176, 148, 168, 172, 154, 168, 168, 140, 156, 166, 146, 150, 164, 148, 158, 162, 154, 166, 150, 148, 168, 154, 156, 162, 152, 156, 172, 148, 162, 178, 154, 164, 166, 150, 164, 146, 168, 158, 144, 152, 164, 146, 150, 172, 146, 152, 178, 140, 166, 160, 164, 170, 158, 164, 160, 150, 158, 160, 162, 150, 168, 140, 160, 162, 138, 156, 154, 150, 164, 154, 166, 158, 154, 150, 170, 158, 154, 166, 152, 158, 174, 148, 158, 158, 166, 166, 148, 156, 170, 146, 158, 162, 148, 150, 170, 142, 166, 166, 154, 160, 170, 156, 176, 158, 160, 174, 154, 150, 170, 148, 150, 160, 146, 154, 172, 134, 164, 162, 152, 162, 156, 158, 162, 150, 154, 176, 152, 148, 164, 158, 156, 170, 152, 150, 164, 148, 152, 154, 150, 168, 152, 144, 170, 152, 154, 176, 148, 156, 178, 144, 172, 160, 164, 168, 154, 164, 162, 158, 148, 172, 150, 142, 162, 148, 148, 168, 150, 154, 168, 150, 166, 150, 170, 172, 164, 150}, + {166, 138, 164, 160, 154, 162, 152, 162, 158, 154, 162, 146, 158, 172, 164, 152, 174, 162, 152, 176, 156, 148, 164, 148, 166, 156, 140, 162, 164, 140, 162, 166, 134, 170, 164, 146, 170, 170, 152, 170, 162, 158, 160, 160, 156, 150, 152, 158, 162, 144, 154, 172, 134, 160, 166, 150, 162, 156, 166, 162, 156, 162, 158, 156, 168, 168, 146, 168, 168, 142, 166, 170, 144, 160, 146, 158, 158, 150, 160, 164, 144, 162, 160, 154, 160, 170, 148, 170, 174, 158, 156, 160, 168, 162, 156, 160, 152, 158, 156, 154, 142, 164, 164, 140, 162, 162, 156, 166, 156, 158, 168, 152, 174, 164, 148, 166, 158, 152, 164, 156, 148, 158, 164, 146, 156, 152, 156, 168, 138, 168, 162, 146, 164, 166, 146, 166, 164, 140, 176, 158, 148, 156, 152, 148, 154, 142, 156, 146, 142, 150, 150, 146, 152, 160, 140, 168, 166, 150, 156, 162, 148, 166, 150, 164, 150, 148, 148, 158, 134, 158, 158, 130, 156, 154, 140, 168, 148, 148, 150, 156, 158, 154, 156, 158, 154, 164, 158, 178, 146, 158, 168, 154, 164, 154, 160, 152, 154, 152, 154, 138, 168, 158, 140, 168, 166, 136, 170, 168, 150, 168, 158, 158, 168, 150, 158, 162, 152, 160, 154, 152, 152, 172, 138, 162, 164, 144, 164, 156, 154, 160, 148, 160, 162, 160, 162, 170, 144, 176, 168, 150, 164, 168, 148, 166, 158, 152, 162, 150, 156, 156, 148, 162, 158, 138, 168, 166, 148, 164, 168, 148, 172, 174, 156, 170, 150, 152, 166, 156, 146, 152, 154, 156, 162, 136, 158, 176, 142, 164, 158, 154, 164, 158, 162, 164, 142, 174, 166, 148, 168, 162, 150, 160, 164, 144, 164, 166, 144, 154, 154, 156, 160, 138, 164, 158, 148, 160, 174, 152, 164, 174, 152, 174, 160, 160, 170, 146, 164, 164, 156, 158, 166, 142, 156, 166, 130, 164, 164, 142, 160, 162, 146, 166, 152, 158, 164, 164, 160, 162, 154, 156, 174, 142, 170, 166, 138, 164, 162, 148, 164, 154, 164, 154, 150, 156, 162, 152, 158, 164, 148, 174}, + {154, 158, 154, 138, 166, 150, 146, 164, 170, 154, 162, 174, 156, 160, 166, 156, 154, 150, 166, 146, 150, 172, 148, 154, 158, 164, 146, 152, 166, 150, 166, 156, 160, 160, 154, 164, 156, 150, 172, 164, 152, 170, 168, 142, 168, 166, 148, 150, 178, 142, 156, 148, 170, 152, 152, 166, 158, 146, 164, 164, 148, 166, 178, 156, 168, 154, 164, 152, 152, 170, 152, 146, 162, 158, 146, 160, 162, 142, 160, 164, 150, 152, 172, 154, 154, 156, 164, 162, 152, 168, 170, 144, 164, 174, 150, 158, 168, 146, 160, 172, 146, 146, 160, 166, 148, 148, 162, 160, 148, 164, 166, 150, 166, 170, 160, 156, 164, 162, 154, 154, 166, 152, 148, 164, 156, 146, 164, 162, 144, 168, 166, 146, 172, 160, 156, 144, 158, 160, 158, 146, 164, 154, 136, 162, 148, 140, 150, 162, 142, 146, 160, 152, 148, 156, 154, 160, 146, 180, 154, 144, 168, 168, 144, 172, 156, 152, 154, 164, 136, 150, 146, 158, 144, 134, 156, 142, 146, 164, 156, 148, 160, 176, 142, 162, 176, 158, 166, 160, 170, 160, 148, 170, 150, 154, 164, 166, 146, 158, 168, 146, 152, 162, 154, 160, 146, 172, 152, 150, 174, 148, 156, 180, 164, 156, 170, 166, 148, 166, 166, 142, 158, 164, 148, 152, 144, 166, 158, 156, 164, 166, 150, 166, 166, 146, 158, 174, 156, 162, 154, 172, 152, 160, 158, 150, 150, 166, 156, 142, 168, 168, 140, 156, 164, 156, 152, 158, 168, 156, 154, 172, 158, 156, 176, 162, 150, 176, 164, 140, 172, 174, 144, 150, 158, 154, 152, 142, 166, 148, 146, 166, 166, 146, 160, 170, 158, 166, 170, 156, 156, 158, 164, 154, 154, 164, 150, 152, 166, 160, 142, 164, 166, 146, 160, 170, 146, 160, 154, 152, 160, 170, 164, 164, 146, 170, 162, 146, 168, 158, 148, 158, 160, 150, 158, 152, 162, 146, 158, 162, 166, 140, 184, 158, 156, 164, 176, 148, 168, 172, 164, 156, 158, 150, 154, 140, 174, 152, 144, 164, 156, 140, 160, 164, 152, 162, 168, 150, 164, 158, 162, 152}, + {156, 148, 168, 158, 148, 176, 154, 150, 158, 170, 146, 154, 164, 162, 170, 174, 166, 160, 154, 172, 152, 148, 168, 158, 148, 158, 158, 152, 150, 162, 154, 150, 158, 168, 158, 160, 176, 162, 156, 166, 160, 148, 162, 176, 142, 162, 164, 156, 150, 166, 156, 148, 156, 162, 152, 146, 168, 152, 148, 170, 156, 156, 160, 164, 164, 158, 174, 170, 152, 156, 164, 160, 152, 154, 158, 148, 158, 158, 150, 154, 168, 158, 152, 172, 168, 154, 156, 176, 156, 164, 168, 158, 152, 158, 156, 154, 152, 170, 150, 144, 160, 158, 148, 162, 168, 158, 148, 164, 168, 150, 164, 164, 152, 164, 172, 154, 154, 164, 162, 154, 154, 172, 158, 146, 160, 156, 142, 162, 164, 142, 154, 174, 144, 152, 158, 170, 154, 164, 158, 150, 140, 160, 150, 146, 154, 146, 148, 140, 156, 146, 146, 150, 152, 150, 156, 170, 154, 148, 150, 160, 144, 160, 162, 146, 154, 164, 142, 140, 164, 148, 148, 148, 156, 150, 144, 160, 150, 148, 160, 156, 136, 154, 174, 150, 154, 162, 166, 158, 164, 166, 154, 158, 168, 152, 150, 160, 164, 146, 156, 158, 160, 152, 160, 160, 156, 156, 168, 160, 158, 166, 162, 154, 170, 166, 148, 166, 166, 152, 154, 170, 158, 148, 168, 162, 150, 152, 158, 154, 150, 156, 166, 150, 162, 160, 162, 160, 166, 168, 160, 168, 164, 158, 154, 166, 160, 140, 166, 152, 138, 150, 164, 154, 154, 166, 158, 154, 164, 160, 154, 152, 182, 150, 156, 166, 152, 154, 158, 168, 144, 154, 170, 154, 148, 166, 168, 150, 154, 176, 152, 152, 164, 158, 160, 154, 164, 152, 166, 166, 162, 164, 166, 172, 150, 152, 170, 156, 142, 160, 160, 142, 160, 166, 144, 152, 178, 156, 150, 172, 166, 152, 162, 170, 160, 148, 172, 154, 150, 154, 176, 148, 150, 166, 152, 152, 160, 166, 150, 158, 166, 154, 150, 160, 154, 160, 158, 174, 154, 156, 164, 164, 150, 166, 172, 158, 152, 156, 150, 138, 164, 160, 144, 162, 160, 148, 154, 170, 156, 160, 168, 172}, + {158, 148, 158, 156, 152, 160, 152, 164, 160, 146, 176, 162, 150, 172, 154, 150, 168, 162, 162, 162, 154, 162, 156, 158, 162, 154, 148, 160, 162, 136, 172, 156, 152, 162, 160, 152, 156, 150, 166, 174, 160, 168, 162, 148, 180, 148, 146, 170, 162, 136, 178, 152, 146, 162, 156, 150, 162, 160, 166, 156, 152, 166, 166, 152, 176, 162, 146, 152, 166, 152, 168, 156, 154, 166, 150, 160, 156, 154, 164, 154, 140, 170, 164, 138, 172, 150, 156, 164, 168, 168, 164, 164, 160, 162, 152, 166, 160, 144, 168, 156, 146, 158, 160, 146, 162, 150, 160, 162, 154, 164, 156, 160, 178, 162, 140, 176, 170, 150, 170, 150, 150, 162, 164, 146, 164, 148, 162, 156, 160, 162, 156, 152, 164, 158, 146, 160, 160, 150, 166, 160, 154, 154, 150, 154, 150, 146, 164, 146, 136, 154, 156, 146, 156, 152, 142, 160, 156, 154, 172, 156, 164, 160, 154, 166, 172, 132, 168, 156, 136, 160, 146, 140, 156, 154, 142, 160, 142, 152, 158, 144, 172, 160, 146, 174, 160, 148, 168, 166, 156, 170, 166, 148, 164, 158, 156, 168, 148, 170, 154, 140, 162, 154, 150, 170, 156, 158, 158, 152, 156, 166, 156, 170, 162, 160, 170, 154, 146, 168, 158, 142, 170, 154, 138, 160, 158, 144, 170, 152, 154, 164, 148, 162, 158, 150, 166, 166, 148, 174, 158, 152, 162, 160, 154, 168, 156, 162, 156, 162, 166, 156, 152, 166, 156, 140, 160, 158, 146, 174, 158, 154, 162, 170, 158, 164, 170, 164, 158, 144, 170, 156, 140, 162, 152, 152, 156, 154, 156, 154, 158, 158, 164, 162, 170, 158, 154, 174, 160, 148, 170, 162, 148, 158, 158, 148, 172, 156, 154, 154, 154, 160, 152, 142, 170, 162, 140, 164, 162, 144, 166, 176, 148, 172, 162, 156, 164, 156, 176, 164, 148, 162, 150, 142, 162, 160, 142, 158, 164, 140, 170, 152, 160, 162, 160, 166, 162, 152, 174, 170, 148, 160, 162, 148, 162, 152, 160, 164, 156, 160, 166, 148, 158, 160, 152, 160, 158, 142, 170, 162, 142, 164}, + {150, 164, 162, 150, 164, 154, 144, 164, 156, 154, 170, 152, 162, 162, 162, 172, 170, 146, 170, 158, 148, 168, 160, 148, 164, 152, 152, 168, 144, 158, 164, 152, 168, 166, 136, 176, 164, 154, 168, 158, 158, 172, 152, 160, 170, 154, 160, 168, 144, 168, 150, 146, 164, 154, 154, 166, 152, 150, 168, 150, 158, 170, 156, 164, 182, 150, 162, 180, 136, 168, 166, 148, 162, 146, 164, 158, 148, 148, 180, 142, 162, 168, 144, 158, 176, 148, 174, 160, 156, 166, 162, 154, 164, 150, 158, 162, 152, 158, 166, 150, 158, 162, 146, 158, 156, 156, 162, 158, 150, 170, 156, 156, 166, 154, 170, 166, 160, 162, 170, 142, 162, 168, 138, 176, 148, 156, 162, 140, 148, 170, 156, 152, 174, 148, 162, 158, 148, 162, 156, 156, 162, 146, 144, 166, 140, 150, 152, 152, 148, 164, 144, 150, 162, 140, 158, 154, 152, 172, 144, 154, 170, 146, 144, 174, 146, 152, 156, 140, 160, 156, 138, 154, 152, 136, 156, 144, 146, 170, 142, 150, 162, 156, 158, 172, 148, 162, 176, 146, 172, 162, 156, 172, 156, 150, 176, 148, 146, 170, 146, 156, 162, 148, 158, 168, 138, 174, 166, 146, 174, 150, 166, 162, 164, 158, 172, 152, 166, 174, 148, 164, 168, 140, 172, 156, 144, 176, 148, 140, 170, 150, 152, 176, 152, 164, 174, 150, 162, 178, 154, 162, 168, 152, 170, 154, 152, 158, 154, 148, 162, 146, 154, 170, 146, 166, 172, 146, 168, 166, 150, 164, 162, 156, 176, 158, 148, 168, 150, 158, 176, 152, 158, 174, 148, 160, 160, 150, 158, 158, 150, 168, 150, 140, 172, 144, 164, 170, 160, 172, 162, 152, 164, 174, 146, 162, 162, 150, 164, 150, 152, 158, 158, 146, 166, 148, 164, 168, 146, 162, 164, 152, 168, 156, 160, 182, 152, 156, 166, 152, 154, 166, 152, 170, 164, 144, 164, 164, 142, 172, 154, 148, 170, 158, 152, 164, 160, 158, 170, 158, 156, 174, 142, 166, 166, 140, 166, 154, 148, 164, 154, 144, 176, 146, 152, 170, 150, 162, 180, 148, 162, 160}, + {156, 176, 140, 156, 156, 150, 166, 160, 154, 170, 156, 148, 170, 156, 156, 180, 150, 160, 170, 154, 150, 170, 146, 162, 160, 150, 168, 144, 160, 176, 144, 156, 168, 146, 150, 182, 152, 160, 156, 166, 162, 162, 158, 162, 156, 152, 164, 148, 154, 174, 142, 156, 162, 150, 154, 162, 152, 158, 156, 158, 168, 166, 150, 166, 154, 166, 176, 144, 166, 176, 156, 156, 164, 150, 154, 158, 152, 170, 140, 154, 170, 142, 160, 182, 144, 158, 166, 150, 156, 180, 162, 156, 168, 152, 166, 158, 152, 168, 150, 150, 170, 144, 154, 170, 152, 152, 166, 158, 160, 160, 162, 166, 156, 158, 170, 158, 154, 176, 154, 164, 168, 146, 158, 176, 140, 158, 156, 158, 158, 154, 150, 168, 146, 162, 170, 152, 156, 162, 156, 156, 156, 158, 150, 156, 154, 154, 148, 136, 168, 136, 140, 168, 136, 158, 164, 154, 150, 166, 162, 152, 158, 160, 158, 160, 162, 162, 142, 152, 170, 140, 150, 162, 144, 154, 152, 148, 154, 152, 144, 158, 150, 152, 166, 152, 156, 176, 146, 160, 182, 160, 148, 174, 156, 154, 158, 162, 160, 162, 152, 174, 148, 152, 170, 138, 164, 162, 146, 156, 178, 160, 148, 166, 154, 172, 152, 160, 170, 148, 158, 170, 144, 156, 170, 146, 154, 154, 158, 156, 162, 158, 154, 158, 160, 158, 156, 158, 172, 146, 174, 172, 142, 164, 172, 152, 154, 164, 156, 158, 154, 148, 160, 152, 150, 164, 138, 156, 176, 146, 158, 170, 156, 152, 172, 162, 168, 154, 158, 170, 152, 162, 170, 134, 168, 164, 144, 152, 174, 152, 154, 162, 154, 168, 158, 162, 164, 160, 156, 176, 146, 164, 174, 146, 164, 162, 150, 150, 172, 144, 158, 164, 150, 174, 152, 154, 170, 144, 152, 186, 154, 152, 174, 158, 162, 154, 166, 158, 168, 158, 160, 160, 140, 172, 138, 152, 170, 140, 154, 166, 156, 148, 176, 154, 160, 162, 158, 170, 158, 162, 168, 144, 166, 172, 150, 164, 170, 154, 156, 168, 148, 156, 158, 150, 164, 156, 150, 178, 142, 156, 176, 150}, + {162, 146, 158, 168, 152, 152, 162, 148, 156, 152, 172, 158, 160, 166, 156, 158, 170, 164, 150, 158, 174, 156, 164, 162, 156, 152, 164, 154, 154, 152, 164, 154, 152, 162, 162, 156, 158, 170, 158, 152, 172, 160, 164, 164, 168, 152, 158, 160, 152, 150, 156, 170, 142, 158, 172, 146, 160, 172, 158, 144, 168, 160, 158, 158, 172, 160, 148, 166, 164, 156, 156, 170, 152, 152, 172, 150, 152, 158, 162, 150, 154, 168, 156, 148, 160, 174, 154, 166, 160, 162, 156, 174, 150, 154, 168, 158, 160, 156, 172, 146, 156, 154, 168, 144, 164, 164, 150, 152, 168, 152, 160, 162, 158, 152, 168, 168, 158, 150, 164, 162, 148, 160, 168, 144, 156, 172, 144, 156, 162, 166, 146, 156, 168, 142, 150, 168, 160, 150, 150, 170, 158, 152, 166, 156, 140, 160, 156, 138, 148, 160, 150, 148, 156, 150, 148, 158, 156, 156, 158, 166, 156, 142, 160, 158, 148, 156, 164, 144, 146, 156, 156, 140, 150, 166, 148, 148, 162, 150, 146, 166, 154, 146, 162, 178, 148, 154, 164, 156, 154, 170, 180, 144, 158, 180, 154, 154, 164, 162, 146, 148, 160, 148, 148, 162, 166, 150, 156, 172, 146, 156, 180, 154, 162, 174, 158, 156, 160, 176, 152, 148, 160, 166, 150, 158, 174, 146, 148, 172, 164, 152, 170, 162, 152, 160, 172, 150, 158, 176, 160, 148, 170, 164, 150, 164, 170, 150, 150, 180, 144, 152, 166, 166, 146, 152, 168, 158, 156, 166, 166, 152, 158, 174, 158, 164, 160, 166, 160, 160, 168, 146, 154, 168, 152, 152, 162, 162, 142, 154, 170, 156, 148, 176, 156, 154, 172, 164, 148, 156, 172, 154, 150, 168, 160, 148, 166, 168, 156, 156, 164, 150, 152, 154, 166, 144, 160, 164, 160, 146, 160, 172, 152, 162, 178, 160, 154, 170, 160, 160, 160, 158, 152, 156, 166, 158, 142, 156, 168, 142, 160, 172, 152, 152, 168, 158, 154, 162, 164, 154, 162, 170, 172, 144, 168, 162, 152, 152, 172, 150, 158, 160, 156, 146, 172, 158, 154, 154, 172, 156, 152, 164}, + {156, 172, 146, 148, 170, 154, 152, 164, 154, 164, 148, 160, 172, 152, 160, 180, 162, 156, 168, 146, 152, 178, 142, 162, 160, 154, 162, 156, 162, 166, 144, 162, 162, 152, 160, 170, 158, 150, 174, 148, 158, 170, 150, 168, 150, 168, 164, 154, 168, 174, 150, 146, 174, 144, 154, 176, 148, 152, 162, 164, 156, 160, 166, 170, 150, 164, 176, 158, 154, 178, 152, 150, 174, 146, 162, 162, 144, 160, 156, 160, 156, 148, 160, 168, 156, 148, 182, 144, 162, 172, 158, 154, 182, 150, 158, 166, 152, 168, 146, 158, 170, 150, 154, 176, 138, 150, 178, 144, 162, 176, 148, 166, 156, 166, 168, 152, 166, 168, 158, 154, 172, 154, 146, 178, 154, 148, 164, 150, 148, 162, 164, 160, 150, 170, 166, 150, 158, 166, 146, 146, 164, 140, 152, 162, 152, 146, 148, 150, 164, 136, 152, 154, 142, 152, 162, 150, 154, 168, 148, 148, 168, 158, 152, 162, 160, 158, 140, 166, 156, 144, 154, 162, 134, 136, 162, 138, 150, 166, 150, 152, 152, 150, 162, 148, 156, 176, 152, 162, 176, 156, 152, 174, 142, 154, 172, 150, 156, 152, 168, 170, 148, 168, 170, 148, 148, 166, 146, 144, 180, 144, 158, 176, 144, 164, 164, 158, 164, 160, 156, 174, 154, 154, 174, 146, 154, 166, 152, 148, 164, 150, 160, 158, 160, 164, 154, 168, 170, 148, 162, 180, 146, 166, 172, 150, 156, 166, 148, 156, 166, 152, 156, 150, 162, 172, 144, 156, 172, 156, 152, 172, 152, 156, 176, 150, 166, 168, 158, 164, 156, 164, 166, 148, 156, 172, 140, 152, 168, 156, 146, 170, 144, 154, 168, 148, 166, 154, 174, 166, 154, 168, 168, 158, 152, 168, 154, 152, 170, 148, 166, 162, 152, 152, 154, 166, 160, 154, 154, 178, 154, 154, 168, 154, 154, 182, 148, 160, 164, 154, 160, 156, 166, 174, 148, 158, 166, 154, 150, 178, 144, 152, 176, 152, 150, 176, 154, 162, 160, 166, 170, 158, 158, 174, 158, 152, 174, 144, 152, 166, 138, 158, 160, 156, 158, 160, 150, 174, 154, 162, 178, 146}, + {180, 150, 154, 170, 140, 166, 162, 142, 172, 168, 146, 168, 172, 142, 176, 160, 146, 172, 166, 154, 178, 154, 158, 166, 146, 170, 156, 138, 160, 174, 132, 168, 166, 144, 168, 158, 154, 180, 152, 172, 166, 150, 172, 168, 144, 170, 174, 134, 172, 152, 144, 166, 158, 148, 164, 148, 168, 166, 146, 164, 170, 146, 164, 164, 146, 170, 174, 134, 176, 162, 160, 172, 144, 158, 166, 144, 160, 170, 142, 162, 172, 134, 170, 166, 144, 174, 152, 156, 174, 152, 162, 166, 154, 162, 170, 148, 172, 172, 134, 176, 166, 130, 174, 160, 140, 170, 150, 162, 160, 146, 172, 172, 148, 166, 172, 164, 156, 164, 148, 168, 162, 144, 182, 144, 156, 170, 144, 164, 178, 134, 162, 174, 132, 168, 170, 144, 166, 158, 154, 170, 156, 158, 156, 144, 166, 164, 130, 168, 148, 134, 166, 160, 134, 162, 158, 140, 158, 150, 158, 162, 156, 162, 166, 136, 168, 160, 152, 152, 168, 130, 160, 152, 150, 170, 138, 154, 164, 134, 164, 160, 142, 164, 166, 144, 174, 168, 140, 168, 156, 156, 172, 164, 164, 166, 150, 168, 166, 144, 174, 164, 134, 160, 166, 138, 176, 164, 148, 180, 156, 158, 172, 146, 172, 162, 156, 164, 178, 138, 172, 174, 132, 172, 160, 146, 172, 148, 154, 166, 144, 162, 168, 144, 172, 166, 144, 162, 162, 162, 172, 166, 144, 162, 164, 156, 168, 152, 168, 168, 136, 160, 180, 136, 160, 168, 142, 164, 166, 148, 164, 158, 156, 168, 150, 172, 160, 158, 168, 164, 140, 170, 168, 138, 170, 168, 136, 170, 156, 148, 172, 148, 158, 172, 148, 162, 170, 142, 166, 172, 142, 170, 170, 146, 174, 160, 160, 170, 146, 158, 162, 146, 164, 174, 130, 168, 172, 132, 174, 170, 144, 176, 166, 154, 172, 154, 162, 164, 156, 164, 172, 136, 158, 166, 140, 174, 156, 138, 164, 162, 148, 168, 146, 162, 172, 138, 176, 168, 138, 176, 174, 136, 162, 172, 140, 178, 156, 150, 172, 148, 164, 162, 144, 164, 164, 136, 160, 172, 138, 166, 166, 144}, + {154, 142, 168, 156, 148, 168, 164, 154, 158, 158, 158, 160, 146, 178, 156, 152, 182, 158, 148, 176, 160, 148, 174, 172, 138, 158, 156, 160, 162, 146, 176, 154, 134, 166, 168, 148, 176, 160, 144, 166, 166, 150, 170, 162, 164, 156, 158, 172, 160, 146, 182, 154, 140, 174, 166, 136, 158, 182, 144, 160, 162, 166, 162, 156, 176, 146, 152, 182, 156, 146, 176, 164, 146, 176, 160, 146, 162, 156, 154, 164, 152, 168, 156, 146, 174, 158, 146, 178, 166, 148, 168, 176, 152, 170, 158, 162, 160, 148, 170, 160, 146, 170, 152, 140, 182, 156, 146, 166, 172, 142, 162, 168, 150, 164, 158, 166, 162, 152, 180, 156, 150, 172, 160, 142, 178, 160, 144, 166, 150, 156, 160, 148, 180, 152, 148, 174, 154, 138, 166, 158, 150, 158, 164, 144, 146, 166, 142, 156, 152, 164, 150, 140, 160, 150, 136, 176, 164, 142, 160, 168, 138, 166, 164, 154, 156, 158, 156, 158, 138, 178, 158, 136, 160, 148, 142, 156, 164, 136, 148, 164, 140, 158, 158, 162, 156, 148, 184, 160, 146, 180, 166, 142, 174, 160, 150, 160, 166, 140, 162, 152, 160, 158, 150, 168, 148, 150, 174, 160, 144, 170, 168, 138, 176, 160, 156, 162, 152, 172, 162, 148, 172, 160, 142, 176, 156, 140, 168, 166, 140, 170, 164, 146, 154, 154, 168, 158, 154, 172, 160, 148, 182, 158, 148, 172, 168, 144, 160, 172, 150, 158, 158, 162, 164, 142, 172, 160, 142, 180, 164, 142, 178, 168, 144, 164, 172, 150, 166, 160, 168, 156, 148, 164, 166, 142, 174, 162, 142, 170, 162, 148, 158, 168, 154, 160, 168, 160, 174, 144, 180, 154, 152, 182, 148, 146, 170, 160, 138, 176, 178, 132, 158, 162, 152, 164, 142, 180, 164, 134, 178, 158, 140, 180, 170, 146, 168, 166, 146, 168, 156, 160, 172, 150, 170, 148, 150, 170, 164, 132, 174, 166, 144, 162, 178, 144, 166, 158, 168, 162, 150, 172, 168, 146, 176, 164, 144, 170, 168, 148, 162, 180, 138, 162, 162, 164, 154, 148, 178, 158, 144, 176}, + {172, 160, 144, 174, 152, 152, 148, 164, 162, 158, 162, 168, 160, 160, 170, 158, 148, 178, 166, 144, 172, 164, 154, 150, 162, 174, 146, 168, 156, 158, 150, 168, 168, 150, 172, 152, 156, 170, 158, 156, 168, 170, 156, 158, 156, 176, 152, 152, 170, 154, 148, 172, 160, 140, 162, 162, 160, 144, 170, 150, 160, 160, 166, 158, 160, 178, 156, 158, 168, 164, 144, 170, 158, 152, 156, 176, 158, 148, 162, 162, 152, 148, 180, 154, 148, 174, 162, 150, 162, 158, 164, 154, 166, 156, 156, 164, 166, 164, 146, 168, 150, 158, 170, 164, 136, 172, 168, 140, 162, 172, 160, 156, 158, 172, 150, 162, 164, 170, 144, 174, 166, 150, 164, 156, 154, 150, 160, 158, 162, 162, 158, 152, 148, 178, 158, 146, 176, 166, 138, 168, 158, 156, 148, 168, 166, 138, 152, 154, 146, 144, 162, 150, 144, 166, 160, 136, 162, 162, 142, 164, 164, 154, 146, 166, 164, 152, 158, 154, 156, 140, 162, 162, 140, 166, 152, 144, 150, 156, 158, 146, 164, 154, 146, 156, 170, 154, 148, 174, 164, 150, 168, 174, 146, 162, 180, 150, 158, 164, 174, 152, 154, 172, 154, 152, 174, 146, 148, 172, 168, 146, 170, 174, 154, 158, 172, 156, 164, 164, 170, 164, 148, 176, 150, 154, 174, 156, 158, 154, 168, 158, 160, 162, 162, 160, 160, 174, 152, 162, 168, 166, 144, 168, 164, 154, 162, 168, 152, 158, 162, 156, 148, 152, 170, 154, 148, 172, 156, 152, 172, 156, 154, 160, 162, 168, 154, 178, 158, 148, 162, 166, 162, 158, 162, 160, 144, 162, 154, 150, 162, 164, 148, 154, 170, 162, 144, 166, 170, 154, 154, 168, 160, 156, 174, 162, 152, 174, 158, 156, 144, 182, 160, 146, 160, 166, 158, 144, 170, 168, 140, 176, 156, 150, 160, 168, 160, 154, 186, 160, 152, 164, 156, 150, 154, 166, 160, 148, 174, 158, 152, 162, 166, 150, 156, 166, 168, 148, 166, 168, 156, 162, 170, 156, 156, 172, 156, 146, 164, 158, 154, 144, 164, 162, 150, 158, 174, 152, 154, 168, 164, 152}, + {162, 148, 176, 146, 152, 176, 152, 154, 164, 154, 158, 178, 148, 158, 174, 144, 170, 158, 154, 178, 152, 162, 172, 160, 152, 172, 146, 152, 178, 142, 160, 174, 132, 170, 160, 138, 180, 156, 148, 184, 152, 158, 172, 156, 156, 170, 146, 170, 176, 140, 174, 146, 156, 174, 152, 156, 174, 154, 156, 172, 152, 164, 168, 152, 166, 170, 152, 166, 166, 146, 182, 154, 148, 186, 140, 154, 168, 154, 152, 176, 142, 154, 170, 144, 164, 170, 138, 184, 160, 154, 174, 156, 156, 182, 150, 164, 172, 150, 160, 176, 144, 172, 152, 144, 176, 152, 148, 176, 152, 148, 164, 166, 156, 168, 156, 162, 178, 144, 174, 168, 138, 174, 168, 148, 178, 144, 156, 180, 150, 152, 172, 148, 164, 168, 140, 168, 152, 146, 176, 152, 150, 166, 152, 152, 166, 144, 156, 168, 142, 148, 168, 136, 156, 152, 138, 162, 154, 150, 168, 148, 150, 174, 148, 156, 174, 140, 156, 172, 140, 172, 160, 134, 170, 150, 136, 178, 142, 150, 174, 140, 152, 172, 142, 164, 168, 148, 166, 168, 142, 186, 154, 154, 182, 154, 150, 178, 156, 154, 170, 152, 154, 172, 140, 168, 166, 148, 164, 160, 148, 176, 152, 148, 190, 146, 156, 176, 148, 160, 180, 136, 172, 166, 136, 180, 148, 144, 170, 152, 148, 170, 144, 156, 172, 146, 166, 170, 144, 168, 174, 152, 172, 160, 154, 174, 154, 150, 178, 146, 154, 178, 154, 152, 176, 144, 156, 174, 144, 170, 152, 152, 174, 152, 164, 170, 164, 144, 178, 152, 164, 170, 144, 166, 170, 150, 168, 156, 154, 174, 152, 140, 184, 150, 156, 174, 160, 154, 176, 144, 174, 166, 152, 162, 168, 156, 176, 146, 152, 172, 154, 146, 170, 162, 148, 172, 142, 170, 170, 146, 178, 164, 146, 178, 160, 152, 170, 148, 152, 170, 146, 166, 170, 148, 170, 164, 148, 162, 154, 148, 172, 152, 148, 178, 154, 152, 176, 152, 146, 186, 150, 162, 170, 150, 170, 168, 144, 174, 160, 152, 174, 150, 154, 172, 146, 152, 168, 148, 166, 168, 140, 168}, + {148, 156, 166, 160, 156, 164, 150, 170, 162, 150, 170, 144, 154, 188, 134, 172, 178, 144, 164, 158, 160, 164, 168, 148, 170, 162, 154, 174, 142, 160, 166, 146, 156, 170, 150, 166, 168, 150, 166, 174, 150, 168, 154, 158, 180, 150, 156, 176, 152, 162, 176, 144, 160, 164, 154, 164, 152, 148, 176, 156, 148, 172, 146, 160, 182, 142, 170, 174, 148, 160, 170, 150, 164, 164, 150, 166, 158, 150, 180, 140, 160, 178, 140, 168, 174, 134, 170, 162, 158, 162, 168, 154, 164, 160, 160, 176, 146, 162, 174, 138, 166, 174, 146, 162, 166, 144, 164, 152, 158, 172, 158, 146, 182, 154, 160, 174, 136, 164, 166, 148, 166, 180, 148, 160, 168, 148, 170, 156, 146, 182, 140, 154, 182, 136, 168, 166, 146, 158, 162, 152, 156, 166, 150, 162, 156, 142, 164, 152, 144, 168, 136, 162, 162, 148, 154, 166, 142, 158, 152, 156, 160, 146, 162, 178, 140, 158, 166, 138, 156, 170, 138, 162, 160, 136, 156, 158, 148, 158, 148, 146, 164, 146, 158, 174, 132, 166, 178, 146, 162, 174, 142, 156, 166, 146, 174, 154, 158, 174, 154, 148, 174, 146, 158, 172, 132, 158, 176, 146, 164, 170, 146, 168, 160, 158, 174, 154, 162, 182, 134, 168, 180, 154, 166, 176, 144, 166, 164, 150, 166, 154, 150, 176, 156, 152, 170, 150, 162, 184, 134, 164, 174, 148, 168, 168, 158, 172, 168, 152, 168, 144, 158, 178, 146, 160, 180, 138, 166, 176, 150, 164, 170, 160, 160, 170, 154, 180, 154, 146, 186, 136, 174, 172, 128, 164, 168, 152, 156, 160, 148, 178, 160, 146, 170, 156, 152, 180, 146, 168, 178, 142, 164, 184, 142, 160, 172, 158, 160, 166, 148, 178, 148, 146, 178, 138, 158, 170, 136, 160, 166, 150, 168, 170, 148, 174, 158, 166, 180, 152, 152, 176, 148, 164, 172, 134, 168, 176, 156, 164, 158, 162, 172, 158, 152, 174, 152, 156, 182, 144, 168, 168, 148, 168, 174, 148, 166, 168, 144, 170, 158, 152, 164, 160, 146, 178, 146, 162, 174, 132, 174, 174}, + {156, 170, 166, 146, 174, 162, 140, 160, 168, 158, 158, 176, 152, 160, 164, 166, 156, 158, 164, 170, 158, 158, 166, 158, 158, 164, 160, 156, 158, 160, 164, 158, 164, 158, 158, 170, 162, 150, 168, 162, 160, 160, 176, 146, 156, 174, 172, 156, 152, 168, 156, 150, 172, 170, 142, 162, 174, 144, 154, 174, 158, 150, 168, 162, 150, 162, 172, 156, 160, 170, 158, 154, 166, 170, 154, 152, 178, 152, 156, 166, 164, 148, 162, 168, 160, 158, 160, 174, 150, 164, 168, 150, 170, 166, 160, 156, 164, 154, 164, 170, 156, 158, 154, 166, 154, 146, 170, 160, 158, 150, 178, 160, 156, 166, 164, 158, 166, 164, 162, 170, 162, 160, 154, 172, 164, 150, 164, 168, 148, 156, 176, 148, 160, 160, 174, 152, 154, 174, 160, 150, 160, 162, 152, 154, 154, 152, 144, 162, 158, 150, 150, 152, 154, 150, 164, 158, 144, 174, 170, 136, 160, 164, 158, 144, 174, 156, 152, 156, 166, 154, 144, 166, 150, 150, 158, 164, 142, 156, 156, 150, 148, 166, 146, 154, 162, 148, 158, 160, 182, 158, 156, 166, 172, 156, 158, 170, 152, 158, 174, 158, 152, 166, 166, 164, 158, 170, 152, 158, 168, 162, 154, 164, 172, 150, 152, 174, 152, 148, 176, 164, 146, 158, 168, 148, 158, 156, 176, 144, 164, 168, 144, 164, 166, 158, 154, 170, 160, 156, 166, 168, 154, 162, 166, 164, 142, 164, 172, 154, 156, 172, 160, 144, 158, 162, 142, 166, 164, 156, 146, 168, 162, 144, 174, 168, 152, 162, 162, 162, 152, 164, 156, 158, 178, 166, 162, 152, 174, 162, 148, 156, 172, 162, 154, 172, 154, 154, 162, 160, 160, 160, 164, 164, 158, 172, 162, 148, 172, 158, 156, 162, 160, 164, 148, 168, 164, 158, 156, 174, 154, 154, 176, 156, 156, 160, 174, 146, 152, 178, 156, 164, 176, 154, 158, 164, 154, 150, 146, 162, 166, 140, 164, 168, 152, 160, 172, 164, 154, 168, 160, 152, 164, 172, 144, 154, 164, 176, 154, 158, 162, 152, 164, 170, 152, 150, 164, 156, 156, 160, 166, 154}, + {146, 174, 152, 154, 166, 156, 156, 184, 136, 154, 178, 136, 166, 184, 142, 168, 172, 144, 170, 154, 162, 172, 148, 160, 186, 140, 166, 174, 128, 170, 176, 144, 160, 170, 142, 166, 164, 160, 172, 148, 158, 176, 138, 176, 176, 140, 160, 186, 138, 168, 168, 140, 166, 156, 160, 170, 138, 164, 180, 140, 164, 180, 142, 164, 186, 140, 166, 176, 134, 176, 170, 156, 172, 152, 158, 184, 136, 164, 184, 130, 166, 190, 134, 170, 170, 138, 174, 154, 162, 166, 154, 164, 168, 146, 168, 176, 142, 166, 176, 136, 172, 172, 140, 168, 176, 136, 176, 152, 164, 178, 132, 168, 184, 126, 176, 184, 136, 164, 176, 140, 170, 170, 150, 166, 152, 164, 168, 142, 164, 180, 132, 160, 182, 134, 160, 174, 136, 166, 160, 144, 180, 156, 154, 164, 148, 154, 180, 134, 162, 166, 134, 164, 172, 132, 162, 160, 140, 166, 144, 166, 166, 140, 156, 182, 132, 164, 176, 146, 156, 176, 140, 156, 158, 142, 164, 142, 162, 158, 140, 156, 172, 136, 166, 176, 134, 172, 170, 140, 162, 166, 160, 166, 154, 158, 178, 142, 172, 182, 128, 170, 178, 140, 170, 168, 136, 162, 170, 146, 174, 156, 164, 174, 140, 170, 182, 142, 174, 178, 140, 160, 186, 142, 172, 164, 150, 168, 146, 162, 166, 146, 166, 172, 146, 168, 180, 138, 170, 182, 128, 174, 174, 148, 168, 162, 164, 174, 148, 162, 178, 140, 168, 188, 138, 166, 178, 138, 166, 168, 146, 166, 160, 158, 170, 152, 168, 170, 150, 164, 186, 144, 170, 184, 132, 168, 170, 140, 162, 160, 156, 174, 140, 158, 182, 138, 174, 182, 144, 170, 166, 148, 168, 166, 152, 170, 156, 146, 178, 148, 162, 178, 136, 166, 182, 132, 168, 182, 136, 154, 180, 144, 170, 160, 160, 180, 142, 170, 172, 144, 172, 178, 140, 172, 182, 140, 166, 174, 140, 172, 156, 158, 170, 144, 162, 172, 132, 170, 188, 140, 172, 186, 136, 160, 188, 146, 166, 156, 154, 174, 154, 158, 176, 140, 170, 178, 134, 174, 186, 136, 166, 170}, + {176, 162, 144, 184, 162, 148, 172, 154, 154, 178, 148, 156, 176, 150, 168, 166, 148, 184, 164, 146, 176, 168, 148, 172, 166, 152, 170, 160, 168, 168, 144, 170, 172, 140, 174, 172, 138, 176, 160, 156, 172, 174, 148, 166, 166, 154, 174, 150, 168, 156, 156, 174, 174, 144, 168, 164, 146, 168, 162, 158, 164, 160, 164, 162, 152, 166, 170, 144, 184, 158, 144, 180, 164, 146, 182, 166, 142, 158, 166, 156, 162, 146, 174, 162, 138, 180, 170, 136, 180, 170, 148, 174, 162, 156, 166, 162, 162, 164, 154, 168, 164, 146, 172, 152, 148, 180, 160, 142, 170, 166, 148, 176, 160, 164, 168, 154, 170, 160, 148, 182, 172, 140, 180, 164, 148, 170, 162, 156, 166, 162, 156, 166, 150, 172, 160, 144, 176, 156, 144, 178, 162, 140, 162, 164, 134, 170, 152, 152, 156, 158, 156, 158, 134, 170, 154, 136, 178, 162, 144, 158, 164, 146, 158, 162, 146, 164, 146, 154, 162, 142, 162, 164, 132, 172, 166, 138, 162, 158, 138, 164, 158, 156, 158, 148, 164, 148, 154, 168, 172, 144, 174, 162, 150, 160, 172, 150, 170, 172, 152, 172, 154, 160, 162, 148, 174, 162, 140, 182, 166, 136, 172, 168, 144, 168, 168, 160, 164, 156, 162, 170, 146, 172, 156, 156, 168, 164, 144, 174, 176, 148, 166, 168, 150, 160, 156, 164, 162, 152, 182, 156, 150, 174, 168, 142, 180, 166, 146, 166, 166, 138, 174, 150, 150, 164, 150, 176, 158, 152, 180, 164, 142, 172, 172, 144, 170, 162, 158, 166, 152, 164, 166, 148, 172, 164, 148, 184, 166, 136, 184, 150, 150, 184, 150, 154, 162, 154, 156, 164, 156, 178, 162, 140, 178, 160, 142, 190, 164, 148, 172, 164, 150, 164, 166, 164, 162, 132, 178, 170, 134, 182, 162, 146, 178, 168, 158, 164, 170, 150, 168, 162, 158, 158, 148, 172, 164, 146, 180, 160, 152, 178, 158, 160, 168, 164, 156, 164, 160, 156, 168, 146, 170, 164, 138, 188, 164, 146, 192, 158, 144, 174, 172, 146, 154, 156, 162, 158, 150, 172, 164, 142}, + {152, 178, 160, 150, 164, 150, 176, 152, 160, 164, 162, 164, 166, 154, 156, 176, 160, 148, 182, 152, 152, 168, 160, 162, 164, 156, 174, 156, 142, 184, 152, 150, 178, 152, 162, 162, 150, 158, 170, 148, 174, 158, 166, 170, 154, 164, 174, 156, 152, 188, 152, 148, 182, 150, 144, 176, 158, 160, 160, 138, 184, 152, 154, 186, 150, 166, 174, 156, 144, 172, 156, 150, 176, 156, 156, 156, 166, 170, 152, 154, 180, 158, 148, 174, 166, 142, 178, 158, 160, 168, 152, 174, 162, 144, 182, 148, 156, 180, 152, 156, 174, 166, 148, 182, 154, 146, 178, 156, 156, 162, 156, 168, 154, 148, 182, 150, 156, 188, 152, 146, 174, 158, 158, 164, 152, 164, 162, 154, 182, 146, 156, 172, 160, 152, 176, 162, 152, 172, 160, 148, 166, 158, 150, 164, 152, 158, 150, 140, 184, 140, 146, 178, 144, 150, 168, 156, 142, 170, 144, 164, 152, 158, 172, 142, 166, 166, 148, 160, 170, 150, 148, 178, 156, 136, 160, 152, 152, 160, 146, 176, 148, 138, 174, 152, 152, 182, 146, 152, 174, 160, 156, 174, 156, 166, 166, 156, 170, 144, 158, 174, 150, 160, 180, 156, 144, 184, 152, 148, 170, 162, 164, 164, 160, 178, 150, 156, 174, 160, 152, 168, 162, 154, 174, 154, 152, 188, 150, 156, 168, 148, 160, 158, 154, 172, 156, 152, 188, 152, 152, 182, 160, 148, 174, 158, 154, 160, 162, 174, 156, 166, 180, 150, 162, 174, 150, 154, 178, 148, 150, 172, 162, 158, 154, 170, 168, 154, 156, 178, 150, 148, 188, 160, 146, 182, 156, 138, 174, 158, 164, 170, 148, 174, 164, 168, 164, 154, 156, 180, 154, 152, 184, 158, 148, 180, 170, 142, 178, 156, 156, 158, 158, 180, 142, 152, 178, 158, 146, 182, 158, 156, 170, 148, 170, 166, 150, 170, 158, 162, 166, 154, 168, 170, 154, 154, 182, 158, 142, 166, 160, 144, 170, 138, 172, 160, 148, 184, 162, 164, 176, 154, 156, 178, 160, 154, 174, 150, 146, 174, 160, 164, 162, 166, 172, 150, 154, 176, 160, 140, 184, 150}, + {180, 162, 150, 182, 146, 164, 174, 142, 160, 180, 122, 178, 166, 140, 180, 160, 140, 184, 146, 158, 182, 144, 160, 172, 150, 170, 164, 138, 180, 160, 144, 180, 156, 144, 180, 170, 152, 180, 146, 168, 174, 140, 168, 152, 152, 180, 156, 140, 182, 156, 146, 186, 152, 156, 180, 150, 158, 166, 150, 172, 162, 140, 178, 166, 142, 180, 162, 148, 188, 164, 150, 180, 148, 172, 178, 152, 168, 170, 142, 186, 156, 144, 178, 156, 142, 192, 150, 150, 182, 148, 166, 172, 150, 168, 162, 148, 176, 168, 132, 184, 168, 126, 190, 144, 156, 184, 148, 160, 178, 140, 176, 166, 150, 184, 168, 136, 178, 156, 144, 182, 158, 154, 178, 164, 160, 172, 142, 172, 158, 136, 186, 156, 138, 188, 158, 136, 178, 154, 150, 182, 150, 160, 170, 140, 164, 168, 146, 168, 160, 136, 174, 158, 140, 174, 148, 148, 176, 146, 164, 166, 142, 172, 148, 148, 178, 166, 130, 186, 154, 142, 170, 148, 142, 176, 148, 158, 164, 142, 160, 156, 140, 174, 162, 138, 174, 156, 136, 184, 154, 148, 184, 148, 166, 172, 146, 178, 170, 154, 176, 172, 136, 180, 160, 138, 188, 152, 154, 182, 146, 158, 164, 156, 170, 170, 152, 180, 158, 142, 188, 160, 142, 192, 160, 140, 190, 146, 152, 186, 132, 182, 174, 140, 182, 162, 142, 178, 164, 140, 182, 164, 144, 184, 154, 158, 172, 156, 170, 168, 152, 170, 158, 150, 176, 168, 134, 186, 156, 146, 186, 148, 154, 182, 152, 170, 172, 152, 174, 156, 160, 180, 162, 136, 186, 156, 146, 190, 154, 158, 166, 146, 158, 166, 138, 178, 160, 150, 184, 168, 134, 194, 160, 146, 178, 150, 156, 176, 146, 172, 174, 144, 172, 160, 150, 182, 166, 136, 186, 156, 136, 176, 154, 160, 174, 146, 172, 168, 146, 174, 166, 140, 188, 160, 140, 192, 150, 150, 180, 152, 162, 174, 158, 164, 170, 150, 170, 166, 130, 184, 162, 136, 190, 156, 134, 174, 152, 166, 190, 144, 166, 162, 136, 176, 160, 146, 182, 162, 138, 194, 156, 152}, + {172, 150, 166, 178, 152, 168, 162, 160, 162, 166, 156, 166, 164, 166, 164, 158, 176, 168, 160, 168, 172, 150, 170, 174, 154, 168, 172, 160, 162, 162, 164, 162, 152, 170, 166, 146, 162, 174, 148, 166, 176, 154, 172, 168, 156, 168, 162, 162, 160, 160, 170, 162, 156, 162, 164, 146, 176, 170, 154, 156, 174, 158, 164, 168, 158, 168, 152, 164, 172, 150, 174, 162, 156, 162, 174, 148, 166, 168, 152, 162, 170, 156, 152, 164, 170, 148, 162, 166, 166, 156, 168, 178, 156, 156, 168, 156, 162, 162, 164, 172, 156, 170, 170, 154, 166, 164, 144, 176, 162, 150, 172, 174, 152, 158, 162, 160, 166, 170, 172, 160, 154, 164, 160, 154, 158, 168, 158, 170, 170, 160, 162, 168, 156, 162, 162, 162, 146, 160, 164, 154, 154, 158, 174, 142, 166, 160, 152, 152, 172, 162, 148, 154, 154, 170, 134, 160, 166, 150, 152, 166, 144, 160, 166, 146, 152, 154, 164, 164, 156, 154, 158, 150, 166, 158, 148, 154, 174, 140, 162, 168, 152, 156, 162, 142, 168, 154, 172, 162, 156, 172, 158, 156, 154, 176, 150, 164, 172, 154, 170, 154, 168, 160, 166, 158, 162, 154, 160, 164, 152, 166, 172, 144, 166, 166, 154, 160, 166, 168, 152, 160, 168, 156, 156, 174, 156, 166, 168, 174, 156, 152, 168, 148, 172, 156, 154, 166, 168, 162, 172, 152, 174, 164, 140, 170, 168, 150, 162, 176, 154, 166, 168, 154, 148, 168, 166, 154, 154, 174, 160, 164, 168, 172, 146, 166, 172, 144, 176, 168, 142, 162, 168, 168, 164, 160, 168, 170, 154, 164, 168, 158, 154, 176, 156, 162, 170, 152, 158, 154, 178, 154, 160, 164, 168, 150, 166, 172, 152, 170, 168, 154, 162, 166, 158, 158, 166, 160, 162, 154, 186, 166, 160, 166, 174, 154, 168, 166, 168, 158, 168, 160, 162, 156, 164, 158, 158, 164, 166, 150, 160, 176, 142, 174, 160, 158, 154, 172, 162, 164, 168, 168, 154, 164, 172, 164, 156, 164, 180, 152, 170, 168, 162, 160, 170, 156, 164, 158, 172, 148, 164, 156}, + {184, 150, 166, 150, 166, 170, 148, 162, 178, 142, 166, 192, 138, 174, 184, 136, 178, 168, 134, 172, 162, 150, 176, 146, 168, 178, 140, 168, 178, 136, 186, 178, 134, 164, 174, 150, 166, 168, 156, 186, 148, 154, 176, 156, 162, 186, 132, 168, 188, 136, 170, 178, 146, 170, 168, 160, 174, 150, 158, 186, 138, 170, 186, 130, 178, 184, 144, 168, 168, 146, 172, 166, 152, 178, 152, 154, 178, 140, 178, 182, 126, 178, 184, 132, 170, 184, 136, 170, 168, 154, 174, 154, 168, 176, 144, 168, 176, 142, 174, 186, 140, 170, 176, 146, 166, 174, 146, 178, 150, 160, 180, 128, 180, 172, 140, 182, 182, 132, 174, 178, 132, 176, 174, 148, 178, 168, 156, 176, 146, 156, 184, 140, 170, 184, 132, 178, 178, 154, 162, 174, 150, 180, 138, 166, 166, 152, 160, 174, 128, 160, 178, 130, 162, 178, 136, 160, 156, 150, 174, 152, 158, 168, 142, 162, 172, 134, 166, 178, 130, 168, 176, 140, 160, 164, 148, 174, 144, 152, 178, 144, 148, 174, 128, 170, 186, 132, 172, 172, 140, 164, 166, 162, 164, 168, 154, 174, 128, 168, 188, 130, 172, 192, 134, 172, 182, 134, 176, 178, 148, 178, 162, 158, 186, 154, 164, 178, 142, 160, 190, 126, 178, 186, 142, 168, 176, 152, 166, 154, 160, 178, 148, 168, 182, 144, 168, 176, 138, 168, 184, 144, 166, 166, 166, 162, 156, 164, 176, 146, 162, 188, 128, 170, 194, 126, 168, 188, 136, 174, 170, 134, 182, 160, 160, 176, 146, 174, 172, 142, 168, 192, 132, 166, 180, 136, 168, 164, 146, 166, 156, 160, 180, 146, 164, 180, 132, 172, 182, 136, 172, 184, 136, 172, 180, 142, 174, 164, 152, 184, 148, 156, 184, 146, 170, 184, 128, 172, 188, 144, 164, 166, 144, 170, 148, 160, 174, 154, 162, 176, 138, 170, 178, 134, 174, 188, 136, 170, 180, 138, 180, 158, 168, 162, 144, 168, 186, 132, 176, 192, 130, 172, 178, 144, 164, 178, 146, 176, 158, 148, 176, 150, 156, 178, 138, 166, 184, 136, 160, 200, 132, 160}, + {156, 150, 180, 156, 164, 170, 158, 172, 158, 156, 174, 148, 166, 166, 154, 162, 176, 164, 170, 174, 154, 156, 186, 156, 166, 150, 162, 172, 164, 148, 182, 150, 160, 178, 160, 164, 172, 158, 164, 158, 162, 174, 156, 160, 166, 164, 160, 166, 160, 160, 176, 162, 158, 174, 156, 156, 178, 144, 168, 164, 152, 182, 144, 164, 172, 150, 158, 176, 154, 166, 174, 162, 156, 178, 152, 170, 170, 164, 170, 160, 160, 164, 148, 168, 176, 162, 152, 178, 152, 168, 170, 154, 172, 158, 168, 162, 164, 154, 176, 154, 162, 172, 154, 162, 172, 162, 160, 168, 154, 162, 174, 160, 166, 162, 158, 176, 156, 154, 190, 154, 150, 182, 142, 174, 160, 156, 172, 166, 154, 172, 154, 162, 164, 152, 168, 172, 146, 152, 172, 152, 154, 160, 152, 164, 164, 146, 168, 152, 154, 172, 148, 150, 172, 152, 158, 170, 146, 152, 166, 148, 166, 168, 152, 160, 164, 148, 176, 134, 154, 176, 152, 142, 178, 152, 152, 168, 150, 158, 164, 148, 172, 156, 154, 174, 134, 160, 164, 156, 154, 176, 148, 158, 162, 160, 160, 168, 162, 174, 154, 164, 172, 152, 168, 168, 162, 160, 174, 156, 160, 174, 150, 160, 166, 156, 176, 156, 166, 174, 156, 162, 174, 154, 154, 176, 152, 156, 166, 162, 162, 160, 156, 178, 154, 162, 168, 164, 162, 174, 150, 168, 186, 150, 164, 174, 154, 162, 168, 156, 168, 158, 168, 172, 156, 168, 172, 150, 160, 160, 168, 160, 166, 164, 158, 164, 160, 162, 164, 162, 184, 144, 160, 176, 148, 162, 182, 166, 166, 180, 152, 164, 166, 158, 168, 158, 160, 176, 164, 160, 170, 158, 174, 160, 162, 148, 170, 154, 166, 178, 146, 170, 172, 148, 170, 154, 164, 166, 156, 162, 174, 170, 150, 180, 158, 166, 164, 160, 168, 158, 160, 172, 158, 162, 162, 166, 164, 174, 156, 156, 188, 148, 156, 182, 152, 162, 162, 162, 170, 154, 164, 170, 152, 168, 174, 156, 158, 172, 148, 174, 168, 160, 174, 164, 170, 162, 154, 164, 172, 146, 154, 186}, + {140, 178, 174, 144, 180, 170, 132, 182, 164, 154, 176, 158, 168, 184, 130, 176, 190, 132, 172, 176, 148, 174, 168, 152, 172, 166, 156, 176, 160, 168, 178, 142, 170, 182, 126, 176, 182, 136, 172, 174, 156, 178, 158, 178, 164, 156, 158, 178, 140, 168, 176, 136, 172, 178, 136, 182, 174, 156, 174, 168, 158, 168, 166, 166, 188, 142, 170, 188, 136, 170, 182, 142, 176, 160, 158, 172, 154, 160, 178, 158, 162, 174, 158, 152, 186, 130, 178, 186, 132, 170, 170, 146, 172, 158, 164, 174, 148, 172, 182, 148, 170, 178, 134, 188, 174, 132, 186, 168, 146, 176, 170, 150, 172, 168, 150, 176, 160, 162, 174, 138, 174, 176, 138, 168, 178, 140, 178, 156, 162, 184, 150, 164, 180, 152, 166, 184, 146, 172, 176, 142, 182, 166, 142, 164, 166, 154, 164, 152, 154, 174, 138, 166, 184, 128, 164, 178, 134, 172, 170, 144, 164, 148, 152, 168, 152, 152, 176, 146, 164, 170, 138, 170, 172, 124, 174, 168, 140, 172, 160, 154, 168, 146, 158, 168, 150, 162, 180, 138, 176, 180, 138, 178, 172, 148, 178, 156, 158, 166, 162, 156, 182, 146, 168, 180, 132, 170, 178, 132, 170, 170, 152, 176, 164, 154, 172, 162, 158, 168, 154, 156, 182, 140, 186, 176, 144, 184, 180, 140, 182, 166, 150, 172, 160, 150, 188, 138, 168, 180, 138, 170, 174, 148, 166, 172, 142, 170, 166, 160, 168, 160, 156, 176, 154, 160, 182, 140, 176, 190, 136, 168, 186, 140, 176, 166, 160, 174, 160, 164, 168, 160, 160, 178, 144, 166, 182, 134, 172, 182, 124, 182, 164, 150, 170, 162, 160, 168, 142, 166, 192, 130, 166, 188, 134, 182, 184, 144, 178, 156, 162, 170, 158, 170, 176, 158, 160, 180, 136, 170, 188, 134, 178, 174, 142, 178, 172, 162, 170, 152, 168, 172, 152, 168, 186, 128, 174, 184, 130, 170, 176, 148, 174, 168, 152, 178, 166, 158, 178, 152, 160, 186, 138, 170, 188, 134, 176, 174, 152, 170, 166, 158, 172, 156, 166, 164, 158, 160, 184, 140, 178, 180}, + {166, 168, 146, 166, 172, 170, 162, 174, 160, 162, 176, 154, 174, 156, 170, 176, 152, 156, 184, 142, 170, 174, 156, 162, 170, 158, 170, 158, 154, 174, 156, 166, 170, 154, 166, 172, 154, 166, 174, 154, 158, 174, 154, 158, 168, 158, 178, 156, 162, 184, 146, 176, 188, 148, 170, 176, 150, 158, 180, 150, 170, 170, 146, 168, 160, 160, 174, 156, 170, 170, 152, 158, 168, 168, 160, 176, 152, 162, 164, 158, 168, 156, 162, 182, 150, 174, 168, 146, 180, 180, 160, 164, 180, 162, 158, 172, 164, 170, 154, 164, 170, 158, 156, 174, 156, 162, 172, 148, 168, 170, 154, 162, 178, 150, 168, 168, 152, 178, 160, 172, 176, 160, 166, 180, 154, 166, 170, 162, 174, 168, 164, 166, 152, 166, 172, 148, 174, 166, 148, 168, 172, 156, 160, 176, 148, 162, 172, 152, 160, 154, 158, 164, 146, 162, 166, 150, 156, 170, 142, 164, 172, 154, 162, 174, 150, 170, 160, 160, 154, 160, 154, 168, 150, 166, 178, 136, 158, 176, 142, 160, 170, 154, 164, 162, 156, 176, 136, 164, 164, 158, 162, 176, 152, 162, 172, 156, 154, 182, 158, 162, 170, 158, 168, 156, 168, 184, 152, 166, 188, 152, 162, 168, 172, 158, 174, 164, 178, 164, 164, 166, 156, 170, 166, 154, 168, 160, 160, 158, 178, 152, 158, 182, 152, 172, 164, 160, 174, 150, 170, 178, 142, 176, 168, 164, 160, 178, 154, 166, 172, 156, 172, 168, 164, 182, 150, 172, 172, 160, 164, 182, 146, 166, 172, 154, 166, 170, 150, 178, 154, 166, 174, 152, 162, 182, 142, 164, 174, 158, 166, 170, 166, 158, 188, 148, 168, 184, 156, 180, 158, 168, 174, 156, 160, 172, 152, 162, 182, 154, 170, 158, 168, 170, 154, 166, 168, 164, 164, 164, 146, 176, 170, 154, 158, 180, 162, 148, 176, 146, 166, 168, 148, 180, 154, 160, 186, 146, 174, 180, 148, 168, 170, 158, 158, 188, 146, 170, 168, 158, 170, 162, 160, 182, 150, 162, 178, 156, 156, 178, 152, 158, 170, 164, 170, 166, 154, 176, 154, 176, 168, 146}, + {174, 176, 148, 184, 160, 160, 180, 148, 160, 190, 148, 158, 174, 152, 150, 184, 152, 176, 174, 152, 166, 170, 144, 182, 172, 144, 184, 158, 160, 182, 150, 172, 182, 138, 174, 178, 150, 178, 172, 156, 178, 178, 160, 184, 156, 148, 180, 150, 172, 178, 154, 168, 166, 140, 166, 174, 144, 186, 154, 160, 176, 156, 164, 184, 150, 168, 182, 142, 166, 184, 160, 168, 180, 144, 166, 172, 150, 184, 156, 162, 190, 150, 160, 180, 154, 170, 176, 154, 166, 164, 148, 172, 164, 162, 168, 166, 150, 188, 150, 162, 182, 144, 168, 182, 148, 174, 172, 146, 180, 162, 160, 178, 154, 166, 194, 150, 172, 182, 142, 170, 166, 150, 164, 178, 140, 188, 152, 158, 168, 152, 164, 190, 154, 168, 180, 142, 172, 176, 150, 154, 172, 154, 166, 150, 160, 170, 148, 164, 174, 156, 150, 180, 140, 160, 178, 136, 172, 172, 140, 176, 162, 142, 164, 150, 156, 168, 148, 160, 172, 136, 164, 182, 140, 172, 162, 148, 178, 150, 144, 178, 142, 162, 180, 146, 150, 186, 142, 160, 176, 144, 172, 166, 150, 164, 160, 158, 180, 160, 150, 178, 150, 160, 184, 150, 162, 184, 146, 170, 174, 142, 176, 174, 136, 188, 148, 150, 186, 154, 166, 194, 146, 164, 172, 150, 168, 180, 142, 178, 162, 158, 176, 152, 166, 184, 148, 174, 182, 146, 172, 192, 144, 168, 178, 146, 170, 170, 148, 180, 158, 170, 170, 148, 168, 168, 150, 170, 168, 148, 170, 176, 138, 192, 174, 138, 186, 160, 158, 184, 154, 158, 186, 154, 154, 180, 142, 172, 184, 156, 180, 168, 158, 172, 152, 162, 186, 138, 162, 178, 154, 164, 188, 132, 170, 186, 148, 168, 166, 150, 170, 168, 158, 174, 148, 166, 182, 146, 160, 192, 148, 168, 180, 152, 176, 178, 152, 188, 156, 160, 180, 152, 168, 180, 150, 172, 184, 144, 166, 180, 132, 180, 168, 160, 180, 158, 154, 180, 154, 170, 184, 152, 170, 172, 162, 152, 178, 154, 172, 176, 146, 184, 162, 142, 178, 164, 160, 190, 142, 166, 182, 146}, + {182, 156, 156, 184, 156, 148, 186, 150, 174, 174, 156, 178, 164, 172, 182, 150, 166, 174, 162, 170, 166, 164, 162, 174, 170, 156, 170, 168, 158, 170, 164, 166, 154, 172, 172, 150, 166, 180, 144, 176, 160, 158, 168, 160, 162, 164, 170, 180, 160, 158, 168, 168, 162, 164, 180, 152, 164, 182, 152, 168, 178, 154, 172, 166, 160, 174, 164, 164, 172, 152, 166, 160, 162, 170, 174, 150, 174, 168, 172, 152, 156, 176, 164, 162, 170, 168, 152, 160, 188, 150, 172, 178, 160, 166, 176, 154, 180, 158, 156, 176, 156, 178, 168, 158, 164, 176, 150, 170, 176, 154, 160, 178, 170, 150, 170, 170, 152, 162, 170, 170, 166, 160, 176, 160, 168, 176, 154, 164, 180, 150, 168, 162, 168, 166, 166, 174, 174, 146, 174, 170, 168, 158, 180, 152, 158, 168, 164, 146, 176, 150, 160, 158, 166, 168, 152, 162, 168, 156, 166, 166, 152, 168, 164, 162, 156, 166, 170, 154, 154, 164, 166, 152, 168, 168, 148, 158, 176, 150, 160, 174, 162, 162, 164, 152, 172, 154, 166, 176, 154, 156, 184, 146, 172, 180, 148, 166, 170, 150, 166, 166, 182, 164, 162, 176, 156, 154, 178, 168, 158, 176, 168, 160, 170, 180, 166, 164, 178, 152, 178, 146, 170, 178, 160, 160, 184, 152, 170, 186, 152, 170, 178, 160, 158, 166, 168, 156, 178, 162, 156, 154, 172, 176, 150, 164, 190, 154, 166, 180, 160, 160, 168, 170, 162, 166, 170, 172, 166, 168, 176, 162, 176, 156, 156, 168, 176, 172, 154, 172, 170, 156, 164, 166, 174, 166, 166, 182, 150, 148, 186, 146, 162, 184, 150, 170, 178, 166, 170, 166, 174, 158, 158, 174, 154, 168, 172, 176, 164, 168, 166, 156, 164, 178, 162, 168, 174, 160, 180, 150, 164, 180, 144, 156, 180, 148, 166, 178, 158, 172, 162, 166, 162, 172, 162, 162, 162, 166, 170, 148, 172, 186, 148, 158, 192, 142, 180, 166, 160, 174, 160, 168, 178, 144, 172, 176, 162, 168, 166, 154, 168, 158, 168, 168, 160, 170, 162, 172, 170, 164, 158, 160}, + {158, 174, 176, 168, 158, 180, 156, 166, 182, 150, 178, 186, 152, 160, 188, 146, 178, 176, 154, 172, 158, 168, 176, 154, 162, 178, 148, 170, 176, 152, 170, 168, 154, 172, 168, 166, 182, 164, 166, 176, 166, 166, 190, 150, 180, 184, 146, 172, 174, 154, 176, 164, 156, 178, 154, 174, 170, 170, 154, 182, 148, 172, 178, 150, 174, 184, 142, 172, 184, 148, 176, 166, 166, 172, 168, 162, 180, 142, 182, 182, 146, 174, 182, 154, 172, 178, 154, 178, 166, 158, 180, 164, 170, 180, 146, 170, 178, 142, 178, 170, 164, 160, 180, 148, 190, 164, 148, 178, 160, 172, 178, 158, 168, 176, 150, 182, 180, 158, 168, 174, 160, 164, 164, 170, 168, 162, 172, 174, 154, 174, 178, 148, 180, 172, 144, 174, 172, 150, 186, 152, 150, 178, 158, 162, 180, 154, 168, 186, 138, 168, 172, 142, 174, 154, 162, 172, 160, 158, 174, 146, 164, 176, 154, 160, 172, 142, 174, 172, 146, 166, 170, 148, 172, 162, 142, 168, 154, 162, 162, 152, 158, 174, 130, 184, 166, 154, 164, 164, 156, 176, 162, 152, 180, 146, 158, 176, 158, 162, 184, 136, 180, 166, 150, 176, 174, 154, 176, 172, 168, 174, 152, 168, 172, 162, 172, 164, 164, 170, 166, 160, 174, 164, 152, 176, 176, 152, 176, 150, 150, 176, 154, 160, 190, 148, 170, 184, 138, 186, 176, 168, 180, 168, 164, 184, 148, 170, 172, 164, 168, 170, 166, 160, 180, 146, 176, 164, 158, 164, 174, 142, 186, 158, 160, 180, 152, 170, 174, 146, 174, 164, 160, 176, 170, 158, 166, 160, 170, 174, 172, 160, 176, 158, 176, 178, 138, 170, 190, 136, 182, 184, 146, 176, 180, 156, 176, 154, 160, 174, 142, 182, 164, 152, 178, 170, 150, 174, 168, 164, 178, 174, 156, 188, 174, 158, 192, 140, 162, 186, 146, 168, 200, 130, 170, 194, 154, 170, 164, 172, 164, 160, 168, 172, 154, 176, 172, 148, 176, 172, 152, 176, 184, 158, 172, 166, 158, 166, 166, 162, 182, 142, 184, 182, 144, 168, 182, 158, 160, 172, 164, 172}, + {166, 164, 166, 158, 176, 168, 166, 164, 166, 160, 166, 160, 176, 166, 160, 166, 178, 158, 172, 176, 156, 186, 162, 160, 184, 170, 152, 174, 162, 164, 184, 168, 162, 174, 164, 170, 168, 154, 178, 174, 156, 158, 172, 164, 172, 166, 170, 184, 158, 168, 170, 164, 164, 172, 152, 186, 170, 148, 178, 176, 150, 172, 160, 174, 174, 154, 192, 174, 164, 172, 178, 156, 178, 160, 160, 182, 162, 170, 166, 168, 154, 184, 150, 176, 174, 162, 164, 178, 154, 172, 178, 156, 164, 172, 158, 160, 170, 180, 164, 170, 166, 174, 164, 172, 162, 154, 186, 168, 164, 176, 164, 166, 182, 160, 164, 168, 164, 174, 174, 156, 158, 180, 164, 172, 174, 156, 172, 174, 162, 166, 164, 168, 176, 156, 168, 194, 148, 170, 174, 154, 174, 174, 156, 164, 164, 164, 156, 166, 158, 156, 162, 174, 170, 156, 168, 160, 162, 162, 160, 164, 182, 158, 152, 178, 146, 168, 162, 158, 154, 180, 146, 162, 164, 156, 164, 168, 158, 162, 170, 158, 154, 172, 150, 174, 160, 170, 164, 154, 172, 164, 168, 170, 164, 144, 194, 150, 164, 170, 170, 162, 174, 162, 164, 174, 156, 168, 172, 156, 166, 178, 162, 166, 178, 164, 174, 170, 166, 180, 162, 170, 174, 156, 168, 178, 154, 166, 180, 160, 178, 184, 158, 174, 168, 166, 166, 166, 168, 166, 166, 154, 172, 156, 168, 162, 152, 180, 168, 158, 184, 166, 158, 174, 168, 162, 174, 158, 162, 180, 162, 176, 178, 152, 174, 188, 152, 178, 174, 164, 168, 174, 158, 176, 150, 174, 170, 160, 182, 170, 156, 176, 160, 166, 168, 172, 172, 170, 164, 172, 174, 160, 164, 180, 144, 178, 162, 152, 182, 178, 156, 168, 172, 154, 180, 160, 162, 178, 150, 176, 164, 158, 170, 170, 158, 160, 172, 172, 170, 176, 164, 166, 164, 168, 172, 168, 152, 180, 152, 170, 172, 154, 180, 164, 160, 170, 166, 176, 178, 166, 164, 172, 164, 166, 176, 150, 172, 174, 164, 174, 172, 164, 170, 176, 148, 190, 154, 160, 172, 166, 164, 184}, + {164, 192, 150, 174, 182, 148, 176, 174, 158, 188, 166, 154, 190, 150, 156, 200, 152, 172, 170, 156, 178, 178, 154, 188, 170, 162, 158, 174, 174, 176, 148, 174, 168, 158, 166, 182, 156, 178, 176, 158, 184, 174, 162, 178, 166, 162, 182, 156, 166, 176, 156, 172, 178, 158, 170, 174, 154, 176, 184, 146, 180, 174, 156, 182, 162, 166, 180, 148, 166, 180, 144, 184, 162, 162, 180, 158, 164, 182, 156, 174, 178, 164, 154, 190, 140, 176, 178, 154, 174, 178, 160, 182, 180, 160, 176, 168, 166, 178, 150, 172, 174, 170, 158, 188, 148, 170, 180, 142, 182, 174, 156, 170, 184, 148, 168, 168, 158, 192, 148, 166, 188, 148, 170, 172, 172, 176, 160, 158, 184, 164, 170, 174, 162, 170, 184, 146, 174, 186, 146, 180, 168, 158, 176, 174, 142, 180, 162, 162, 174, 168, 156, 176, 140, 168, 174, 150, 164, 166, 160, 166, 166, 150, 174, 166, 154, 174, 160, 162, 172, 170, 160, 186, 142, 162, 172, 150, 166, 160, 146, 186, 162, 154, 178, 142, 160, 182, 142, 178, 170, 154, 172, 168, 158, 170, 170, 158, 178, 162, 158, 174, 166, 174, 166, 158, 170, 184, 152, 174, 170, 160, 162, 172, 170, 178, 172, 152, 182, 166, 160, 188, 160, 168, 178, 158, 174, 184, 154, 182, 162, 156, 186, 158, 162, 176, 154, 172, 188, 144, 180, 198, 160, 176, 186, 158, 174, 170, 160, 160, 182, 164, 168, 178, 156, 184, 166, 174, 170, 164, 164, 182, 154, 182, 166, 154, 178, 168, 156, 174, 160, 162, 176, 168, 176, 190, 152, 180, 170, 154, 174, 168, 168, 168, 180, 150, 192, 164, 164, 184, 154, 170, 182, 156, 182, 180, 156, 186, 172, 170, 160, 166, 170, 182, 162, 160, 180, 166, 160, 172, 158, 178, 172, 168, 178, 186, 164, 180, 162, 154, 184, 160, 168, 186, 160, 162, 184, 160, 162, 178, 162, 168, 188, 150, 170, 172, 166, 170, 158, 174, 174, 154, 170, 178, 154, 178, 176, 156, 168, 170, 166, 176, 154, 168, 182, 166, 158, 186, 158, 158, 182, 158}, + {170, 152, 180, 190, 140, 164, 200, 140, 176, 174, 158, 162, 180, 166, 180, 168, 156, 186, 162, 172, 182, 146, 176, 192, 138, 180, 186, 158, 172, 168, 172, 168, 160, 180, 172, 162, 178, 190, 140, 164, 200, 142, 178, 188, 144, 182, 188, 148, 188, 166, 164, 172, 158, 172, 182, 158, 172, 172, 154, 160, 186, 166, 170, 178, 164, 178, 170, 182, 178, 166, 166, 192, 154, 178, 188, 156, 172, 176, 154, 172, 186, 160, 184, 166, 162, 184, 154, 170, 184, 148, 178, 178, 154, 160, 198, 146, 176, 174, 160, 168, 180, 168, 176, 170, 164, 186, 154, 178, 186, 156, 182, 178, 158, 182, 182, 174, 170, 172, 166, 178, 164, 174, 180, 154, 172, 192, 148, 172, 186, 142, 182, 170, 158, 178, 158, 162, 186, 156, 168, 182, 140, 184, 188, 148, 172, 190, 146, 162, 180, 168, 170, 166, 172, 182, 162, 160, 176, 156, 172, 184, 134, 176, 176, 150, 172, 168, 160, 172, 156, 150, 174, 148, 164, 180, 156, 158, 182, 146, 168, 170, 152, 162, 184, 156, 180, 168, 162, 178, 162, 170, 180, 162, 174, 172, 148, 178, 174, 152, 186, 172, 154, 170, 168, 168, 176, 162, 170, 184, 158, 168, 188, 150, 172, 184, 148, 178, 180, 158, 182, 148, 178, 176, 158, 164, 188, 164, 164, 188, 148, 166, 192, 154, 176, 192, 150, 174, 174, 160, 182, 158, 176, 172, 154, 174, 180, 162, 176, 180, 142, 180, 178, 158, 174, 154, 176, 178, 158, 168, 180, 148, 170, 186, 152, 170, 188, 152, 184, 184, 162, 168, 192, 158, 170, 168, 172, 180, 148, 164, 196, 148, 182, 176, 156, 166, 180, 154, 176, 176, 156, 180, 170, 164, 172, 158, 162, 186, 146, 170, 184, 150, 178, 174, 158, 176, 168, 174, 180, 168, 182, 174, 156, 158, 188, 154, 164, 192, 146, 164, 204, 144, 180, 176, 148, 178, 176, 162, 176, 172, 156, 188, 150, 166, 178, 152, 176, 174, 166, 170, 180, 176, 174, 162, 172, 188, 148, 184, 184, 150, 170, 186, 162, 166, 192, 148, 180, 182, 154, 180, 162, 170}, + {174, 170, 184, 170, 168, 190, 168, 174, 184, 156, 190, 188, 142, 188, 176, 160, 178, 182, 172, 168, 172, 168, 176, 160, 172, 182, 156, 170, 190, 156, 176, 190, 148, 188, 184, 156, 174, 166, 170, 192, 150, 172, 192, 154, 180, 180, 156, 178, 176, 162, 168, 188, 158, 186, 166, 160, 188, 158, 182, 184, 152, 164, 186, 158, 178, 174, 154, 184, 172, 166, 178, 170, 158, 188, 154, 180, 186, 160, 186, 176, 146, 188, 172, 166, 168, 186, 156, 190, 172, 160, 178, 166, 172, 188, 160, 170, 184, 158, 184, 180, 156, 168, 176, 162, 172, 178, 164, 182, 158, 166, 188, 148, 164, 192, 142, 176, 180, 162, 182, 176, 154, 186, 174, 168, 162, 176, 170, 184, 162, 174, 182, 150, 182, 186, 158, 172, 174, 162, 168, 182, 164, 188, 152, 166, 174, 154, 180, 174, 148, 174, 174, 154, 172, 172, 148, 178, 166, 158, 176, 150, 170, 184, 144, 176, 170, 150, 178, 172, 160, 178, 168, 158, 172, 174, 150, 176, 162, 174, 166, 154, 170, 170, 144, 172, 180, 148, 170, 178, 156, 164, 176, 150, 184, 154, 170, 178, 142, 182, 184, 146, 174, 186, 140, 184, 170, 158, 184, 172, 158, 188, 168, 172, 170, 164, 172, 188, 158, 174, 176, 164, 172, 178, 162, 180, 174, 156, 176, 166, 174, 182, 158, 164, 196, 144, 182, 174, 154, 180, 186, 164, 172, 186, 172, 176, 172, 160, 184, 152, 176, 184, 158, 168, 194, 164, 170, 186, 154, 194, 162, 158, 190, 164, 170, 188, 166, 170, 180, 162, 158, 182, 160, 174, 186, 158, 174, 178, 164, 194, 158, 172, 182, 146, 184, 180, 142, 192, 182, 144, 194, 170, 168, 188, 172, 164, 182, 176, 162, 176, 168, 168, 174, 160, 176, 190, 158, 176, 178, 148, 186, 174, 156, 198, 158, 162, 188, 160, 178, 188, 160, 168, 176, 166, 172, 184, 160, 180, 178, 166, 184, 166, 174, 194, 170, 180, 180, 154, 176, 178, 144, 180, 174, 166, 174, 184, 140, 192, 168, 174, 182, 168, 170, 172, 154, 180, 178, 156, 162, 192, 160, 180}, + {168, 188, 160, 170, 182, 168, 164, 182, 160, 164, 186, 164, 174, 178, 166, 176, 176, 158, 186, 178, 156, 200, 170, 168, 184, 162, 188, 178, 168, 178, 168, 170, 180, 180, 156, 194, 160, 170, 184, 164, 164, 190, 170, 166, 184, 164, 170, 176, 166, 172, 176, 172, 182, 166, 172, 188, 176, 172, 182, 162, 180, 180, 158, 180, 188, 164, 168, 190, 150, 186, 178, 152, 204, 164, 164, 190, 166, 160, 174, 160, 176, 180, 170, 178, 166, 166, 182, 160, 160, 198, 168, 166, 190, 168, 170, 190, 156, 172, 184, 158, 180, 186, 166, 186, 170, 154, 188, 164, 174, 186, 178, 176, 182, 166, 188, 168, 156, 184, 174, 160, 176, 178, 154, 196, 164, 162, 188, 166, 168, 188, 162, 186, 168, 176, 174, 178, 172, 178, 162, 164, 192, 156, 168, 180, 170, 168, 182, 168, 176, 178, 160, 172, 172, 168, 170, 170, 154, 184, 174, 156, 188, 156, 176, 160, 174, 166, 162, 162, 164, 170, 170, 170, 174, 144, 176, 160, 164, 176, 162, 166, 176, 166, 184, 180, 144, 182, 166, 166, 190, 168, 158, 190, 152, 170, 186, 168, 170, 172, 172, 176, 176, 164, 170, 184, 158, 192, 160, 166, 178, 162, 154, 200, 146, 180, 192, 160, 180, 188, 162, 186, 176, 164, 180, 180, 160, 182, 174, 174, 188, 166, 178, 176, 166, 176, 182, 176, 172, 174, 156, 184, 178, 156, 190, 148, 174, 182, 168, 172, 176, 176, 174, 180, 170, 184, 158, 166, 180, 176, 164, 186, 170, 162, 192, 160, 166, 196, 162, 174, 174, 168, 180, 180, 158, 190, 168, 160, 184, 174, 166, 186, 162, 176, 186, 170, 180, 170, 172, 172, 182, 164, 168, 180, 166, 186, 172, 156, 188, 164, 180, 194, 172, 172, 184, 172, 170, 178, 162, 196, 156, 170, 190, 164, 166, 182, 164, 170, 194, 156, 170, 194, 160, 176, 168, 174, 180, 160, 158, 188, 170, 160, 190, 158, 172, 170, 166, 172, 188, 162, 184, 174, 168, 188, 168, 154, 186, 174, 172, 198, 166, 160, 184, 164, 166, 194, 160, 182, 174, 168, 184, 160}, + {174, 176, 178, 182, 162, 174, 184, 174, 182, 170, 162, 196, 168, 160, 200, 164, 176, 186, 158, 180, 190, 146, 186, 174, 180, 186, 166, 176, 174, 174, 168, 180, 184, 166, 188, 158, 186, 184, 150, 202, 174, 160, 180, 174, 170, 182, 168, 182, 190, 168, 178, 182, 164, 180, 182, 168, 182, 170, 168, 186, 180, 182, 190, 164, 166, 186, 164, 172, 188, 162, 170, 184, 158, 180, 176, 162, 194, 174, 170, 182, 174, 172, 188, 166, 182, 188, 170, 184, 180, 164, 188, 184, 144, 198, 176, 160, 190, 166, 172, 192, 160, 178, 184, 166, 182, 182, 166, 184, 180, 158, 182, 176, 164, 180, 172, 184, 186, 172, 162, 188, 170, 174, 194, 164, 188, 182, 160, 184, 176, 172, 180, 170, 178, 180, 164, 182, 186, 162, 186, 190, 158, 176, 176, 156, 178, 168, 164, 182, 176, 166, 182, 168, 174, 174, 166, 182, 184, 160, 178, 172, 162, 194, 176, 160, 178, 174, 166, 180, 168, 158, 188, 158, 164, 198, 158, 184, 174, 166, 182, 168, 152, 176, 166, 174, 168, 166, 168, 174, 150, 184, 172, 166, 182, 180, 156, 192, 172, 152, 192, 164, 170, 178, 174, 174, 184, 166, 174, 176, 166, 178, 188, 166, 190, 170, 164, 192, 164, 170, 190, 158, 170, 180, 174, 176, 192, 166, 172, 192, 168, 186, 168, 168, 184, 170, 172, 176, 168, 184, 174, 172, 182, 184, 164, 180, 172, 180, 176, 184, 170, 186, 182, 164, 188, 170, 182, 172, 170, 170, 204, 158, 182, 190, 148, 188, 184, 162, 192, 164, 166, 180, 180, 172, 178, 168, 174, 182, 170, 172, 184, 158, 180, 178, 170, 194, 172, 162, 192, 168, 174, 186, 164, 174, 188, 150, 186, 186, 162, 182, 174, 166, 184, 170, 158, 176, 188, 168, 182, 174, 174, 180, 162, 176, 188, 170, 186, 184, 156, 194, 176, 176, 188, 176, 166, 186, 172, 186, 174, 168, 184, 178, 174, 192, 172, 172, 168, 176, 168, 188, 166, 174, 184, 168, 170, 198, 156, 194, 178, 144, 180, 176, 164, 194, 170, 178, 186, 170, 178, 178, 170, 178}, + {160, 184, 176, 164, 192, 178, 172, 192, 160, 186, 200, 168, 182, 186, 162, 188, 184, 154, 198, 184, 158, 192, 178, 172, 188, 182, 162, 198, 164, 178, 194, 168, 178, 194, 146, 202, 188, 162, 194, 172, 168, 202, 158, 182, 186, 164, 180, 192, 160, 176, 210, 152, 184, 192, 158, 204, 166, 164, 204, 164, 176, 186, 178, 184, 190, 170, 186, 178, 156, 200, 180, 162, 190, 184, 164, 194, 180, 162, 204, 180, 172, 186, 170, 174, 182, 168, 188, 188, 150, 202, 176, 174, 194, 162, 174, 190, 164, 184, 186, 164, 186, 190, 168, 186, 190, 166, 186, 192, 158, 196, 160, 184, 194, 174, 176, 192, 158, 186, 194, 156, 188, 180, 150, 190, 174, 164, 184, 182, 170, 192, 182, 166, 194, 164, 176, 192, 152, 196, 188, 160, 200, 172, 170, 204, 166, 170, 196, 164, 172, 196, 164, 184, 184, 168, 168, 176, 156, 188, 176, 162, 182, 162, 168, 184, 168, 162, 198, 156, 182, 182, 144, 198, 174, 158, 186, 186, 154, 188, 174, 172, 182, 170, 168, 182, 168, 178, 186, 156, 178, 188, 152, 184, 176, 156, 186, 170, 162, 202, 152, 172, 202, 150, 192, 174, 160, 188, 182, 162, 194, 188, 158, 184, 162, 172, 184, 186, 166, 190, 164, 180, 206, 162, 182, 190, 156, 208, 180, 156, 194, 172, 172, 194, 166, 180, 186, 164, 180, 180, 166, 186, 196, 166, 182, 182, 164, 202, 172, 160, 194, 162, 172, 192, 168, 184, 204, 152, 194, 186, 152, 204, 180, 158, 200, 172, 170, 194, 168, 174, 198, 180, 172, 188, 162, 176, 194, 152, 190, 186, 162, 212, 178, 168, 196, 166, 172, 196, 154, 186, 186, 146, 200, 182, 162, 194, 178, 164, 184, 198, 152, 200, 166, 180, 188, 174, 176, 194, 160, 184, 192, 170, 188, 186, 166, 200, 158, 174, 190, 156, 182, 176, 152, 174, 194, 152, 176, 184, 166, 194, 182, 160, 196, 178, 168, 190, 180, 178, 198, 172, 184, 172, 168, 194, 188, 150, 196, 178, 156, 202, 188, 162, 194, 180, 166, 192, 168, 176, 188, 168, 180, 184}, + {198, 182, 168, 204, 172, 180, 184, 192, 180, 188, 182, 174, 188, 182, 190, 190, 166, 190, 190, 182, 188, 174, 176, 192, 160, 182, 204, 164, 192, 180, 178, 192, 174, 186, 198, 162, 188, 190, 168, 180, 198, 170, 188, 202, 174, 174, 196, 170, 194, 180, 154, 196, 188, 162, 198, 164, 188, 198, 168, 180, 190, 180, 182, 176, 178, 180, 190, 190, 186, 178, 174, 192, 182, 178, 200, 172, 176, 206, 156, 182, 190, 180, 186, 172, 182, 186, 184, 170, 200, 172, 178, 202, 174, 180, 186, 178, 188, 194, 170, 186, 184, 170, 190, 172, 176, 198, 176, 168, 204, 172, 184, 188, 184, 168, 192, 178, 184, 176, 188, 186, 184, 180, 194, 166, 186, 194, 172, 172, 196, 176, 180, 198, 168, 184, 196, 174, 198, 172, 168, 196, 166, 168, 190, 176, 182, 190, 180, 170, 188, 180, 174, 176, 162, 190, 190, 162, 194, 182, 172, 194, 172, 176, 192, 168, 170, 192, 156, 180, 178, 176, 190, 156, 178, 180, 184, 152, 186, 176, 166, 184, 178, 166, 188, 166, 178, 184, 164, 182, 176, 160, 202, 164, 170, 194, 176, 168, 186, 172, 180, 180, 176, 184, 180, 186, 180, 176, 170, 192, 166, 178, 188, 182, 178, 192, 180, 166, 194, 166, 190, 176, 164, 194, 178, 180, 188, 170, 178, 192, 184, 172, 186, 184, 178, 186, 180, 182, 196, 178, 200, 182, 170, 194, 180, 154, 192, 166, 182, 194, 172, 174, 190, 180, 184, 174, 192, 184, 178, 186, 188, 186, 168, 194, 180, 182, 184, 180, 188, 196, 162, 176, 198, 160, 202, 186, 176, 190, 176, 172, 190, 178, 176, 194, 174, 182, 178, 184, 188, 186, 192, 192, 190, 174, 192, 174, 166, 198, 178, 164, 208, 174, 184, 168, 184, 180, 186, 190, 190, 170, 170, 194, 184, 168, 190, 178, 186, 200, 166, 182, 188, 186, 186, 194, 170, 186, 198, 168, 188, 188, 174, 188, 170, 178, 198, 160, 190, 190, 174, 180, 174, 202, 176, 174, 188, 194, 188, 172, 188, 178, 170, 202, 162, 180, 198, 178, 180, 194, 170, 192, 190, 172}, + {182, 198, 186, 184, 208, 170, 196, 182, 188, 190, 178, 188, 192, 188, 184, 192, 188, 170, 212, 170, 194, 204, 180, 176, 200, 180, 198, 184, 172, 202, 180, 178, 198, 192, 184, 192, 182, 194, 204, 178, 180, 208, 168, 180, 214, 180, 188, 184, 168, 196, 196, 178, 210, 174, 192, 202, 166, 188, 194, 184, 192, 200, 168, 204, 182, 176, 206, 176, 180, 206, 186, 158, 210, 186, 166, 208, 166, 192, 200, 166, 198, 182, 192, 202, 182, 188, 198, 188, 180, 198, 190, 182, 200, 176, 192, 170, 182, 188, 190, 184, 198, 180, 180, 206, 172, 176, 208, 180, 186, 200, 178, 192, 204, 170, 188, 190, 176, 196, 178, 190, 188, 182, 184, 188, 176, 198, 202, 176, 194, 204, 154, 202, 198, 172, 192, 188, 182, 208, 182, 178, 204, 174, 194, 194, 164, 190, 182, 190, 178, 186, 178, 198, 180, 170, 200, 180, 170, 206, 178, 172, 202, 184, 178, 196, 174, 192, 204, 184, 184, 166, 178, 198, 176, 174, 198, 178, 186, 182, 180, 184, 192, 158, 194, 190, 164, 192, 178, 178, 196, 184, 174, 202, 176, 162, 204, 172, 196, 190, 166, 190, 186, 178, 190, 184, 176, 204, 176, 180, 194, 180, 180, 198, 174, 194, 202, 166, 200, 184, 176, 198, 184, 178, 192, 190, 168, 194, 182, 188, 184, 178, 208, 188, 170, 198, 196, 184, 188, 190, 166, 208, 184, 166, 204, 206, 182, 210, 168, 190, 204, 172, 184, 196, 190, 186, 178, 194, 186, 180, 182, 198, 182, 188, 196, 168, 190, 192, 166, 194, 210, 162, 202, 194, 174, 204, 168, 186, 200, 186, 196, 196, 168, 194, 192, 194, 190, 182, 170, 200, 182, 172, 192, 198, 184, 200, 174, 182, 208, 172, 180, 202, 176, 196, 188, 188, 188, 188, 168, 210, 180, 190, 200, 164, 196, 188, 186, 170, 210, 196, 180, 188, 168, 192, 192, 168, 198, 184, 182, 208, 172, 188, 192, 182, 192, 212, 168, 192, 194, 182, 198, 178, 180, 202, 176, 188, 202, 170, 184, 210, 168, 174, 220, 158, 202, 180, 174, 194, 194, 176, 198, 182}, + {186, 212, 176, 200, 190, 182, 218, 186, 182, 212, 184, 198, 216, 178, 186, 226, 178, 192, 204, 180, 190, 206, 204, 174, 202, 198, 190, 198, 194, 190, 196, 188, 212, 180, 192, 208, 180, 202, 190, 194, 208, 180, 200, 204, 172, 204, 212, 186, 194, 202, 184, 190, 192, 200, 194, 214, 188, 192, 210, 184, 202, 188, 200, 200, 192, 192, 198, 188, 200, 204, 194, 204, 184, 184, 212, 180, 204, 194, 188, 202, 194, 192, 184, 192, 208, 182, 214, 190, 192, 198, 174, 212, 182, 196, 230, 200, 176, 208, 194, 188, 212, 186, 210, 198, 200, 194, 182, 204, 176, 200, 200, 180, 202, 200, 202, 192, 202, 190, 198, 198, 180, 182, 222, 206, 176, 208, 200, 190, 208, 186, 192, 196, 202, 196, 194, 204, 170, 212, 190, 186, 216, 186, 184, 212, 202, 190, 182, 198, 194, 186, 198, 200, 178, 210, 186, 172, 210, 190, 188, 194, 180, 200, 200, 186, 182, 200, 176, 186, 212, 180, 178, 216, 184, 182, 200, 192, 178, 202, 180, 202, 184, 196, 192, 192, 186, 190, 192, 180, 188, 190, 190, 202, 200, 194, 174, 190, 192, 188, 186, 196, 190, 182, 202, 174, 194, 204, 178, 210, 194, 168, 218, 182, 178, 198, 198, 200, 208, 200, 176, 196, 210, 186, 196, 198, 188, 198, 196, 184, 196, 190, 194, 200, 190, 198, 172, 200, 210, 166, 214, 208, 184, 202, 192, 172, 204, 202, 190, 192, 198, 188, 210, 196, 190, 216, 188, 196, 228, 168, 202, 206, 182, 202, 212, 192, 204, 204, 198, 178, 196, 202, 190, 190, 202, 186, 196, 184, 202, 180, 198, 202, 190, 198, 180, 200, 214, 182, 206, 208, 192, 190, 208, 170, 196, 228, 186, 186, 200, 188, 202, 188, 204, 196, 196, 194, 206, 198, 174, 214, 194, 184, 202, 212, 178, 196, 190, 202, 176, 196, 206, 188, 186, 218, 176, 210, 196, 186, 214, 200, 190, 198, 202, 180, 206, 206, 186, 198, 190, 184, 206, 200, 176, 212, 208, 178, 198, 190, 192, 206, 186, 208, 184, 204, 196, 192, 186, 182, 212, 196, 200, 190}, + {238, 194, 228, 226, 188, 226, 234, 200, 226, 212, 216, 222, 210, 214, 236, 206, 208, 238, 212, 204, 220, 214, 228, 234, 202, 230, 218, 210, 222, 206, 214, 240, 194, 220, 248, 160, 254, 204, 200, 236, 212, 214, 246, 216, 190, 244, 218, 194, 246, 220, 194, 244, 210, 200, 224, 206, 218, 230, 194, 224, 222, 206, 238, 204, 216, 236, 210, 212, 222, 198, 236, 214, 214, 230, 212, 188, 238, 218, 208, 234, 210, 198, 240, 218, 192, 256, 182, 218, 246, 182, 244, 226, 196, 220, 210, 226, 208, 220, 206, 234, 204, 210, 218, 214, 224, 202, 220, 212, 226, 204, 234, 216, 200, 226, 210, 194, 246, 184, 236, 258, 188, 212, 234, 174, 238, 228, 206, 230, 206, 198, 234, 218, 198, 232, 228, 194, 228, 218, 214, 220, 194, 212, 216, 218, 230, 194, 208, 234, 202, 220, 210, 206, 222, 222, 200, 222, 224, 198, 220, 226, 192, 244, 206, 188, 238, 212, 192, 240, 214, 188, 220, 200, 210, 230, 188, 226, 212, 200, 218, 206, 200, 222, 206, 212, 214, 214, 214, 222, 210, 198, 230, 194, 232, 212, 182, 232, 218, 200, 234, 184, 200, 244, 190, 206, 230, 198, 216, 218, 212, 196, 242, 198, 218, 228, 194, 224, 212, 206, 220, 202, 226, 214, 216, 210, 224, 214, 216, 236, 186, 240, 190, 220, 248, 186, 222, 228, 202, 226, 214, 198, 228, 238, 200, 216, 232, 184, 240, 226, 186, 244, 216, 188, 240, 200, 202, 232, 204, 218, 222, 200, 232, 212, 216, 210, 228, 204, 232, 212, 206, 236, 228, 202, 216, 210, 218, 230, 188, 224, 224, 204, 242, 238, 166, 248, 200, 216, 234, 202, 218, 244, 210, 214, 216, 220, 216, 220, 214, 218, 222, 202, 208, 230, 206, 220, 212, 218, 214, 190, 240, 216, 206, 230, 222, 206, 248, 222, 184, 252, 210, 196, 240, 206, 194, 252, 204, 210, 216, 210, 218, 234, 192, 224, 226, 186, 226, 228, 186, 254, 212, 210, 228, 198, 234, 206, 210, 226, 208, 208, 228, 208, 220, 226, 214, 210, 254, 198, 198, 240, 206, 210}, + {206, 210, 236, 222, 206, 216, 216, 226, 222, 210, 234, 206, 218, 210, 236, 202, 232, 236, 212, 200, 234, 208, 236, 202, 242, 208, 212, 254, 188, 204, 256, 200, 214, 238, 202, 234, 212, 230, 210, 232, 214, 226, 220, 198, 224, 226, 202, 232, 220, 204, 246, 212, 198, 240, 224, 208, 224, 220, 228, 206, 220, 216, 208, 220, 210, 226, 236, 208, 210, 226, 228, 216, 216, 234, 226, 212, 226, 188, 238, 230, 200, 242, 208, 184, 254, 202, 220, 220, 232, 224, 214, 228, 204, 224, 230, 236, 204, 210, 236, 208, 220, 204, 218, 212, 236, 212, 216, 230, 208, 228, 216, 204, 250, 208, 222, 254, 190, 208, 234, 220, 220, 216, 230, 220, 222, 210, 206, 242, 208, 228, 216, 198, 228, 222, 216, 230, 218, 220, 232, 194, 234, 200, 228, 230, 214, 220, 222, 216, 214, 222, 212, 222, 216, 220, 230, 224, 200, 216, 216, 202, 222, 238, 200, 232, 212, 196, 232, 224, 202, 238, 206, 214, 212, 214, 212, 216, 232, 204, 210, 224, 202, 220, 212, 226, 212, 204, 234, 198, 216, 232, 176, 236, 240, 192, 212, 220, 202, 234, 210, 196, 236, 208, 210, 238, 210, 200, 216, 214, 214, 212, 218, 206, 232, 206, 204, 234, 214, 224, 212, 206, 232, 222, 208, 222, 206, 238, 202, 210, 220, 214, 214, 226, 212, 214, 226, 218, 198, 226, 216, 210, 252, 216, 210, 224, 196, 234, 216, 216, 218, 224, 206, 232, 206, 214, 226, 218, 228, 216, 228, 218, 210, 216, 220, 204, 226, 224, 224, 210, 220, 208, 224, 232, 216, 220, 246, 202, 208, 238, 190, 226, 226, 204, 232, 210, 218, 210, 226, 222, 220, 242, 212, 192, 236, 216, 220, 222, 212, 222, 224, 214, 220, 210, 224, 210, 228, 246, 192, 232, 216, 218, 222, 228, 212, 226, 218, 216, 206, 224, 216, 234, 214, 232, 210, 220, 198, 246, 218, 190, 258, 224, 198, 218, 218, 218, 216, 228, 218, 210, 230, 222, 190, 216, 240, 216, 220, 234, 220, 210, 210, 222, 218, 222, 212, 230, 208, 202, 240, 200, 206, 244}, + {238, 214, 200, 206, 220, 212, 226, 196, 222, 214, 212, 220, 200, 212, 214, 202, 228, 218, 198, 220, 212, 220, 190, 228, 204, 212, 206, 210, 212, 226, 198, 228, 198, 202, 210, 234, 196, 210, 220, 204, 228, 210, 216, 206, 218, 222, 200, 210, 228, 212, 204, 218, 208, 204, 220, 218, 208, 204, 216, 218, 214, 208, 214, 206, 202, 246, 204, 192, 232, 206, 222, 196, 204, 216, 226, 206, 198, 228, 228, 200, 228, 204, 228, 222, 200, 212, 216, 200, 218, 218, 226, 194, 202, 228, 210, 192, 234, 208, 216, 210, 208, 212, 236, 194, 202, 224, 214, 208, 218, 200, 210, 220, 196, 228, 224, 192, 220, 230, 204, 222, 194, 222, 206, 222, 208, 202, 220, 214, 206, 228, 200, 224, 218, 200, 206, 200, 228, 208, 208, 214, 204, 206, 232, 196, 208, 216, 182, 224, 226, 186, 224, 220, 188, 226, 214, 206, 228, 204, 216, 184, 220, 206, 210, 216, 186, 214, 226, 216, 204, 196, 220, 208, 210, 196, 212, 220, 202, 194, 222, 194, 202, 210, 216, 206, 218, 214, 194, 220, 200, 184, 236, 208, 194, 218, 214, 188, 218, 194, 218, 222, 194, 212, 222, 194, 218, 212, 198, 216, 196, 228, 208, 204, 198, 204, 218, 220, 200, 214, 192, 216, 196, 220, 204, 210, 226, 182, 218, 216, 206, 210, 200, 194, 234, 216, 188, 216, 228, 198, 206, 230, 208, 202, 208, 210, 226, 210, 204, 208, 214, 216, 208, 198, 224, 196, 220, 206, 210, 202, 242, 186, 212, 216, 200, 234, 216, 196, 198, 226, 210, 194, 220, 214, 222, 212, 200, 230, 224, 200, 234, 206, 204, 220, 210, 222, 202, 210, 218, 210, 216, 216, 208, 218, 216, 216, 202, 218, 188, 222, 208, 224, 210, 214, 202, 214, 208, 200, 228, 222, 196, 206, 206, 218, 238, 212, 202, 212, 202, 242, 208, 202, 224, 206, 202, 218, 204, 220, 196, 234, 210, 212, 226, 204, 218, 224, 190, 218, 212, 234, 202, 198, 224, 220, 206, 198, 202, 224, 238, 192, 220, 214, 214, 208, 228, 200, 212, 222, 214, 202, 230, 188}, + {214, 218, 218, 196, 208, 224, 204, 222, 194, 204, 216, 208, 190, 200, 218, 224, 206, 192, 226, 218, 202, 210, 218, 206, 218, 188, 190, 226, 194, 214, 206, 222, 198, 224, 198, 216, 230, 192, 214, 224, 202, 214, 194, 204, 222, 210, 218, 204, 208, 214, 206, 206, 220, 198, 204, 208, 212, 180, 224, 198, 222, 204, 198, 220, 214, 200, 200, 224, 204, 216, 210, 208, 212, 200, 196, 230, 204, 192, 228, 200, 202, 210, 202, 206, 230, 212, 178, 230, 218, 214, 202, 208, 214, 202, 204, 208, 192, 218, 216, 214, 188, 210, 196, 230, 206, 198, 218, 222, 192, 224, 200, 200, 218, 216, 188, 228, 218, 214, 202, 202, 216, 220, 202, 214, 218, 198, 204, 208, 202, 210, 200, 210, 210, 216, 208, 212, 212, 218, 206, 194, 218, 210, 208, 220, 210, 204, 222, 196, 202, 222, 194, 206, 230, 190, 202, 204, 198, 210, 218, 192, 200, 222, 208, 194, 214, 194, 206, 220, 184, 220, 194, 204, 216, 200, 194, 200, 210, 226, 194, 184, 240, 204, 194, 188, 208, 208, 218, 182, 202, 212, 200, 212, 210, 186, 216, 214, 186, 210, 216, 196, 210, 208, 184, 218, 208, 200, 214, 190, 216, 190, 212, 210, 204, 204, 210, 218, 188, 214, 214, 194, 208, 194, 206, 200, 196, 210, 220, 190, 204, 218, 206, 210, 198, 212, 222, 204, 188, 236, 208, 210, 208, 194, 216, 218, 194, 216, 218, 202, 208, 210, 218, 186, 220, 206, 210, 206, 198, 206, 188, 230, 210, 194, 218, 206, 192, 224, 214, 204, 222, 214, 198, 208, 192, 214, 216, 196, 200, 222, 212, 208, 224, 198, 224, 222, 194, 200, 204, 214, 198, 206, 200, 208, 208, 214, 202, 218, 212, 200, 222, 210, 194, 210, 206, 216, 188, 226, 200, 210, 218, 192, 204, 226, 204, 206, 234, 200, 210, 206, 200, 202, 212, 220, 210, 208, 204, 206, 208, 200, 214, 194, 222, 216, 202, 204, 216, 200, 232, 188, 222, 204, 208, 200, 234, 196, 222, 202, 192, 250, 186, 180, 234, 214, 204, 206, 200, 196, 214, 220, 176, 224}, + {204, 194, 238, 188, 214, 210, 206, 212, 192, 218, 216, 214, 204, 208, 212, 198, 214, 198, 212, 204, 202, 200, 204, 220, 208, 204, 202, 212, 212, 200, 232, 190, 214, 204, 200, 212, 200, 214, 204, 210, 204, 226, 202, 212, 216, 196, 202, 196, 212, 200, 208, 208, 198, 218, 208, 214, 208, 188, 226, 196, 222, 194, 198, 216, 214, 196, 198, 226, 200, 214, 206, 206, 218, 216, 202, 194, 220, 202, 204, 218, 202, 222, 188, 228, 204, 194, 226, 200, 206, 198, 226, 188, 222, 208, 204, 228, 188, 216, 202, 216, 218, 210, 200, 202, 220, 192, 206, 216, 188, 230, 182, 232, 210, 202, 210, 206, 202, 198, 230, 186, 222, 214, 194, 214, 200, 220, 206, 212, 216, 206, 212, 194, 218, 194, 212, 208, 196, 220, 208, 214, 194, 220, 200, 214, 202, 196, 226, 176, 226, 200, 198, 218, 194, 216, 202, 210, 210, 212, 196, 206, 236, 192, 192, 226, 202, 212, 198, 212, 204, 220, 198, 204, 208, 190, 224, 186, 210, 208, 198, 196, 200, 208, 206, 196, 200, 204, 202, 198, 216, 192, 206, 212, 220, 194, 190, 230, 188, 224, 192, 216, 200, 204, 214, 212, 190, 212, 208, 182, 204, 214, 186, 202, 204, 218, 188, 204, 210, 208, 198, 198, 212, 190, 208, 208, 186, 216, 198, 196, 210, 186, 232, 198, 200, 208, 222, 186, 208, 210, 198, 216, 198, 208, 208, 206, 206, 198, 214, 210, 216, 198, 192, 224, 194, 206, 208, 212, 194, 226, 200, 198, 204, 206, 236, 180, 210, 224, 192, 214, 208, 212, 196, 232, 188, 198, 234, 182, 220, 202, 204, 214, 196, 222, 202, 220, 202, 214, 212, 204, 218, 196, 228, 200, 214, 206, 200, 202, 200, 222, 188, 224, 210, 194, 220, 206, 220, 190, 210, 212, 208, 200, 206, 224, 178, 222, 212, 194, 220, 188, 228, 204, 222, 192, 216, 210, 192, 214, 204, 222, 206, 180, 228, 196, 228, 182, 232, 202, 210, 198, 204, 236, 174, 214, 208, 188, 210, 200, 216, 190, 220, 208, 194, 212, 208, 218, 194, 228, 206, 208, 220, 212}, + {182, 232, 186, 192, 206, 152, 240, 176, 186, 228, 148, 226, 178, 174, 228, 184, 194, 224, 172, 210, 220, 168, 216, 192, 214, 188, 194, 214, 152, 240, 196, 158, 236, 178, 216, 202, 174, 218, 194, 204, 204, 178, 216, 204, 154, 224, 196, 198, 214, 168, 216, 190, 196, 188, 190, 228, 172, 208, 212, 172, 234, 166, 198, 220, 178, 206, 212, 156, 234, 212, 160, 210, 196, 194, 200, 192, 216, 178, 240, 182, 178, 232, 162, 210, 206, 176, 218, 176, 212, 208, 182, 226, 182, 174, 246, 166, 208, 212, 158, 218, 192, 184, 198, 196, 214, 174, 212, 186, 196, 226, 174, 204, 212, 170, 222, 198, 194, 226, 186, 192, 212, 182, 214, 194, 200, 206, 174, 218, 186, 184, 224, 172, 196, 186, 200, 194, 188, 202, 194, 186, 218, 166, 204, 234, 152, 244, 178, 182, 236, 164, 218, 204, 186, 214, 176, 202, 204, 168, 216, 176, 208, 196, 180, 216, 188, 182, 212, 166, 216, 182, 190, 200, 168, 220, 180, 168, 222, 180, 198, 224, 154, 198, 216, 182, 200, 194, 200, 186, 198, 198, 176, 234, 192, 174, 226, 166, 194, 202, 164, 224, 178, 198, 190, 166, 226, 178, 178, 214, 180, 186, 204, 170, 204, 200, 176, 216, 166, 216, 188, 196, 186, 176, 234, 174, 190, 216, 158, 226, 208, 166, 212, 202, 176, 208, 180, 204, 200, 186, 208, 184, 214, 208, 160, 234, 182, 196, 190, 196, 208, 166, 206, 194, 180, 220, 172, 182, 230, 170, 226, 198, 164, 232, 180, 196, 214, 176, 222, 192, 176, 192, 198, 212, 184, 216, 190, 184, 230, 188, 194, 230, 176, 194, 214, 172, 214, 204, 186, 206, 168, 230, 188, 162, 252, 170, 202, 200, 186, 194, 198, 202, 174, 214, 200, 160, 214, 204, 186, 232, 182, 180, 236, 176, 216, 208, 180, 228, 192, 192, 198, 186, 214, 168, 210, 218, 174, 202, 192, 196, 202, 188, 194, 196, 184, 208, 174, 204, 202, 178, 234, 162, 198, 232, 164, 222, 206, 172, 228, 198, 198, 208, 198, 212, 182, 216, 188, 180, 210, 180, 192, 202}, + {188, 180, 190, 184, 188, 174, 196, 178, 190, 184, 184, 184, 190, 188, 170, 190, 184, 166, 190, 196, 170, 214, 168, 166, 198, 188, 212, 160, 178, 206, 166, 192, 174, 192, 188, 170, 192, 168, 188, 208, 168, 192, 186, 182, 188, 172, 202, 184, 178, 200, 166, 182, 196, 156, 172, 202, 168, 190, 186, 162, 212, 170, 202, 184, 186, 182, 184, 188, 186, 172, 208, 168, 178, 182, 168, 216, 164, 182, 208, 160, 210, 166, 192, 198, 168, 188, 168, 182, 210, 158, 202, 172, 190, 192, 164, 196, 196, 178, 190, 170, 200, 178, 190, 182, 182, 178, 200, 174, 180, 194, 170, 192, 186, 176, 204, 176, 184, 186, 182, 192, 170, 196, 186, 158, 222, 156, 192, 182, 178, 204, 170, 180, 200, 164, 202, 178, 182, 208, 166, 204, 174, 180, 208, 160, 200, 170, 186, 176, 180, 194, 176, 182, 200, 180, 184, 180, 174, 186, 180, 178, 188, 168, 168, 192, 176, 196, 180, 182, 194, 170, 186, 202, 176, 190, 170, 194, 176, 164, 194, 166, 194, 180, 170, 194, 184, 180, 174, 168, 220, 156, 176, 200, 158, 192, 176, 196, 184, 176, 186, 166, 186, 188, 166, 194, 172, 178, 186, 172, 192, 184, 174, 180, 182, 174, 186, 182, 180, 168, 182, 190, 174, 180, 188, 160, 202, 170, 182, 192, 148, 210, 184, 166, 204, 156, 188, 172, 180, 198, 166, 190, 180, 178, 214, 164, 194, 172, 176, 190, 170, 196, 184, 168, 186, 168, 182, 192, 188, 178, 192, 180, 184, 182, 186, 194, 184, 186, 180, 176, 206, 170, 182, 196, 172, 208, 166, 184, 196, 154, 224, 174, 182, 202, 138, 200, 170, 180, 216, 170, 180, 194, 178, 190, 166, 208, 176, 174, 202, 164, 210, 170, 182, 188, 176, 190, 190, 170, 184, 190, 176, 192, 182, 160, 202, 188, 180, 200, 168, 190, 196, 176, 186, 176, 206, 170, 184, 176, 172, 210, 182, 182, 200, 156, 208, 182, 172, 214, 156, 210, 182, 172, 186, 180, 188, 172, 182, 188, 178, 202, 160, 182, 214, 172, 184, 176, 164, 196, 192, 184, 196, 164}, + {198, 154, 172, 186, 152, 160, 180, 170, 180, 162, 178, 182, 162, 176, 182, 148, 180, 190, 162, 166, 170, 174, 164, 180, 166, 158, 180, 172, 160, 180, 160, 180, 162, 184, 164, 154, 174, 176, 150, 194, 170, 170, 168, 170, 166, 194, 158, 162, 170, 182, 166, 168, 176, 180, 172, 160, 174, 188, 148, 192, 154, 160, 184, 160, 162, 172, 164, 182, 168, 156, 180, 158, 176, 182, 166, 168, 176, 164, 182, 148, 194, 148, 186, 148, 176, 186, 148, 170, 192, 160, 194, 160, 160, 190, 168, 168, 162, 164, 178, 172, 168, 156, 178, 172, 164, 172, 168, 174, 176, 144, 164, 206, 152, 168, 164, 170, 188, 178, 148, 192, 166, 186, 162, 176, 164, 176, 176, 174, 162, 180, 158, 178, 156, 174, 172, 158, 176, 170, 164, 188, 160, 150, 184, 164, 168, 170, 168, 168, 156, 164, 188, 150, 176, 166, 162, 180, 180, 158, 164, 174, 180, 156, 182, 162, 166, 170, 164, 172, 166, 164, 182, 156, 168, 168, 150, 176, 190, 142, 186, 172, 168, 168, 170, 160, 164, 162, 166, 154, 186, 154, 162, 192, 160, 174, 156, 188, 154, 152, 178, 174, 160, 180, 142, 178, 178, 152, 174, 172, 154, 182, 152, 174, 168, 174, 166, 170, 166, 168, 156, 178, 148, 180, 160, 170, 162, 164, 158, 180, 156, 166, 158, 166, 164, 160, 192, 158, 154, 182, 168, 152, 186, 158, 180, 174, 180, 160, 158, 168, 162, 180, 168, 162, 178, 154, 172, 174, 174, 168, 172, 146, 192, 168, 146, 176, 170, 152, 194, 156, 172, 160, 188, 154, 174, 182, 168, 164, 166, 166, 188, 154, 188, 154, 172, 194, 164, 172, 184, 162, 180, 184, 156, 178, 182, 156, 168, 168, 176, 168, 170, 176, 164, 184, 142, 184, 170, 168, 166, 144, 168, 196, 142, 184, 178, 156, 186, 180, 152, 188, 164, 164, 176, 166, 196, 158, 164, 172, 166, 168, 172, 166, 156, 196, 166, 142, 182, 180, 156, 196, 160, 154, 194, 144, 174, 182, 164, 168, 180, 150, 184, 166, 164, 182, 152, 180, 180, 158, 166, 172, 176, 156}, + {142, 148, 148, 150, 144, 140, 134, 158, 142, 148, 134, 142, 134, 150, 140, 146, 150, 128, 158, 146, 144, 134, 160, 146, 140, 162, 142, 144, 136, 164, 134, 148, 160, 144, 154, 142, 144, 138, 148, 162, 124, 168, 138, 146, 154, 146, 132, 146, 176, 120, 142, 150, 144, 146, 138, 154, 126, 144, 150, 140, 156, 150, 150, 132, 154, 160, 136, 158, 144, 152, 150, 150, 138, 158, 154, 140, 154, 134, 170, 128, 154, 152, 124, 174, 130, 146, 146, 142, 158, 118, 162, 138, 152, 148, 136, 146, 150, 144, 128, 154, 158, 140, 142, 146, 140, 126, 154, 156, 132, 170, 140, 138, 150, 162, 142, 126, 168, 150, 150, 148, 152, 132, 160, 140, 138, 154, 146, 152, 128, 162, 144, 122, 166, 140, 140, 156, 140, 146, 150, 158, 128, 150, 142, 148, 134, 168, 158, 124, 166, 150, 140, 142, 150, 148, 130, 158, 144, 158, 144, 138, 134, 166, 144, 134, 164, 138, 140, 146, 142, 158, 130, 162, 126, 136, 150, 146, 146, 144, 148, 112, 162, 138, 136, 146, 158, 144, 128, 164, 152, 128, 148, 146, 144, 138, 152, 136, 142, 154, 134, 140, 156, 140, 136, 150, 142, 130, 150, 144, 134, 132, 150, 148, 138, 136, 144, 152, 128, 146, 152, 136, 144, 136, 154, 142, 142, 138, 144, 170, 128, 154, 156, 140, 148, 142, 150, 130, 162, 154, 126, 154, 144, 150, 154, 140, 130, 160, 152, 130, 140, 152, 152, 126, 150, 138, 148, 148, 148, 148, 126, 158, 140, 140, 170, 152, 144, 148, 150, 134, 160, 144, 136, 166, 144, 138, 134, 148, 158, 134, 162, 150, 138, 148, 144, 138, 142, 160, 132, 128, 160, 148, 142, 148, 160, 124, 180, 132, 122, 158, 134, 160, 130, 158, 134, 140, 140, 140, 146, 168, 152, 120, 166, 154, 124, 170, 138, 154, 148, 148, 142, 134, 172, 134, 150, 158, 132, 158, 138, 162, 134, 142, 150, 152, 140, 152, 142, 120, 176, 148, 122, 156, 146, 144, 128, 160, 132, 144, 164, 152, 140, 156, 162, 138, 148, 152, 130, 156, 158, 138, 124, 174}, + {122, 132, 134, 132, 110, 130, 138, 114, 142, 106, 108, 148, 102, 138, 110, 124, 158, 98, 130, 140, 112, 142, 112, 138, 118, 112, 118, 114, 134, 132, 116, 108, 134, 104, 152, 104, 128, 134, 112, 152, 98, 130, 152, 112, 136, 98, 130, 142, 102, 116, 132, 122, 136, 104, 136, 132, 118, 136, 116, 96, 164, 102, 128, 114, 126, 136, 90, 138, 126, 116, 152, 92, 128, 140, 114, 132, 126, 132, 132, 104, 132, 128, 114, 140, 120, 104, 134, 108, 148, 120, 130, 144, 102, 144, 104, 136, 142, 106, 120, 134, 108, 136, 102, 140, 126, 112, 124, 132, 112, 158, 104, 132, 118, 116, 138, 116, 126, 138, 120, 130, 106, 156, 114, 110, 148, 108, 132, 122, 118, 150, 98, 138, 122, 112, 138, 128, 112, 126, 110, 144, 116, 118, 136, 124, 132, 114, 130, 122, 120, 114, 118, 122, 144, 110, 116, 136, 94, 144, 112, 118, 128, 124, 122, 130, 108, 158, 104, 118, 138, 116, 142, 112, 116, 132, 112, 128, 108, 128, 136, 114, 126, 128, 100, 152, 100, 136, 124, 104, 132, 114, 124, 144, 98, 132, 112, 126, 138, 114, 106, 144, 120, 138, 110, 132, 130, 100, 138, 110, 106, 150, 98, 132, 114, 126, 146, 92, 120, 148, 96, 140, 110, 112, 142, 100, 124, 112, 122, 128, 114, 118, 118, 120, 150, 94, 130, 128, 116, 130, 122, 130, 142, 94, 136, 124, 100, 146, 112, 112, 138, 112, 148, 110, 114, 132, 108, 134, 126, 116, 130, 122, 124, 106, 128, 126, 98, 140, 118, 112, 150, 108, 112, 150, 100, 136, 132, 128, 128, 116, 124, 132, 112, 138, 112, 134, 120, 122, 134, 108, 150, 120, 116, 136, 120, 122, 142, 110, 118, 130, 114, 136, 114, 124, 132, 110, 136, 118, 124, 138, 114, 132, 116, 122, 140, 108, 138, 116, 122, 120, 128, 132, 128, 108, 138, 118, 126, 130, 112, 154, 114, 114, 130, 110, 138, 116, 118, 130, 118, 138, 112, 116, 134, 116, 140, 98, 138, 130, 112, 122, 122, 120, 132, 126, 120, 136, 102, 130, 128, 116, 124, 122}, + {94, 130, 102, 94, 88, 104, 120, 88, 110, 86, 122, 114, 88, 70, 138, 112, 80, 104, 96, 106, 118, 82, 96, 110, 116, 92, 86, 114, 104, 112, 84, 102, 114, 96, 106, 82, 102, 136, 98, 70, 114, 116, 102, 98, 94, 110, 108, 112, 82, 102, 112, 108, 84, 100, 122, 94, 88, 112, 94, 110, 106, 76, 98, 128, 98, 78, 106, 92, 122, 100, 94, 102, 112, 92, 90, 98, 120, 108, 106, 90, 118, 102, 106, 92, 100, 126, 106, 76, 110, 112, 108, 90, 90, 114, 110, 90, 110, 86, 112, 102, 90, 92, 118, 116, 78, 110, 100, 108, 104, 82, 92, 132, 110, 72, 102, 94, 122, 108, 102, 108, 100, 110, 104, 88, 126, 98, 92, 90, 108, 112, 94, 92, 90, 112, 108, 92, 92, 122, 98, 96, 86, 106, 126, 86, 88, 110, 94, 116, 92, 74, 114, 124, 88, 94, 110, 104, 100, 94, 94, 118, 100, 98, 78, 124, 102, 100, 88, 100, 98, 108, 100, 98, 100, 116, 92, 82, 118, 110, 98, 94, 96, 100, 112, 84, 94, 108, 110, 108, 82, 92, 114, 116, 82, 104, 102, 110, 106, 82, 98, 124, 92, 88, 100, 98, 106, 108, 94, 92, 110, 116, 74, 80, 130, 112, 80, 94, 104, 100, 90, 108, 74, 116, 108, 76, 86, 130, 98, 86, 98, 94, 114, 88, 90, 96, 114, 102, 94, 88, 112, 118, 86, 90, 110, 110, 106, 114, 68, 116, 116, 90, 86, 90, 122, 92, 96, 102, 102, 102, 102, 90, 110, 116, 90, 94, 102, 100, 104, 102, 94, 104, 118, 94, 84, 118, 106, 94, 106, 102, 116, 108, 90, 106, 98, 110, 112, 80, 114, 116, 92, 98, 86, 108, 116, 86, 104, 94, 108, 94, 88, 108, 112, 104, 86, 110, 100, 100, 100, 98, 84, 132, 102, 64, 116, 112, 108, 96, 108, 106, 106, 94, 110, 88, 120, 98, 86, 102, 112, 104, 94, 96, 90, 116, 110, 88, 96, 142, 82, 92, 94, 110, 118, 90, 98, 90, 114, 96, 86, 98, 120, 124, 66, 100, 120, 108, 90, 86, 110, 102, 114, 84}, + {88, 86, 78, 82, 66, 90, 76, 80, 76, 86, 56, 88, 70, 84, 94, 70, 82, 74, 90, 92, 66, 82, 90, 60, 100, 62, 78, 82, 76, 76, 80, 82, 80, 70, 82, 80, 78, 70, 68, 88, 84, 84, 74, 68, 78, 88, 70, 84, 92, 72, 78, 72, 82, 80, 76, 84, 72, 88, 74, 80, 80, 86, 88, 74, 70, 70, 70, 98, 80, 66, 90, 68, 80, 84, 64, 86, 74, 76, 76, 76, 86, 70, 78, 88, 80, 66, 76, 70, 94, 90, 68, 76, 66, 100, 80, 80, 82, 76, 90, 74, 64, 90, 72, 86, 60, 86, 88, 78, 76, 74, 82, 78, 68, 84, 84, 82, 86, 70, 66, 94, 66, 98, 74, 86, 78, 72, 88, 74, 78, 90, 70, 76, 90, 72, 72, 76, 90, 96, 68, 64, 78, 80, 88, 78, 76, 84, 64, 98, 66, 78, 92, 60, 88, 80, 76, 78, 68, 76, 86, 74, 66, 84, 70, 82, 98, 76, 68, 74, 84, 86, 78, 86, 60, 80, 80, 68, 80, 86, 70, 70, 86, 86, 66, 78, 84, 74, 88, 62, 64, 84, 92, 78, 78, 64, 76, 76, 80, 62, 86, 70, 68, 88, 76, 88, 68, 68, 82, 82, 56, 80, 76, 86, 84, 72, 72, 80, 76, 88, 74, 74, 84, 74, 92, 60, 78, 74, 76, 80, 80, 78, 82, 64, 86, 74, 62, 80, 60, 94, 88, 68, 86, 62, 86, 76, 72, 86, 88, 60, 80, 80, 86, 66, 80, 78, 80, 90, 72, 82, 74, 90, 70, 82, 64, 68, 84, 78, 86, 70, 82, 72, 70, 90, 68, 80, 64, 86, 74, 84, 90, 64, 80, 76, 84, 72, 66, 84, 100, 76, 74, 76, 72, 96, 78, 68, 88, 74, 86, 72, 76, 82, 82, 70, 70, 80, 90, 76, 70, 92, 72, 86, 64, 76, 90, 82, 96, 64, 70, 86, 66, 84, 84, 90, 62, 84, 66, 92, 92, 70, 74, 72, 84, 78, 80, 80, 68, 92, 76, 70, 78, 86, 80, 66, 90, 80, 74, 92, 80, 68, 96, 62, 72, 94, 70, 92, 70, 74, 82, 72, 78, 62}, + {62, 62, 58, 46, 68, 50, 78, 58, 50, 52, 66, 42, 66, 38, 84, 54, 48, 50, 58, 60, 60, 52, 70, 64, 58, 48, 54, 68, 60, 54, 58, 54, 64, 74, 50, 60, 54, 68, 50, 52, 62, 66, 64, 60, 50, 70, 48, 60, 52, 66, 62, 46, 44, 62, 68, 64, 44, 46, 66, 54, 64, 60, 52, 74, 46, 50, 58, 56, 70, 54, 62, 74, 52, 48, 66, 62, 60, 56, 52, 66, 56, 76, 58, 54, 48, 62, 50, 56, 56, 80, 34, 76, 48, 50, 64, 60, 48, 62, 64, 56, 44, 64, 58, 68, 44, 46, 58, 70, 62, 66, 56, 72, 52, 42, 68, 68, 60, 54, 62, 62, 60, 40, 68, 56, 62, 60, 44, 64, 62, 58, 66, 54, 48, 66, 52, 64, 50, 72, 56, 52, 58, 50, 60, 68, 36, 74, 62, 48, 50, 56, 70, 62, 46, 58, 62, 72, 58, 60, 52, 60, 44, 62, 52, 64, 60, 54, 64, 56, 54, 54, 52, 66, 60, 52, 50, 44, 70, 66, 50, 52, 44, 60, 72, 56, 62, 54, 66, 48, 50, 66, 64, 62, 46, 68, 58, 60, 50, 70, 52, 72, 46, 54, 56, 62, 70, 62, 38, 56, 62, 34, 72, 50, 70, 50, 56, 50, 52, 60, 58, 46, 62, 68, 56, 40, 64, 56, 54, 46, 62, 50, 78, 62, 50, 70, 56, 48, 52, 56, 64, 66, 48, 62, 48, 72, 52, 54, 56, 74, 50, 40, 48, 76, 46, 68, 32, 58, 68, 50, 58, 64, 58, 54, 56, 56, 58, 58, 64, 42, 60, 68, 66, 42, 66, 56, 64, 50, 70, 60, 62, 66, 64, 46, 64, 46, 58, 62, 56, 66, 52, 56, 64, 56, 62, 54, 52, 60, 58, 52, 36, 82, 56, 58, 50, 48, 60, 68, 50, 70, 54, 66, 50, 54, 66, 64, 58, 54, 62, 66, 68, 44, 68, 58, 60, 48, 50, 54, 80, 42, 74, 44, 52, 60, 58, 62, 56, 70, 56, 42, 68, 52, 56, 64, 46, 66, 54, 58, 60, 54, 68, 56, 46, 66, 62, 66, 56, 58, 58, 54, 50, 64}, + {54, 44, 30, 26, 40, 50, 34, 38, 36, 32, 38, 42, 38, 42, 54, 18, 40, 38, 28, 48, 46, 22, 52, 32, 38, 38, 32, 44, 38, 28, 34, 42, 44, 36, 48, 28, 34, 36, 30, 50, 50, 34, 30, 38, 32, 38, 32, 44, 40, 40, 36, 36, 28, 48, 42, 34, 42, 18, 44, 46, 44, 38, 36, 34, 34, 30, 32, 54, 42, 24, 42, 34, 36, 42, 32, 44, 32, 40, 28, 42, 46, 36, 40, 30, 40, 38, 36, 44, 40, 48, 24, 38, 36, 42, 36, 48, 26, 40, 38, 34, 40, 36, 38, 42, 28, 36, 38, 42, 38, 42, 32, 36, 30, 36, 44, 44, 36, 42, 32, 38, 40, 40, 42, 38, 44, 34, 26, 38, 50, 36, 36, 34, 30, 40, 46, 34, 46, 40, 22, 36, 34, 38, 44, 36, 24, 46, 38, 42, 42, 28, 40, 32, 36, 38, 38, 50, 34, 38, 28, 30, 40, 42, 34, 56, 34, 30, 32, 38, 46, 34, 38, 32, 46, 34, 28, 44, 44, 36, 34, 32, 28, 54, 36, 38, 42, 28, 38, 32, 34, 48, 40, 36, 30, 34, 42, 32, 44, 36, 36, 40, 30, 28, 44, 46, 34, 34, 32, 34, 42, 38, 38, 50, 34, 26, 32, 42, 36, 40, 32, 34, 46, 28, 48, 42, 30, 36, 34, 32, 38, 40, 42, 34, 38, 30, 38, 32, 42, 42, 50, 34, 32, 32, 50, 32, 44, 36, 32, 36, 32, 42, 38, 54, 34, 32, 40, 28, 48, 52, 28, 44, 38, 24, 38, 38, 38, 42, 36, 30, 38, 44, 30, 50, 36, 34, 42, 26, 48, 42, 36, 36, 36, 36, 36, 40, 32, 50, 46, 36, 32, 24, 52, 38, 44, 28, 36, 48, 36, 38, 36, 50, 24, 34, 40, 26, 52, 36, 32, 46, 26, 40, 40, 34, 46, 44, 38, 28, 40, 42, 38, 42, 28, 34, 42, 36, 36, 52, 44, 32, 36, 36, 40, 38, 48, 28, 38, 28, 30, 38, 46, 38, 34, 26, 34, 44, 38, 40, 52, 30, 30, 34, 28, 50, 42, 44, 32, 30, 42, 38, 40, 30}, + {38, 24, 30, 18, 40, 28, 30, 26, 24, 24, 34, 22, 36, 20, 32, 24, 22, 28, 44, 32, 18, 22, 26, 34, 28, 32, 30, 24, 24, 20, 26, 38, 44, 20, 24, 26, 28, 30, 34, 24, 38, 34, 28, 20, 30, 30, 46, 24, 38, 16, 32, 24, 34, 20, 34, 18, 20, 36, 14, 34, 32, 32, 24, 26, 36, 28, 34, 22, 22, 34, 26, 32, 24, 28, 28, 34, 34, 30, 24, 34, 34, 30, 22, 30, 30, 28, 32, 34, 22, 24, 34, 24, 24, 54, 22, 24, 26, 24, 22, 34, 26, 26, 30, 16, 32, 22, 26, 40, 36, 14, 38, 30, 30, 18, 40, 30, 32, 28, 32, 24, 34, 32, 40, 26, 28, 28, 26, 30, 36, 28, 16, 22, 32, 34, 24, 30, 26, 32, 22, 34, 32, 32, 22, 22, 26, 22, 36, 24, 28, 26, 30, 26, 30, 32, 36, 32, 20, 36, 20, 30, 18, 46, 32, 22, 20, 34, 28, 26, 38, 40, 12, 36, 18, 30, 26, 30, 20, 24, 24, 20, 34, 38, 22, 30, 24, 26, 36, 24, 22, 30, 40, 22, 24, 26, 26, 38, 24, 34, 24, 34, 34, 18, 28, 40, 28, 20, 28, 24, 34, 40, 26, 14, 36, 24, 30, 36, 32, 14, 28, 22, 22, 20, 38, 30, 24, 24, 22, 24, 32, 36, 34, 20, 28, 34, 16, 22, 32, 40, 22, 32, 20, 36, 30, 34, 30, 26, 30, 40, 20, 24, 28, 30, 20, 20, 24, 38, 30, 32, 20, 18, 28, 40, 30, 20, 26, 20, 32, 18, 24, 34, 34, 28, 24, 28, 32, 42, 24, 20, 28, 42, 26, 16, 34, 28, 36, 38, 22, 22, 28, 40, 28, 40, 16, 24, 36, 16, 22, 32, 24, 26, 24, 18, 32, 38, 30, 14, 30, 26, 38, 22, 22, 28, 38, 30, 26, 34, 40, 32, 26, 32, 22, 32, 32, 28, 26, 34, 24, 28, 16, 22, 30, 40, 36, 28, 16, 42, 22, 34, 26, 30, 16, 26, 28, 18, 32, 36, 22, 32, 26, 34, 28, 30, 24, 30, 34, 26, 20, 22, 32, 32}, + {8, 16, 8, 20, 14, 8, 18, 12, 10, 18, 16, 20, 14, 10, 4, 20, 12, 10, 20, 8, 16, 12, 16, 8, 28, 12, 8, 14, 18, 10, 14, 10, 22, 12, 10, 14, 8, 18, 10, 18, 22, 18, 12, 10, 14, 10, 10, 10, 20, 10, 20, 16, 4, 16, 10, 22, 14, 14, 16, 8, 14, 12, 16, 22, 6, 12, 8, 14, 18, 18, 18, 14, 8, 20, 10, 6, 22, 12, 8, 16, 18, 12, 12, 8, 14, 18, 20, 16, 10, 16, 16, 8, 4, 14, 28, 8, 12, 12, 14, 16, 16, 18, 16, 10, 14, 10, 12, 10, 20, 10, 16, 8, 10, 16, 12, 20, 18, 10, 18, 8, 12, 14, 16, 12, 16, 16, 22, 10, 10, 22, 12, 6, 24, 16, 12, 8, 6, 16, 20, 14, 12, 14, 10, 18, 18, 8, 16, 18, 16, 10, 12, 12, 10, 12, 14, 14, 12, 16, 10, 16, 12, 22, 10, 10, 26, 8, 14, 10, 6, 16, 24, 12, 12, 14, 14, 12, 12, 22, 10, 18, 4, 16, 6, 18, 18, 10, 12, 14, 10, 16, 20, 22, 10, 10, 14, 14, 22, 8, 6, 20, 10, 16, 24, 10, 16, 14, 6, 8, 28, 8, 14, 8, 12, 14, 12, 12, 18, 14, 12, 18, 16, 2, 26, 14, 8, 18, 8, 14, 6, 16, 14, 24, 8, 20, 10, 14, 20, 6, 18, 16, 10, 16, 8, 14, 10, 8, 22, 10, 20, 14, 20, 12, 12, 8, 16, 18, 14, 6, 14, 14, 10, 10, 22, 6, 20, 18, 18, 14, 12, 14, 16, 12, 12, 8, 14, 14, 2, 18, 24, 22, 6, 10, 16, 18, 18, 4, 14, 20, 14, 10, 2, 26, 12, 12, 22, 14, 18, 8, 12, 14, 18, 16, 10, 10, 8, 16, 8, 16, 18, 12, 12, 16, 10, 20, 12, 18, 12, 10, 14, 18, 4, 10, 16, 26, 16, 18, 14, 18, 10, 6, 12, 26, 6, 14, 14, 10, 16, 8, 10, 24, 18, 16, 8, 16, 6, 16, 18, 8, 12, 14, 8, 14, 16, 24, 18, 10, 10, 14, 14, 18}, + {6, 4, 8, 4, 4, 8, 6, 6, 8, 6, 8, 6, 0, 6, 4, 10, 6, 6, 2, 4, 4, 18, 4, 8, 14, 8, 0, 0, 4, 8, 6, 10, 0, 4, 6, 4, 6, 0, 4, 4, 8, 0, 4, 8, 10, 2, 4, 4, 8, 6, 8, 0, 0, 16, 6, 4, 4, 6, 4, 4, 12, 4, 12, 6, 2, 8, 2, 6, 8, 10, 2, 6, 0, 2, 6, 6, 4, 2, 12, 0, 0, 6, 6, 6, 4, 2, 12, 6, 2, 6, 12, 4, 8, 6, 6, 6, 0, 8, 2, 10, 6, 10, 6, 6, 8, 4, 10, 6, 2, 2, 6, 6, 4, 2, 4, 8, 4, 6, 8, 4, 4, 6, 2, 4, 6, 4, 4, 8, 4, 4, 12, 6, 6, 2, 6, 4, 10, 6, 2, 6, 10, 0, 10, 0, 8, 12, 6, 6, 4, 2, 8, 6, 2, 8, 8, 2, 2, 4, 2, 0, 6, 4, 8, 2, 6, 6, 0, 6, 6, 10, 8, 0, 4, 4, 4, 8, 6, 14, 6, 6, 6, 0, 8, 14, 6, 0, 2, 8, 2, 4, 2, 4, 8, 8, 4, 2, 10, 6, 0, 10, 2, 4, 0, 4, 0, 8, 2, 8, 10, 4, 8, 12, 0, 2, 12, 4, 4, 6, 2, 2, 8, 6, 4, 10, 10, 8, 6, 6, 0, 6, 10, 4, 0, 4, 4, 2, 2, 2, 10, 8, 4, 6, 2, 0, 2, 8, 6, 2, 10, 2, 6, 6, 6, 12, 2, 4, 2, 4, 6, 10, 6, 8, 6, 6, 6, 2, 14, 2, 8, 4, 6, 4, 6, 2, 2, 6, 4, 4, 2, 2, 6, 0, 6, 6, 8, 12, 8, 4, 4, 6, 6, 4, 8, 2, 2, 10, 6, 8, 8, 10, 2, 6, 6, 4, 4, 10, 8, 2, 8, 4, 4, 2, 4, 4, 10, 4, 4, 4, 2, 4, 2, 4, 2, 4, 6, 2, 8, 8, 8, 10, 10, 2, 0, 6, 8, 0, 10, 6, 6, 6, 6, 0, 6, 4, 10, 12, 6, 4, 2, 2, 6, 4, 6, 6, 6, 8, 0, 4, 0, 4} + } +} diff --git a/dap4/src/test/data/resources/baselinehyrax/amsre_20060131v5.dat.ncdump b/dap4/src/test/data/resources/baselinehyrax/amsre_20060131v5.dat.ncdump new file mode 100644 index 0000000000..8f3cecf7d4 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/amsre_20060131v5.dat.ncdump @@ -0,0 +1,32 @@ +netcdf amsre_20060131v5.dat { + variables: + ubyte time_a(3, 6); + string time_a:Equator_Crossing_Time = "1:30 PM"; + + // global attributes: + string :wspd_d.description = "wind speed 10 meters above the water surface, derived from surface roughness(wind stress); missing due to: sun glint; rain; near sea ice"; + string :FF_GLOBAL.latitude = "latitude = 0.25*ydim-90.125"; + string :wspd_a.pass = "ascending"; + :wspd_d.offset = 0.0f; + string :FF_GLOBAL.Server = "DODS FreeFrom based on FFND release 4.2.3", "DODS FreeFrom based on FFND release 4.2.3"; + string :wspd_a.long_name = "Surface Wind Speed"; + string :wspd_d.pass = "descending"; + string :wspd_a.units = "meters/second"; + :wspd_a.offset = 0.0f; + string :FF_GLOBAL.longitude = "longitude = 0.25*xdim-0.125 degreesEast"; + :wspd_a.scale = 0.2f; + string :FF_GLOBAL.Description = "Version-5 AMSR-E Ocean Product"; + string :wspd_a.description = "wind speed 10 meters above the water surface, derived from surface roughness(wind stress); missing due to: sun glint; rain; near sea ice"; + string :wspd_d.units = "meters/second"; + :wspd_d.scale = 0.2f; + string :wspd_d.long_name = "Surface Wind Speed"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + time_a = + { + {255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255} + } +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_comp.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_comp.nc.ncdump new file mode 100644 index 0000000000..984a9461d3 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_comp.nc.ncdump @@ -0,0 +1,137 @@ +netcdf nc4_nc_classic_comp { + dimensions: + lat = 6; + lon = 5; + time = 2; + variables: + float t(time, lat, lon); + + double p(time, lat, lon); + p:_FillValue = -9999.0; + + short rh(time, lat, lon); + rh:_FillValue = -1S; + + short pixel(lat, lon); + + string source(lat); + source:string_length = 5; + + int lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + int time(time); + string time:units = "seconds"; + + float z(time, lat, lon); + z:valid_range = 0.0, 5000.0; + z:_FillValue = 1.0f; + string z:units = "meters"; + string z:_CoordinateAxisType = "Height"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 1"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the NC_CLASSIC_MODEL data types."; + string :DODS_EXTRA.Unlimited_Dimension = "time"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + { + { + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0} + }, + { + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0} + } + } + p = + { + { + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1} + }, + { + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1} + } + } + rh = + { + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + }, + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + } + } + pixel = + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + } + source = "aaaaa", "aaaaa", "aaaaa", "aaaaa", "aaaaa", "aaaaa" + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} + time = + {1, 2} + z = + { + { + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0} + }, + { + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0} + } + } +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_no_comp.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_no_comp.nc.ncdump new file mode 100644 index 0000000000..83d2544aa0 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_nc_classic_no_comp.nc.ncdump @@ -0,0 +1,137 @@ +netcdf nc4_nc_classic_no_comp { + dimensions: + lat = 6; + lon = 5; + time = 2; + variables: + float t(time, lat, lon); + + double p(time, lat, lon); + p:_FillValue = -9999.0; + + short rh(time, lat, lon); + rh:_FillValue = -1S; + + short pixel(lat, lon); + + string source(lat); + source:string_length = 5; + + int lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + int time(time); + string time:units = "seconds"; + + float z(time, lat, lon); + z:valid_range = 0.0, 5000.0; + z:_FillValue = 1.0f; + string z:units = "meters"; + string z:_CoordinateAxisType = "Height"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 1"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the NC_CLASSIC_MODEL data types."; + string :DODS_EXTRA.Unlimited_Dimension = "time"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + { + { + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0} + }, + { + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.0, 1.0} + } + } + p = + { + { + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1} + }, + { + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1}, + {0.1, 0.1, 0.1, 0.1, 0.1} + } + } + rh = + { + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + }, + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + } + } + pixel = + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + } + source = "aaaaa", "aaaaa", "aaaaa", "aaaaa", "aaaaa", "aaaaa" + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} + time = + {1, 2} + z = + { + { + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0} + }, + { + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0}, + {10.0, 10.0, 10.0, 10.0, 10.0} + } + } +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_strings.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_strings.nc.ncdump new file mode 100644 index 0000000000..2cf8b72421 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_strings.nc.ncdump @@ -0,0 +1,36 @@ +netcdf nc4_strings { + dimensions: + lat = 6; + lon = 5; + variables: + string station(lat, lon); + string station:names = "site_1", "site_2", "site_3"; + string station:who = "james"; + + string scan_line(lon); + + string codec_name; + + int lat(lat); + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:_CoordinateAxisType = "Lon"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 2"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the new netcdf 4 unsigned data types."; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + station = + { "one", "two", "three", "four", "five", "one_b", "two_b", "three_b", "four_b", "five_b", "one_c", "two_c", "three_c", "four_c", "five_c", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one_f", "two_f", "three_f", "four_f", "five_f" + } + scan_line = "r", "r1", "r2", "r3", "r4" + codec_name = "mp3" + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_strings_comp.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_strings_comp.nc.ncdump new file mode 100644 index 0000000000..13eaa126f9 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_strings_comp.nc.ncdump @@ -0,0 +1,36 @@ +netcdf nc4_strings_comp { + dimensions: + lat = 6; + lon = 5; + variables: + string station(lat, lon); + string station:names = "site_1", "site_2", "site_3"; + string station:who = "james"; + + string scan_line(lon); + + string codec_name; + + int lat(lat); + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:_CoordinateAxisType = "Lon"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 2"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the new netcdf 4 unsigned data types."; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + station = + { "one", "two", "three", "four", "five", "one_b", "two_b", "three_b", "four_b", "five_b", "one_c", "two_c", "three_c", "four_c", "five_c", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one_f", "two_f", "three_f", "four_f", "five_f" + } + scan_line = "r", "r1", "r2", "r3", "r4" + codec_name = "mp3" + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types.nc.ncdump new file mode 100644 index 0000000000..c195c7df5f --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types.nc.ncdump @@ -0,0 +1,75 @@ +netcdf nc4_unsigned_types { + dimensions: + lat = 6; + lon = 5; + time = 2; + variables: + uint temp(time, lat, lon); + + ushort rh(time, lat, lon); + rh:_FillValue = 9999S; + + int lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + int time(time); + string time:units = "seconds"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 2"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the new netcdf 4 cardinal data types."; + string :DODS_EXTRA.Unlimited_Dimension = "time"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + temp = + { + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + }, + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + } + } + rh = + { + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + }, + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + } + } + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} + time = + {1, 2} +} diff --git a/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types_comp.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types_comp.nc.ncdump new file mode 100644 index 0000000000..9be7467142 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/nc4_unsigned_types_comp.nc.ncdump @@ -0,0 +1,75 @@ +netcdf nc4_unsigned_types_comp { + dimensions: + lat = 6; + lon = 5; + time = 2; + variables: + uint temp(time, lat, lon); + + ushort rh(time, lat, lon); + rh:_FillValue = 9999S; + + int lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + int lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + int time(time); + string time:units = "seconds"; + + // global attributes: + string :NC_GLOBAL.title = "Hyrax/netcdf handler test file 2"; + :NC_GLOBAL.version = 1.0; + string :NC_GLOBAL.description = "This file has all of the new netcdf 4 cardinal data types."; + string :DODS_EXTRA.Unlimited_Dimension = "time"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + temp = + { + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + }, + { + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7} + } + } + rh = + { + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + }, + { + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2} + } + } + lat = + {0, 10, 20, 30, 40, 50} + lon = + {-140, -118, -96, -84, -52} + time = + {1, 2} +} diff --git a/dap4/src/test/data/resources/baselinehyrax/ref_tst_compounds.nc.ncdump b/dap4/src/test/data/resources/baselinehyrax/ref_tst_compounds.nc.ncdump new file mode 100644 index 0000000000..c687cc5544 --- /dev/null +++ b/dap4/src/test/data/resources/baselinehyrax/ref_tst_compounds.nc.ncdump @@ -0,0 +1,43 @@ +netcdf ref_tst_compounds { + dimensions: + n = 3; + variables: + + Structure { + short day; + short elev; + int count; + float relhum; + double time; + } obs(n); + obs:elev = -99S; + obs:count = -99; + obs:time = -99.0; + obs:day = -99S; + obs:relhum = -99.0f; + + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + obs = + { day = 15 + elev = 2 + count = 1 + relhum = 0.5 + time = 3600.01 + } obs(0) + { day = 157 + elev = -99 + count = -99 + relhum = -99.0 + time = -99.0 + } obs(1) + { day = 20 + elev = 6 + count = 3 + relhum = 0.75 + time = 5000.01 + } obs(2) +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.8.raw.txt b/dap4/src/test/data/resources/baselineraw/test_atomic_array.2.nc.ncdump similarity index 59% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.8.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_atomic_array.2.nc.ncdump index 8c33c36312..ad2d6e91b7 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.8.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_atomic_array.2.nc.ncdump @@ -1,12 +1,13 @@ -netcdf test_atomic_array.nc.8 { +netcdf test_atomic_array.2.nc.dap { variables: short v16(3); - string v16:_DAP4_Checksum_CRC32 = "0xb4fb7f89"; // global attributes: string :_dap4.ce = "/v16[0:1,3]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v16 = - {1, 2, 4} + + data: + v16 = + {1, 2, 4} } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.9.raw.txt b/dap4/src/test/data/resources/baselineraw/test_atomic_array.3.nc.ncdump similarity index 59% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.9.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_atomic_array.3.nc.ncdump index 7137b40bd6..15b3796744 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_atomic_array.nc.9.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_atomic_array.3.nc.ncdump @@ -1,12 +1,13 @@ -netcdf test_atomic_array.nc.9 { +netcdf test_atomic_array.3.nc.dap { variables: short v16(3); - string v16:_DAP4_Checksum_CRC32 = "0xa0d9e652"; // global attributes: string :_dap4.ce = "/v16[3,0:1]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v16 = - {4, 1, 2} + + data: + v16 = + {4, 1, 2} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_atomic_array.nc.ncdump similarity index 64% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_atomic_array.nc.ncdump index a190c8fd5c..cd0d5ea889 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_atomic_array.nc.ncdump @@ -19,7 +19,7 @@ netcdf test_atomic_array { char vc(d2); - String vs(d2, d2); + string vs(d2, d2); opaque vo(d1, d2); @@ -28,29 +28,30 @@ netcdf test_atomic_array { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vu8 = - { - {255, 1, 2}, - {3, 4, 5} - } -v16 = - {1, 2, 3, 4} -vu32 = - { - {5, 4, 3}, - {2, 1, 0} - } -vd = - {17.9, 1024.8} -vc = "@&" -vs = - { "hello world", " + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", " ", "Καλημέα", "abc" - } -vo = 0x0123456789abcdef, - 0xabcdef0000000000; + } + vo = 0x0123456789abcdef, + 0xabcdef0000000000; -primary_cloud = - {0, 2, 0, 1, 127} + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_atomic_types.nc.ncdump similarity index 67% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_atomic_types.nc.ncdump index 205e48eb6d..c330cbcde2 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_atomic_types.nc.ncdump @@ -25,7 +25,7 @@ netcdf test_atomic_types { char vc; - String vs; + string vs; opaque vo; @@ -37,21 +37,22 @@ netcdf test_atomic_types { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -v8 =-128 -vu8 =255 -v16 =-32768 -vu16 =65535 -v32 =2147483647 -vu32 =4294967295 -v64 =9223372036854775807 -vu64 =18446744073709551615 -vf =3.1415927 -vd =3.141592653589793 -vc =@ -vs = "hello world" -vo = 0x0123456789abcdef; - -primary_cloud =2 -secondary_cloud =127 + + data: + v8 = -128 + vu8 = 255 + v16 = -32768 + vu16 = 65535 + v32 = 2147483647 + vu32 = 4294967295 + v64 = 9223372036854775807 + vu64 = 18446744073709551615 + vf = 3.1415927 + vd = 3.141592653589793 + vc = @ + vs = "hello world" + vo = 0x0123456789abcdef; + + primary_cloud = 2 + secondary_cloud = 127 } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_enum_1.nc.ncdump similarity index 89% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_enum_1.nc.ncdump index 7723b215c7..1c69c45002 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_enum_1.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_enum { +netcdf test_enum_1 { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; @@ -8,6 +8,7 @@ netcdf test_enum { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud =2 + + data: + primary_cloud = 2 } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_2.nc.raw.txt b/dap4/src/test/data/resources/baselineraw/test_enum_2.nc.ncdump similarity index 83% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_2.nc.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_enum_2.nc.ncdump index 62ee4d281a..e74e8a0f91 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_2.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_enum_2.nc.ncdump @@ -2,16 +2,16 @@ netcdf test_enum_2 { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; - group: h { variables: enum cloud_class_t primary_cloud; string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x3c0c8ea1"; } + // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -h/primary_cloud =2 + + data: + h/primary_cloud = 2 } diff --git a/dap4/src/test/data/resources/baselineraw/test_enum_3.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_enum_3.nc.ncdump new file mode 100644 index 0000000000..b46188656b --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_enum_3.nc.ncdump @@ -0,0 +1,16 @@ +netcdf test_enum_3 { + types: + byte enum cloud_class_t { Clear = 0, Stratus = 1, Missing = 127}; + + group: h { + variables: + enum cloud_class_t primary_cloud; + + } + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + h/primary_cloud = 1 +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.4.raw.txt b/dap4/src/test/data/resources/baselineraw/test_enum_array.6.nc.ncdump similarity index 79% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.4.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_enum_array.6.nc.ncdump index 82933a50d3..a026f37c27 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum_array.nc.4.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_enum_array.6.nc.ncdump @@ -1,16 +1,17 @@ -netcdf test_enum_array.nc.4 { +netcdf test_enum_array.6.nc.dap { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; variables: enum cloud_class_t primary_cloud(2); string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x04e840eb"; // global attributes: string :_dap4.ce = "/primary_cloud[1:2:4]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud = - {2, 1} + + data: + primary_cloud = + {2, 1} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_enum_array.nc.ncdump similarity index 90% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_enum_array.nc.ncdump index 6bc8a7ac6d..1ede109916 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_enum_array.nc.ncdump @@ -10,7 +10,8 @@ netcdf test_enum_array { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud = - {0, 2, 0, 1, 127} + + data: + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/src/test/data/resources/baselineraw/test_fill.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_fill.nc.ncdump new file mode 100644 index 0000000000..26ece6583d --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_fill.nc.ncdump @@ -0,0 +1,17 @@ +netcdf test_fill { + variables: + ubyte uv8; + + short v16; + + int uv32; + uv32:_FillValue = 17; + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + uv8 = 240 + v16 = 32700 + uv32 = 111000 +} diff --git a/dap4/src/test/data/resources/baselineraw/test_fill_2.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_fill_2.nc.ncdump new file mode 100644 index 0000000000..ffdf800d09 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_fill_2.nc.ncdump @@ -0,0 +1,32 @@ +netcdf test_fill_2 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d2 = 2; + variables: + enum cloud_class_t enumvar(d2); + string enumvar:_FillValue = "Missing"; + + int uv32(d2); + uv32:_FillValue = 17; + + ubyte uv8(d2); + uv8:_FillValue = 120B; + + short v16(d2); + v16:_FillValue = -37S; + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + enumvar = + {2, 127} + uv32 = + {111000, 17} + uv8 = + {240, 120} + v16 = + {32700, -37} +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_groups1.nc.raw.txt b/dap4/src/test/data/resources/baselineraw/test_groups1.nc.ncdump similarity index 50% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_groups1.nc.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_groups1.nc.ncdump index 253a698474..2cb5bfc39b 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_groups1.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_groups1.nc.ncdump @@ -1,20 +1,16 @@ netcdf test_groups1 { dimensions: dim1 = 5; - group: g { dimensions: dim2 = 3; - group: h { dimensions: dim3 = 7; variables: int v1(dim1); - string v1:_DAP4_Checksum_CRC32 = "0x1d1d272c"; float v2(dim2); - string v2:_DAP4_Checksum_CRC32 = "0x0fe72d43"; } @@ -23,22 +19,23 @@ netcdf test_groups1 { dim3 = 7; variables: int v1(dim1); - string v1:_DAP4_Checksum_CRC32 = "0xa9b4a0fb"; float v3(dim3); - string v3:_DAP4_Checksum_CRC32 = "0x29f1e312"; } + } + // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -g/h/v1 = - {-876354855, -1761252264, 1723477387, -46827465, 1475147969} -g/h/v2 = - {12.0, -100.0, 9.96921E36} -g/i/v1 = - {2, 3, 5, 7, 11} -g/i/v3 = - {23.0, 29.0, 19.0, 31.0, 17.0, 37.0, 13.0} + + data: + g/h/v1 = + {-876354855, -1761252264, 1723477387, -46827465, 1475147969} + g/h/v2 = + {12.0, -100.0, 9.96921E36} + g/i/v1 = + {2, 3, 5, 7, 11} + g/i/v3 = + {23.0, 29.0, 19.0, 31.0, 17.0, 37.0, 13.0} } diff --git a/dap4/src/test/data/resources/baselineraw/test_misc1.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_misc1.nc.ncdump new file mode 100644 index 0000000000..1302c57ce3 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_misc1.nc.ncdump @@ -0,0 +1,30 @@ +netcdf test_misc1 { + dimensions: + lon = 4; + time = 0; + lat = 6; + unlim = 3; + variables: + float var(unlim); + var:_ChunkSizes = 1024; + + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + var = + {0.0, 1.0, 3.0} + lon = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dmr b/dap4/src/test/data/resources/baselineraw/test_one_var.nc.ncdump similarity index 87% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineraw/test_one_var.nc.ncdump index 2f331bc8d9..f43721d3ea 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineraw/test_one_var.nc.ncdump @@ -4,4 +4,7 @@ netcdf test_one_var { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = 17 } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.1.raw.txt b/dap4/src/test/data/resources/baselineraw/test_one_vararray.4.nc.ncdump similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.1.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_one_vararray.4.nc.ncdump index 4b380edb65..7b193661a4 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_one_vararray.nc.1.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_one_vararray.4.nc.ncdump @@ -1,12 +1,13 @@ -netcdf test_one_vararray.nc.1 { +netcdf test_one_vararray.4.nc.dap { variables: int t(1); - string t:_DAP4_Checksum_CRC32 = "0xb6a88010"; // global attributes: string :_dap4.ce = "/t[1]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {37} + + data: + t = + {37} } diff --git a/dap4/src/test/data/resources/baselineraw/test_one_vararray.5.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_one_vararray.5.nc.ncdump new file mode 100644 index 0000000000..c0144f5c1c --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_one_vararray.5.nc.ncdump @@ -0,0 +1,13 @@ +netcdf test_one_vararray.5.nc.dap { + variables: + int t(2); + + // global attributes: + string :_dap4.ce = "/t[0:1]"; + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + {17, 37} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_one_vararray.nc.ncdump similarity index 84% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_one_vararray.nc.ncdump index 6c047673ba..4f97c08829 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_one_vararray.nc.ncdump @@ -6,7 +6,8 @@ netcdf test_one_vararray { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t = - {17, 37} + + data: + t = + {17, 37} } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque.nc.raw.txt b/dap4/src/test/data/resources/baselineraw/test_opaque.nc.ncdump similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque.nc.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_opaque.nc.ncdump index 54dcb52c2b..940999bb11 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_opaque.nc.ncdump @@ -1,11 +1,11 @@ netcdf test_opaque { variables: opaque vo1; - string vo1:_DAP4_Checksum_CRC32 = "0xd24ddadd"; // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vo1 = 0x0123456789abcdef; + + data: + vo1 = 0x0123456789abcdef; } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.7.raw.txt b/dap4/src/test/data/resources/baselineraw/test_opaque_array.7.nc.ncdump similarity index 54% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.7.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_opaque_array.7.nc.ncdump index 10d45fe22b..693c3ea122 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.7.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_opaque_array.7.nc.ncdump @@ -1,13 +1,14 @@ -netcdf test_opaque_array.nc.7 { +netcdf test_opaque_array.7.nc.dap { variables: opaque vo2(1, 2); - string vo2:_DAP4_Checksum_CRC32 = "0xcca386bf"; // global attributes: string :_dap4.ce = "/vo2[1][0:1]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vo2 = 0xfedcba9876543210, - 0xfedcba9876543210; + + data: + vo2 = 0xfedcba9876543210, + 0xfedcba9876543210; } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.raw.txt b/dap4/src/test/data/resources/baselineraw/test_opaque_array.nc.ncdump similarity index 55% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_opaque_array.nc.ncdump index 0f2053e984..3d7b9c3f77 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_opaque_array.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_opaque_array.nc.ncdump @@ -3,14 +3,14 @@ netcdf test_opaque_array { d2 = 2; variables: opaque vo2(d2, d2); - string vo2:_DAP4_Checksum_CRC32 = "0x91581cda"; // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vo2 = 0x0123456789abcdef, - 0x0123456789abcdef, - 0x0123456789abcdef, - 0x0123456789abcdef; + + data: + vo2 = 0x0123456789abcdef, + 0xabcdef0000000000, + 0xfedcba9876543210, + 0xfedcba9999999999; } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dmr b/dap4/src/test/data/resources/baselineraw/test_struct1.nc.ncdump similarity index 74% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineraw/test_struct1.nc.ncdump index 17f3955052..1f85a06a38 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineraw/test_struct1.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_struct_type { +netcdf test_struct1 { variables: Structure { @@ -11,4 +11,10 @@ netcdf test_struct_type { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { x = 1 + y = -2 + } s(0) } diff --git a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_struct_array.nc.6.raw.txt b/dap4/src/test/data/resources/baselineraw/test_struct_array.8.nc.ncdump similarity index 51% rename from dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_struct_array.nc.6.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_struct_array.8.nc.ncdump index 5ca77032b5..e3b8fe225b 100644 --- a/dap4/d4tests/src/test/data/resources/TestConstraints/baseline/test_struct_array.nc.6.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_struct_array.8.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_struct_array.nc.6 { +netcdf test_struct_array.8.nc.dap { variables: Structure { @@ -7,28 +7,29 @@ netcdf test_struct_array.nc.6 { int y; string y:_CoordinateAxisType = "GeoY"; } s(2, 2); - string s:_DAP4_Checksum_CRC32 = "0x324d0ea6"; // global attributes: string :_dap4.ce = "/s[0:2:3][0:1]"; + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -s = - { - x =1 - y =-1 - } s(0) - { - x =17 - y =37 - } s(1) - { - x =-4 - y =12 - } s(2) - { - x =-8 - y =8 - } s(3) + + data: + s = + { + x = 1 + y = -1 + } s(0) + { + x = 17 + y = 37 + } s(1) + { + x = -4 + y = 12 + } s(2) + { + x = -8 + y = 8 + } s(3) } diff --git a/dap4/src/test/data/resources/baselineraw/test_struct_array.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_struct_array.nc.ncdump new file mode 100644 index 0000000000..17e281c7d7 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_struct_array.nc.ncdump @@ -0,0 +1,56 @@ +netcdf test_struct_array { + dimensions: + dx = 4; + dy = 3; + variables: + + Structure { + int x; + string x:_CoordinateAxisType = "GeoX"; + int y; + string y:_CoordinateAxisType = "GeoY"; + } s(dx, dy); + + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { x = 1 + y = -1 + } s(0) + { x = 17 + y = 37 + } s(1) + { x = -32767 + y = 32767 + } s(2) + { x = -1 + y = 3 + } s(3) + { x = -2 + y = 2 + } s(4) + { x = -3 + y = 1 + } s(5) + { x = -4 + y = 12 + } s(6) + { x = -8 + y = 8 + } s(7) + { x = -12 + y = 4 + } s(8) + { x = -5 + y = 15 + } s(9) + { x = -10 + y = 10 + } s(10) + { x = -15 + y = 5 + } s(11) +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_struct_nested.nc.ncdump similarity index 74% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_struct_nested.nc.ncdump index 19f3ca3f32..7b333adcdb 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_nested.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_struct_nested.nc.ncdump @@ -21,18 +21,16 @@ netcdf test_struct_nested { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + data: - x = - { - field1 = - { - x = 1 + x = + { field1 = + { x = 1 y = -2 - } x.field1(0) - field2 = - { - x = 255 + } field1(0) + field2 = + { x = 255 y = 90 - } x.field2(0) + } field2(0) } x(0) } diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested3.hdf5.raw.txt b/dap4/src/test/data/resources/baselineraw/test_struct_nested3.nc.ncdump similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested3.hdf5.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_struct_nested3.nc.ncdump index a165d7033e..afb80725ed 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested3.hdf5.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_struct_nested3.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_struct_nested3.hdf5 { +netcdf test_struct_nested3 { variables: Structure { @@ -12,19 +12,16 @@ netcdf test_struct_nested3.hdf5 { } field3; } x; - string x:_DAP4_Checksum_CRC32 = "0xc9e1efe6"; // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + data: - x = - { - field3 = - { - field2 = - { - field1 = 17 + x = + { field3 = + { field2 = + { field1 = 17 } field2(0) } field3(0) } x(0) diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dap b/dap4/src/test/data/resources/baselineraw/test_struct_type.nc.ncdump similarity index 91% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dap rename to dap4/src/test/data/resources/baselineraw/test_struct_type.nc.ncdump index 084f785c8c..e66c700642 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_type.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineraw/test_struct_type.nc.ncdump @@ -11,11 +11,10 @@ netcdf test_struct_type { // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + data: - s = - { - x = 1 + s = + { x = 1 y = -2 } s(0) } - diff --git a/dap4/src/test/data/resources/baselineraw/test_test.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_test.nc.ncdump new file mode 100644 index 0000000000..62d089889d --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_test.nc.ncdump @@ -0,0 +1,13 @@ +netcdf test_test { + types: + byte enum enum_t { c1 = 1, c2 = 2, c3 = 3}; + + variables: + enum enum_t v1; + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + v1 = 1 +} diff --git a/dap4/src/test/data/resources/baselineraw/test_unlim.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_unlim.nc.ncdump new file mode 100644 index 0000000000..38981848bf --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_unlim.nc.ncdump @@ -0,0 +1,50 @@ +netcdf test_unlim { + dimensions: + lon = 2; + time = 2; + lat = 3; + variables: + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float pr(time, lat, lon); + pr:_ChunkSizes = 1, 3, 2; + string pr:standard_name = "air_pressure_at_sea_level"; + string pr:units = "hPa"; + string pr:_CoordinateAxisType = "Pressure"; + + double time(time); + time:_ChunkSizes = 512; + string time:units = "seconds since 2009-01-01"; + string time:_CoordinateAxisType = "Time"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + lon = + {9.96921E36, 9.96921E36} + pr = + { + { + {0.0, 1.0}, + {2.0, 3.0}, + {4.0, 5.0} + }, + { + {10.0, 11.0}, + {12.0, 13.0}, + {14.0, 15.0} + } + } + time = + {9.969209968386869E36, 9.969209968386869E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/src/test/data/resources/baselineraw/test_unlim1.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_unlim1.nc.ncdump new file mode 100644 index 0000000000..39d22f9672 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_unlim1.nc.ncdump @@ -0,0 +1,50 @@ +netcdf test_unlim1 { + dimensions: + lon = 2; + lat = 3; + time = 2; + variables: + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float pr(time, lat, lon); + pr:_ChunkSizes = 1, 3, 2; + string pr:standard_name = "air_pressure_at_sea_level"; + string pr:units = "hPa"; + string pr:_CoordinateAxisType = "Pressure"; + + double time(time); + time:_ChunkSizes = 512; + string time:units = "seconds since 2009-01-01"; + string time:_CoordinateAxisType = "Time"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + lon = + {9.96921E36, 9.96921E36} + pr = + { + { + {0.0, 1.0}, + {2.0, 3.0}, + {4.0, 5.0} + }, + { + {10.0, 11.0}, + {12.0, 13.0}, + {14.0, 15.0} + } + } + time = + {9.969209968386869E36, 9.969209968386869E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_utf8.nc.raw.txt b/dap4/src/test/data/resources/baselineraw/test_utf8.nc.ncdump similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_utf8.nc.raw.txt rename to dap4/src/test/data/resources/baselineraw/test_utf8.nc.ncdump index e99cf54c4a..772972588d 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_utf8.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineraw/test_utf8.nc.ncdump @@ -3,10 +3,10 @@ netcdf test_utf8 { d2 = 2; variables: string vs(d2); - string vs:_DAP4_Checksum_CRC32 = "0xfce3cd28"; // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -vs = "Καλημέα", "Καλημέα" + + data: + vs = "Καλημέα", "abc" } diff --git a/dap4/src/test/data/resources/baselineraw/test_vlen1.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_vlen1.nc.ncdump new file mode 100644 index 0000000000..f0c03074d5 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_vlen1.nc.ncdump @@ -0,0 +1,24 @@ +netcdf test_vlen1 { + variables: + + Sequence { + int x; + string x:_CoordinateAxisType = "GeoX"; + } x(*); + x:_FillValue = 0; + + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + x = + { x = 1 + } x + { x = 3 + } x + { x = 5 + } x + { x = 7 + } x +} diff --git a/dap4/src/test/data/resources/baselineraw/test_vlen11.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_vlen11.nc.ncdump new file mode 100644 index 0000000000..31920fc31f --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_vlen11.nc.ncdump @@ -0,0 +1,19 @@ +netcdf test_vlen11 { + variables: + + Sequence { + int v; + } v(*); + v:_FillValue = 0; + + + // global attributes: + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + v = + { v = 4 + } v + { v = 754 + } v +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dmr b/dap4/src/test/data/resources/baselineraw/test_vlen3.nc.ncdump similarity index 70% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineraw/test_vlen3.nc.ncdump index ecef24cd25..538f1eee16 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen3.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineraw/test_vlen3.nc.ncdump @@ -2,10 +2,17 @@ netcdf test_vlen3 { variables: Structure { - int f1(*); + + Sequence { + int f1; + } f1(*); + } v1; // global attributes: string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; -} + + data: + +null diff --git a/dap4/src/test/data/resources/baselineraw/test_zerodim.nc.ncdump b/dap4/src/test/data/resources/baselineraw/test_zerodim.nc.ncdump new file mode 100644 index 0000000000..5c5b831150 --- /dev/null +++ b/dap4/src/test/data/resources/baselineraw/test_zerodim.nc.ncdump @@ -0,0 +1,30 @@ +netcdf test_zerodim { + dimensions: + lon = 4; + time = 0; + lat = 6; + unlim = 3; + variables: + float var(unlim); + var:_ChunkSizes = 1024; + + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + var = + {0.0, 1.0, 3.0} + lon = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_atomic_array.2.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_atomic_array.2.nc.ncdump new file mode 100644 index 0000000000..a662df4360 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_atomic_array.2.nc.ncdump @@ -0,0 +1,57 @@ +netcdf test_atomic_array.2 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d1 = 1; + d2 = 2; + d3 = 3; + d4 = 4; + d5 = 5; + variables: + ubyte vu8(d2, d3); + + short v16(d4); + + uint vu32(d2, d3); + + double vd(d2); + + char vc(d2); + + String vs(d2, d2); + + opaque vo(d1, d2); + + enum cloud_class_t primary_cloud(d5); + string primary_cloud:_FillValue = "Missing"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", "hello world", "hello world", "hello world" + } + vo = 0x0123456789abcdef, + 0x0123456789abcdef; + + primary_cloud = + {0, 2, 0, 1, 127} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_atomic_array.3.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_atomic_array.3.nc.ncdump new file mode 100644 index 0000000000..a488e214d2 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_atomic_array.3.nc.ncdump @@ -0,0 +1,57 @@ +netcdf test_atomic_array.3 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d1 = 1; + d2 = 2; + d3 = 3; + d4 = 4; + d5 = 5; + variables: + ubyte vu8(d2, d3); + + short v16(d4); + + uint vu32(d2, d3); + + double vd(d2); + + char vc(d2); + + String vs(d2, d2); + + opaque vo(d1, d2); + + enum cloud_class_t primary_cloud(d5); + string primary_cloud:_FillValue = "Missing"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", "hello world", "hello world", "hello world" + } + vo = 0x0123456789abcdef, + 0x0123456789abcdef; + + primary_cloud = + {0, 2, 0, 1, 127} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_atomic_array.nc.ncdump similarity index 59% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_atomic_array.nc.ncdump index 822a30cbc9..448052ed2e 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_array.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_atomic_array.nc.ncdump @@ -19,7 +19,7 @@ netcdf test_atomic_array { char vc(d2); - String vs(d2, d2); + string vs(d2, d2); opaque vo(d1, d2); @@ -27,5 +27,32 @@ netcdf test_atomic_array { string primary_cloud:_FillValue = "Missing"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vu8 = + { + {255, 1, 2}, + {3, 4, 5} + } + v16 = + {1, 2, 3, 4} + vu32 = + { + {5, 4, 3}, + {2, 1, 0} + } + vd = + {17.9, 1024.8} + vc = "@&" + vs = + { "hello world", " +", "Καλημέα", "abc" + } + vo = 0x0123456789abcdef, + 0xabcdef0000000000; + + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_atomic_types.nc.ncdump similarity index 65% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_atomic_types.nc.ncdump index d771557b7f..b68d5b3fa1 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_atomic_types.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_atomic_types.nc.ncdump @@ -25,7 +25,7 @@ netcdf test_atomic_types { char vc; - String vs; + string vs; opaque vo; @@ -36,5 +36,24 @@ netcdf test_atomic_types { string secondary_cloud:_FillValue = "Missing"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + v8 = -128 + vu8 = 255 + v16 = -32768 + vu16 = 65535 + v32 = 2147483647 + vu32 = 4294967295 + v64 = 9223372036854775807 + vu64 = 18446744073709551615 + vf = 3.1415927 + vd = 3.141592653589793 + vc = @ + vs = "hello world" + vo = 0x0123456789abcdef; + + primary_cloud = 2 + secondary_cloud = 127 } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_enum_1.nc.ncdump similarity index 84% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_enum_1.nc.ncdump index 0b98070c42..abcb007674 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_enum_1.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_enum { +netcdf test_enum_1 { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; @@ -7,5 +7,9 @@ netcdf test_enum { string primary_cloud:_FillValue = "Missing"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + primary_cloud = 2 } diff --git a/dap4/src/test/data/resources/baselineremote/test_enum_2.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_enum_2.nc.ncdump new file mode 100644 index 0000000000..651cc35de6 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_enum_2.nc.ncdump @@ -0,0 +1,18 @@ +netcdf test_enum_2 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + group: h { + variables: + enum cloud_class_t primary_cloud; + string primary_cloud:_FillValue = "Missing"; + + } + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + h/primary_cloud = 2 +} diff --git a/dap4/src/test/data/resources/baselineremote/test_enum_3.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_enum_3.nc.ncdump new file mode 100644 index 0000000000..d550189ba8 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_enum_3.nc.ncdump @@ -0,0 +1,17 @@ +netcdf test_enum_3 { + types: + byte enum cloud_class_t { Clear = 0, Stratus = 1, Missing = 127}; + + group: h { + variables: + enum cloud_class_t primary_cloud; + + } + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + h/primary_cloud = 1 +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum.nc.raw.txt b/dap4/src/test/data/resources/baselineremote/test_enum_array.6.nc.ncdump similarity index 68% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum.nc.raw.txt rename to dap4/src/test/data/resources/baselineremote/test_enum_array.6.nc.ncdump index b666139c20..57f2a0ce47 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_enum.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineremote/test_enum_array.6.nc.ncdump @@ -1,14 +1,18 @@ -netcdf test_enum { +netcdf test_enum_array.6 { types: byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + dimensions: + d5 = 5; variables: - enum cloud_class_t primary_cloud; + enum cloud_class_t primary_cloud(d5); string primary_cloud:_FillValue = "Missing"; - string primary_cloud:_DAP4_Checksum_CRC32 = "0x3c0c8ea1"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -primary_cloud =2 + + data: + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_enum_array.nc.ncdump similarity index 85% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_enum_array.nc.ncdump index 0ba318f4b9..b11536aadb 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_enum_array.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_enum_array.nc.ncdump @@ -9,5 +9,10 @@ netcdf test_enum_array { string primary_cloud:_FillValue = "Missing"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + primary_cloud = + {0, 2, 0, 1, 127} } diff --git a/dap4/src/test/data/resources/baselineremote/test_fill.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_fill.nc.ncdump new file mode 100644 index 0000000000..1a740740b1 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_fill.nc.ncdump @@ -0,0 +1,18 @@ +netcdf test_fill { + variables: + ubyte uv8; + + short v16; + + int uv32; + uv32:_FillValue = 17; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + uv8 = 240 + v16 = 32700 + uv32 = 111000 +} diff --git a/dap4/src/test/data/resources/baselineremote/test_fill_2.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_fill_2.nc.ncdump new file mode 100644 index 0000000000..70d7dd28ae --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_fill_2.nc.ncdump @@ -0,0 +1,33 @@ +netcdf test_fill_2 { + types: + byte enum cloud_class_t { Clear = 0, Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3, Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127}; + + dimensions: + d2 = 2; + variables: + enum cloud_class_t enumvar(d2); + string enumvar:_FillValue = "Missing"; + + int uv32(d2); + uv32:_FillValue = 17; + + ubyte uv8(d2); + uv8:_FillValue = 120B; + + short v16(d2); + v16:_FillValue = -37S; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + enumvar = + {2, 127} + uv32 = + {111000, 17} + uv8 = + {240, 120} + v16 = + {32700, -37} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_groups1.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_groups1.nc.ncdump new file mode 100644 index 0000000000..e8a21f1643 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_groups1.nc.ncdump @@ -0,0 +1,42 @@ +netcdf test_groups1 { + dimensions: + dim1 = 5; + group: g { + dimensions: + dim2 = 3; + group: h { + dimensions: + dim3 = 7; + variables: + int v1(dim1); + + float v2(dim2); + + } + + group: i { + dimensions: + dim3 = 7; + variables: + int v1(dim1); + + float v3(dim3); + + } + + } + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + g/h/v1 = + {-876354855, -1761252264, 1723477387, -46827465, 1475147969} + g/h/v2 = + {12.0, -100.0, 9.96921E36} + g/i/v1 = + {2, 3, 5, 7, 11} + g/i/v3 = + {23.0, 29.0, 19.0, 31.0, 17.0, 37.0, 13.0} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_misc1.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_misc1.nc.ncdump new file mode 100644 index 0000000000..e7494b8a76 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_misc1.nc.ncdump @@ -0,0 +1,31 @@ +netcdf test_misc1 { + dimensions: + lon = 4; + time = 0; + lat = 6; + unlim = 3; + variables: + float var(unlim); + var:_ChunkSizes = 1024; + + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + var = + {0.0, 1.0, 3.0} + lon = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dap b/dap4/src/test/data/resources/baselineremote/test_one_var.nc.ncdump similarity index 74% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dap rename to dap4/src/test/data/resources/baselineremote/test_one_var.nc.ncdump index cf8dae631c..dc9ffc41ce 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_var.nc.nc4.dap +++ b/dap4/src/test/data/resources/baselineremote/test_one_var.nc.ncdump @@ -3,7 +3,9 @@ netcdf test_one_var { int t; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; - data: -t =17 + + data: + t = 17 } diff --git a/dap4/src/test/data/resources/baselineremote/test_one_vararray.4.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_one_vararray.4.nc.ncdump new file mode 100644 index 0000000000..f4bfee691f --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_one_vararray.4.nc.ncdump @@ -0,0 +1,14 @@ +netcdf test_one_vararray.4 { + dimensions: + d2 = 2; + variables: + int t(d2); + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + {17, 37} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_one_vararray.5.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_one_vararray.5.nc.ncdump new file mode 100644 index 0000000000..31eab0d90e --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_one_vararray.5.nc.ncdump @@ -0,0 +1,14 @@ +netcdf test_one_vararray.5 { + dimensions: + d2 = 2; + variables: + int t(d2); + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + {17, 37} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_one_vararray.nc.ncdump similarity index 74% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_one_vararray.nc.ncdump index ff9f4f085d..6f4c930944 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_one_vararray.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_one_vararray.nc.ncdump @@ -5,5 +5,10 @@ netcdf test_one_vararray { int t(d2); // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + t = + {17, 37} } diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_opaque.nc.ncdump similarity index 50% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_opaque.nc.ncdump index 357edd6da2..60e1ee1b7b 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen4.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_opaque.nc.ncdump @@ -1,11 +1,12 @@ -netcdf test_vlen4 { +netcdf test_opaque { variables: - - Structure { - int f1(2, *); - } v1; - + opaque vo1; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vo1 = 0x0123456789abcdef; + } diff --git a/dap4/src/test/data/resources/baselineremote/test_opaque_array.7.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_opaque_array.7.nc.ncdump new file mode 100644 index 0000000000..fc56e6238b --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_opaque_array.7.nc.ncdump @@ -0,0 +1,17 @@ +netcdf test_opaque_array.7 { + dimensions: + d2 = 2; + variables: + opaque vo2(d2, d2); + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vo2 = 0x0123456789abcdef, + 0x0123456789abcdef, + 0x0123456789abcdef, + 0x0123456789abcdef; + +} diff --git a/dap4/src/test/data/resources/baselineremote/test_opaque_array.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_opaque_array.nc.ncdump new file mode 100644 index 0000000000..07790cf395 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_opaque_array.nc.ncdump @@ -0,0 +1,17 @@ +netcdf test_opaque_array { + dimensions: + d2 = 2; + variables: + opaque vo2(d2, d2); + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vo2 = 0x0123456789abcdef, + 0xabcdef0000000000, + 0xfedcba9876543210, + 0xfedcba9999999999; + +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_struct1.nc.ncdump similarity index 66% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_struct1.nc.ncdump index 8699a2aa57..b647e4efc8 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_struct_array.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_struct1.nc.ncdump @@ -1,7 +1,4 @@ -netcdf test_struct_array { - dimensions: - dx = 4; - dy = 3; +netcdf test_struct1 { variables: Structure { @@ -9,9 +6,16 @@ netcdf test_struct_array { string x:_CoordinateAxisType = "GeoX"; int y; string y:_CoordinateAxisType = "GeoY"; - } s(dx, dy); + } s; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { x = 1 + y = -2 + } s(0) } diff --git a/dap4/src/test/data/resources/baselineremote/test_struct_array.8.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_struct_array.8.nc.ncdump new file mode 100644 index 0000000000..596b7d0cac --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_struct_array.8.nc.ncdump @@ -0,0 +1,69 @@ +netcdf test_struct_array.8 { + dimensions: + dx = 4; + dy = 3; + variables: + + Structure { + int x; + string x:_CoordinateAxisType = "GeoX"; + int y; + string y:_CoordinateAxisType = "GeoY"; + } s(dx, dy); + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { + x = 1 + y = -1 + } s(0) + { + x = 17 + y = 37 + } s(1) + { + x = -32767 + y = 32767 + } s(2) + { + x = -1 + y = 3 + } s(3) + { + x = -2 + y = 2 + } s(4) + { + x = -3 + y = 1 + } s(5) + { + x = -4 + y = 12 + } s(6) + { + x = -8 + y = 8 + } s(7) + { + x = -12 + y = 4 + } s(8) + { + x = -5 + y = 15 + } s(9) + { + x = -10 + y = 10 + } s(10) + { + x = -15 + y = 5 + } s(11) +} diff --git a/dap4/src/test/data/resources/baselineremote/test_struct_array.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_struct_array.nc.ncdump new file mode 100644 index 0000000000..5d64ae742d --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_struct_array.nc.ncdump @@ -0,0 +1,57 @@ +netcdf test_struct_array { + dimensions: + dx = 4; + dy = 3; + variables: + + Structure { + int x; + string x:_CoordinateAxisType = "GeoX"; + int y; + string y:_CoordinateAxisType = "GeoY"; + } s(dx, dy); + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + s = + { x = 1 + y = -1 + } s(0) + { x = 17 + y = 37 + } s(1) + { x = -32767 + y = 32767 + } s(2) + { x = -1 + y = 3 + } s(3) + { x = -2 + y = 2 + } s(4) + { x = -3 + y = 1 + } s(5) + { x = -4 + y = 12 + } s(6) + { x = -8 + y = 8 + } s(7) + { x = -12 + y = 4 + } s(8) + { x = -5 + y = 15 + } s(9) + { x = -10 + y = 10 + } s(10) + { x = -15 + y = 5 + } s(11) +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested.hdf5.raw.txt b/dap4/src/test/data/resources/baselineremote/test_struct_nested.nc.ncdump similarity index 70% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested.hdf5.raw.txt rename to dap4/src/test/data/resources/baselineremote/test_struct_nested.nc.ncdump index fdd4aa1aad..416611fbbc 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_nested.hdf5.raw.txt +++ b/dap4/src/test/data/resources/baselineremote/test_struct_nested.nc.ncdump @@ -1,4 +1,4 @@ -netcdf test_struct_nested.hdf5 { +netcdf test_struct_nested { variables: Structure { @@ -17,22 +17,20 @@ netcdf test_struct_nested.hdf5 { } field2; } x; - string x:_DAP4_Checksum_CRC32 = "0xdfa7461b"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + data: - x = - { - field1 = - { - x = 1 + x = + { field1 = + { x = 1 y = -2 } field1(0) - field2 = - { - x = 255 + field2 = + { x = 255 y = 90 } field2(0) } x(0) diff --git a/dap4/src/test/data/resources/baselineremote/test_struct_nested3.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_struct_nested3.nc.ncdump new file mode 100644 index 0000000000..626573d139 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_struct_nested3.nc.ncdump @@ -0,0 +1,29 @@ +netcdf test_struct_nested3 { + variables: + + Structure { + + Structure { + + Structure { + int field1; + } field2; + + } field3; + + } x; + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + x = + { field3 = + { field2 = + { field1 = 17 + } field2(0) + } field3(0) + } x(0) +} diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_type.nc.raw.txt b/dap4/src/test/data/resources/baselineremote/test_struct_type.nc.ncdump similarity index 79% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_type.nc.raw.txt rename to dap4/src/test/data/resources/baselineremote/test_struct_type.nc.ncdump index 64832f765e..dc6deedce7 100644 --- a/dap4/d4tests/src/test/data/resources/TestCDMClient/baseline/test_struct_type.nc.raw.txt +++ b/dap4/src/test/data/resources/baselineremote/test_struct_type.nc.ncdump @@ -7,15 +7,15 @@ netcdf test_struct_type { int y; string y:_CoordinateAxisType = "GeoY"; } s; - string s:_DAP4_Checksum_CRC32 = "0xcf8f9871"; // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + data: - s = - { - x = 1 + s = + { x = 1 y = -2 } s(0) } diff --git a/dap4/src/test/data/resources/baselineremote/test_test.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_test.nc.ncdump new file mode 100644 index 0000000000..aa94dd1cc3 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_test.nc.ncdump @@ -0,0 +1,14 @@ +netcdf test_test { + types: + byte enum enum_t { c1 = 1, c2 = 2, c3 = 3}; + + variables: + enum enum_t v1; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + v1 = 1 +} diff --git a/dap4/src/test/data/resources/baselineremote/test_unlim.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_unlim.nc.ncdump new file mode 100644 index 0000000000..ff378e3fac --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_unlim.nc.ncdump @@ -0,0 +1,51 @@ +netcdf test_unlim { + dimensions: + lon = 2; + time = 2; + lat = 3; + variables: + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float pr(time, lat, lon); + pr:_ChunkSizes = 1, 3, 2; + string pr:standard_name = "air_pressure_at_sea_level"; + string pr:units = "hPa"; + string pr:_CoordinateAxisType = "Pressure"; + + double time(time); + time:_ChunkSizes = 512; + string time:units = "seconds since 2009-01-01"; + string time:_CoordinateAxisType = "Time"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + lon = + {9.96921E36, 9.96921E36} + pr = + { + { + {0.0, 1.0}, + {2.0, 3.0}, + {4.0, 5.0} + }, + { + {10.0, 11.0}, + {12.0, 13.0}, + {14.0, 15.0} + } + } + time = + {9.969209968386869E36, 9.969209968386869E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/src/test/data/resources/baselineremote/test_unlim1.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_unlim1.nc.ncdump new file mode 100644 index 0000000000..496abbabdc --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_unlim1.nc.ncdump @@ -0,0 +1,51 @@ +netcdf test_unlim1 { + dimensions: + lon = 2; + lat = 3; + time = 2; + variables: + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float pr(time, lat, lon); + pr:_ChunkSizes = 1, 3, 2; + string pr:standard_name = "air_pressure_at_sea_level"; + string pr:units = "hPa"; + string pr:_CoordinateAxisType = "Pressure"; + + double time(time); + time:_ChunkSizes = 512; + string time:units = "seconds since 2009-01-01"; + string time:_CoordinateAxisType = "Time"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + lon = + {9.96921E36, 9.96921E36} + pr = + { + { + {0.0, 1.0}, + {2.0, 3.0}, + {4.0, 5.0} + }, + { + {10.0, 11.0}, + {12.0, 13.0}, + {14.0, 15.0} + } + } + time = + {9.969209968386869E36, 9.969209968386869E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dmr b/dap4/src/test/data/resources/baselineremote/test_utf8.nc.ncdump similarity index 54% rename from dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dmr rename to dap4/src/test/data/resources/baselineremote/test_utf8.nc.ncdump index a28e65320e..067d42687d 100644 --- a/dap4/d4tests/src/test/data/resources/TestIosp/baseline/test_vlen2.nc.nc4.dmr +++ b/dap4/src/test/data/resources/baselineremote/test_utf8.nc.ncdump @@ -1,11 +1,13 @@ -netcdf test_vlen2 { +netcdf test_utf8 { dimensions: - d3 = 3; d2 = 2; variables: - int x(d3, d2, *); - string x:_CoordinateAxisType = "GeoX"; + string vs(d2); // global attributes: + :_DAP4_Little_Endian = 1B; string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + vs = "Καλημέα", "abc" } diff --git a/dap4/src/test/data/resources/baselineremote/test_vlen1.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_vlen1.nc.ncdump new file mode 100644 index 0000000000..7a0f561084 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_vlen1.nc.ncdump @@ -0,0 +1,25 @@ +netcdf test_vlen1 { + variables: + + Sequence { + int x; + string x:_CoordinateAxisType = "GeoX"; + } x(*); + x:_FillValue = 0; + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + x = + { x = 1 + } x + { x = 3 + } x + { x = 5 + } x + { x = 7 + } x +} diff --git a/dap4/src/test/data/resources/baselineremote/test_vlen11.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_vlen11.nc.ncdump new file mode 100644 index 0000000000..8474f2c1a2 --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_vlen11.nc.ncdump @@ -0,0 +1,20 @@ +netcdf test_vlen11 { + variables: + + Sequence { + int v; + } v(*); + v:_FillValue = 0; + + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + v = + { v = 4 + } v + { v = 754 + } v +} diff --git a/dap4/src/test/data/resources/baselineremote/test_zerodim.nc.ncdump b/dap4/src/test/data/resources/baselineremote/test_zerodim.nc.ncdump new file mode 100644 index 0000000000..3e0a65caae --- /dev/null +++ b/dap4/src/test/data/resources/baselineremote/test_zerodim.nc.ncdump @@ -0,0 +1,31 @@ +netcdf test_zerodim { + dimensions: + lon = 4; + time = 0; + lat = 6; + unlim = 3; + variables: + float var(unlim); + var:_ChunkSizes = 1024; + + float lon(lon); + string lon:units = "degrees_east"; + string lon:_CoordinateAxisType = "Lon"; + + float lat(lat); + string lat:units = "degrees_north"; + string lat:_CoordinateAxisType = "Lat"; + + // global attributes: + :_DAP4_Little_Endian = 1B; + string :title = "example for workshop"; + string :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; + + data: + var = + {0.0, 1.0, 3.0} + lon = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} + lat = + {9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36, 9.96921E36} +} diff --git a/dap4/src/test/data/resources/nctestfiles/test_atomic_array.nc b/dap4/src/test/data/resources/nctestfiles/test_atomic_array.nc new file mode 100644 index 0000000000..e0aaacdb69 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_atomic_array.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.nc b/dap4/src/test/data/resources/nctestfiles/test_atomic_types.nc similarity index 57% rename from dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.nc rename to dap4/src/test/data/resources/nctestfiles/test_atomic_types.nc index 066dd89354..887935324f 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_atomic_types.nc and b/dap4/src/test/data/resources/nctestfiles/test_atomic_types.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_enum_1.nc b/dap4/src/test/data/resources/nctestfiles/test_enum_1.nc new file mode 100644 index 0000000000..c4874350bf Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_enum_1.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_enum_2.nc b/dap4/src/test/data/resources/nctestfiles/test_enum_2.nc new file mode 100644 index 0000000000..6818b84c10 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_enum_2.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_enum_3.nc b/dap4/src/test/data/resources/nctestfiles/test_enum_3.nc new file mode 100644 index 0000000000..efbb3e2395 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_enum_3.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.nc b/dap4/src/test/data/resources/nctestfiles/test_enum_array.nc similarity index 74% rename from dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.nc rename to dap4/src/test/data/resources/nctestfiles/test_enum_array.nc index c6b4a2f388..f7303bbe7f 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_enum_array.nc and b/dap4/src/test/data/resources/nctestfiles/test_enum_array.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_fill.nc b/dap4/src/test/data/resources/nctestfiles/test_fill.nc new file mode 100644 index 0000000000..7247f290d8 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_fill.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_groups1.nc b/dap4/src/test/data/resources/nctestfiles/test_groups1.nc new file mode 100644 index 0000000000..9d004b4bf9 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_groups1.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_misc1.nc b/dap4/src/test/data/resources/nctestfiles/test_misc1.nc new file mode 100644 index 0000000000..d17d1ccce5 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_misc1.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_one_var.nc b/dap4/src/test/data/resources/nctestfiles/test_one_var.nc new file mode 100644 index 0000000000..7e0b4b135c Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_one_var.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.nc b/dap4/src/test/data/resources/nctestfiles/test_one_vararray.nc similarity index 78% rename from dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.nc rename to dap4/src/test/data/resources/nctestfiles/test_one_vararray.nc index e0cc0ce34a..48db970d49 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_one_vararray.nc and b/dap4/src/test/data/resources/nctestfiles/test_one_vararray.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_opaque.nc b/dap4/src/test/data/resources/nctestfiles/test_opaque.nc new file mode 100644 index 0000000000..209d748e74 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_opaque.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.nc b/dap4/src/test/data/resources/nctestfiles/test_opaque_array.nc similarity index 76% rename from dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.nc rename to dap4/src/test/data/resources/nctestfiles/test_opaque_array.nc index 895a8bf065..d29a08accf 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_opaque_array.nc and b/dap4/src/test/data/resources/nctestfiles/test_opaque_array.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_struct1.nc b/dap4/src/test/data/resources/nctestfiles/test_struct1.nc new file mode 100644 index 0000000000..d119053a31 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_struct1.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.nc b/dap4/src/test/data/resources/nctestfiles/test_struct_array.nc similarity index 67% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.nc rename to dap4/src/test/data/resources/nctestfiles/test_struct_array.nc index 95343fff4f..781e0b2411 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.nc and b/dap4/src/test/data/resources/nctestfiles/test_struct_array.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_struct_nested.nc b/dap4/src/test/data/resources/nctestfiles/test_struct_nested.nc new file mode 100644 index 0000000000..fea0edba27 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_struct_nested.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_struct_nested3.nc b/dap4/src/test/data/resources/nctestfiles/test_struct_nested3.nc new file mode 100644 index 0000000000..f109e444e1 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_struct_nested3.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_struct_type.nc b/dap4/src/test/data/resources/nctestfiles/test_struct_type.nc new file mode 100644 index 0000000000..d119053a31 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_struct_type.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_test.nc b/dap4/src/test/data/resources/nctestfiles/test_test.nc new file mode 100644 index 0000000000..69e7c978d2 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_test.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim.nc b/dap4/src/test/data/resources/nctestfiles/test_unlim.nc similarity index 58% rename from dap4/d4tests/src/test/data/resources/testfiles/test_unlim.nc rename to dap4/src/test/data/resources/nctestfiles/test_unlim.nc index f362f967fb..e0164af8d0 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim.nc and b/dap4/src/test/data/resources/nctestfiles/test_unlim.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.nc b/dap4/src/test/data/resources/nctestfiles/test_unlim1.nc similarity index 66% rename from dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.nc rename to dap4/src/test/data/resources/nctestfiles/test_unlim1.nc index 5b92931e63..2ad96e39e0 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_unlim1.nc and b/dap4/src/test/data/resources/nctestfiles/test_unlim1.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.nc b/dap4/src/test/data/resources/nctestfiles/test_utf8.nc similarity index 76% rename from dap4/d4tests/src/test/data/resources/testfiles/test_utf8.nc rename to dap4/src/test/data/resources/nctestfiles/test_utf8.nc index fd90a6f12e..1dd1bac902 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_utf8.nc and b/dap4/src/test/data/resources/nctestfiles/test_utf8.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen1.nc similarity index 85% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen1.nc index 4c7f097564..a4bd83f8b7 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen1.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen1.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen11.nc similarity index 80% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen11.nc index 729e4b607b..24be975829 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen11.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen11.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.hdf5 b/dap4/src/test/data/resources/nctestfiles/test_vlen2.nc similarity index 65% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.hdf5 rename to dap4/src/test/data/resources/nctestfiles/test_vlen2.nc index cf0654cd89..f9f5f73c66 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.hdf5 and b/dap4/src/test/data/resources/nctestfiles/test_vlen2.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen3.nc similarity index 81% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen3.nc index e5564961e2..9fe533ed72 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen3.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen4.nc similarity index 80% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen4.nc index f119d3d119..40232b5b3c 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen4.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen4.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.hdf5 b/dap4/src/test/data/resources/nctestfiles/test_vlen5.nc similarity index 77% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.hdf5 rename to dap4/src/test/data/resources/nctestfiles/test_vlen5.nc index cd54563424..94d697fe7d 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen5.hdf5 and b/dap4/src/test/data/resources/nctestfiles/test_vlen5.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen6.nc similarity index 75% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen6.nc index f294775e10..f448f1b862 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen6.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen6.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.nc b/dap4/src/test/data/resources/nctestfiles/test_vlen7.nc similarity index 75% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.nc rename to dap4/src/test/data/resources/nctestfiles/test_vlen7.nc index f1989bf335..a63571b14b 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen7.nc and b/dap4/src/test/data/resources/nctestfiles/test_vlen7.nc differ diff --git a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.hdf5 b/dap4/src/test/data/resources/nctestfiles/test_vlen8.nc similarity index 66% rename from dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.hdf5 rename to dap4/src/test/data/resources/nctestfiles/test_vlen8.nc index 2d3be72508..5d1dab400e 100644 Binary files a/dap4/d4tests/src/test/data/resources/testfiles/test_vlen3.hdf5 and b/dap4/src/test/data/resources/nctestfiles/test_vlen8.nc differ diff --git a/dap4/src/test/data/resources/nctestfiles/test_zerodim.nc b/dap4/src/test/data/resources/nctestfiles/test_zerodim.nc new file mode 100644 index 0000000000..e3847eb330 Binary files /dev/null and b/dap4/src/test/data/resources/nctestfiles/test_zerodim.nc differ diff --git a/dap4/src/test/data/resources/rawtestfiles/CMakeLists.txt b/dap4/src/test/data/resources/rawtestfiles/CMakeLists.txt new file mode 100644 index 0000000000..85d40c3a9b --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, +# 2015, 2016, 2017, 2018 +# University Corporation for Atmospheric Research/Unidata. + +# See netcdf-c/COPYRIGHT file for more info. + +FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*) +FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + +FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) +SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt) +ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.5.raw b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dap similarity index 75% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.5.raw rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dap index 64f2028ca3..5268ba2f0a 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.5.raw and b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dmr b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dmr similarity index 75% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dmr index 83af129bb7..f5aeb23a42 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.5.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.1.nc.dmr @@ -23,4 +23,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.8.raw b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dap similarity index 69% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.8.raw rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dap index 9c55a80646..767948d780 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.8.raw and b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dmr b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dmr similarity index 64% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dmr index 97a6e53fa5..c1dfa079e9 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.8.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.2.nc.dmr @@ -11,4 +11,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.9.raw b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dap similarity index 69% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.9.raw rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dap index 6f17241329..3667b076c2 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.9.raw and b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dmr b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dmr similarity index 64% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dmr index b1cf68eac1..c86b06bbce 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_atomic_array.nc.9.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.3.nc.dmr @@ -11,4 +11,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dap similarity index 78% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dap index 9a6e307575..c25865196c 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dmr similarity index 86% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dmr index 2fbda80066..055b24184b 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_atomic_array.nc.dmr @@ -51,8 +51,14 @@ - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dap similarity index 80% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dap index 97ddca1028..e69d916e32 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_types.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dmr similarity index 81% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dmr index 760b27b8cc..fc73697673 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_types.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_atomic_types.nc.dmr @@ -33,13 +33,19 @@ - + - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dap similarity index 78% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dap index ec69756822..f4879bac12 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dmr similarity index 75% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dmr index c6b90cdbb6..1fe6b2733b 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_enum_1.nc.dmr @@ -1,6 +1,6 @@ - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_2.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dap similarity index 81% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_2.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dap index d38f5337ff..691a7db739 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_2.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dmr similarity index 78% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dmr index 906e9bd87f..976912cbe0 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_2.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_enum_2.nc.dmr @@ -19,9 +19,15 @@ + + + + + + - + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dap new file mode 100644 index 0000000000..1388e7518b Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dmr new file mode 100644 index 0000000000..115bfa8ca7 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_enum_3.nc.dmr @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.4.raw b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dap similarity index 82% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.4.raw rename to dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dap index e89b3c55fd..a92e1d80b4 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.4.raw and b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dmr b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dmr similarity index 80% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dmr index 963404a513..d50f20879d 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_enum_array.nc.4.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.6.nc.dmr @@ -21,11 +21,17 @@ - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dap similarity index 75% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dap index 60a17c7524..6fd6eb23b3 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_enum_array.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dmr similarity index 79% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dmr index 9566d108d1..937874f605 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_enum_array.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_enum_array.nc.dmr @@ -22,8 +22,14 @@ - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_fill.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dap similarity index 58% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_fill.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dap index 151559c495..eb66e2ca84 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_fill.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dmr similarity index 52% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dmr index f42b2d3e1f..713f258020 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_fill.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_fill.nc.dmr @@ -7,9 +7,15 @@ xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - - + + - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.syn.raw b/dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dap similarity index 54% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.syn.raw rename to dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dap index 30138ab7b1..84f8827241 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_atomic_array.syn.raw and b/dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dmr b/dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dmr similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dmr index 4d46c86746..9682baa5cf 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_atomic_array.syn.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_fill_2.nc.dmr @@ -1,15 +1,11 @@ - - - - @@ -24,35 +20,34 @@ - + - - - - - - - - - - - - - - - - + + + + + + + + + + - - - + + + + + - - - - - + + - + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_groups1.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dap similarity index 77% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_groups1.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dap index fc6a4a66d7..ad13a7ad93 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_groups1.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dmr similarity index 79% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dmr index 5932834dad..6122d65bdd 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_groups1.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_groups1.nc.dmr @@ -6,6 +6,12 @@ xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dap new file mode 100644 index 0000000000..074e0016fe Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dmr new file mode 100644 index 0000000000..c844eb9bb2 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_misc1.nc.dmr @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_var.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dap similarity index 62% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_var.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dap index 8b29a0bd17..8992d46dc1 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_var.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dmr similarity index 54% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dmr index f48bc09fc3..9ace4d7c19 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_one_var.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_one_var.nc.dmr @@ -6,4 +6,10 @@ xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.1.raw b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dap similarity index 69% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.1.raw rename to dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dap index 814c0ed7bb..2193bd6380 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.1.raw and b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dmr b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dmr similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dmr index 7909a15ec2..f7313e0f27 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.1.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.4.nc.dmr @@ -11,4 +11,10 @@ + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dap new file mode 100644 index 0000000000..a1100c1689 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.3.raw.txt b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dmr similarity index 52% rename from dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.3.raw.txt rename to dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dmr index 495c199edf..3b8f656675 100644 --- a/dap4/d4tests/src/test/data/resources/TestDSP/baseline/test_one_vararray.nc.3.raw.txt +++ b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.5.nc.dmr @@ -1,17 +1,20 @@ + - - + + + + + + + -/t[0] = 17 -/t[1] = 37 - diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.3.raw b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dap similarity index 71% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.3.raw rename to dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dap index 42ed5d7347..67ea5584cd 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_one_vararray.nc.3.raw and b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dmr b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dmr similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dmr index f8c3ff5ae3..178baa0a73 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_one_vararray.nc.3.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_one_vararray.nc.dmr @@ -9,7 +9,10 @@ - - + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.2.raw b/dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dap similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.2.raw rename to dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dap index 02521f8b96..d4a997e339 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_anon_dim.syn.2.raw and b/dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dmr similarity index 54% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dmr index d094bcf790..3de1a76235 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_opaque.nc.dmr @@ -6,4 +6,10 @@ xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.7.raw b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dap similarity index 68% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.7.raw rename to dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dap index a7cfeb0f0c..4771a3112d 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.7.raw and b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dmr b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dmr similarity index 65% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dmr index 049b37d03e..1fd34851e1 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_opaque_array.nc.7.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.7.nc.dmr @@ -12,4 +12,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dap similarity index 55% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dap index 10aa455370..22feea39dd 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_opaque_array.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dmr similarity index 62% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dmr index fca0f6e7e1..1ef5164539 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_opaque_array.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_opaque_array.nc.dmr @@ -10,4 +10,10 @@ + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dap new file mode 100644 index 0000000000..204b43fecb Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dmr similarity index 53% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dmr index 381b032492..5567443c90 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.syn.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct1.nc.dmr @@ -1,22 +1,18 @@ - - - - - - - - - - + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.nc.6.raw b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dap similarity index 70% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.nc.6.raw rename to dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dap index f551cc1020..8ba7b371ec 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.nc.6.raw and b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dmr similarity index 68% rename from dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dmr index 47626a73d0..ae1ab26ab6 100644 --- a/dap4/d4tests/src/test/data/resources/TestServletConstraints/baseline/test_struct_array.nc.6.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.8.nc.dmr @@ -14,4 +14,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.syn.raw b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dap similarity index 57% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.syn.raw rename to dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dap index 06ce49201d..466f514759 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_array.syn.raw and b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dmr similarity index 67% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dmr index ebb845e9e9..a75730d80e 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_array.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct_array.nc.dmr @@ -13,4 +13,10 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested.hdf5.raw b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dap similarity index 68% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested.hdf5.raw rename to dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dap index 9e3de4050b..b24920ae7a 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested.hdf5.raw and b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dmr similarity index 64% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dmr index 945da2f1b4..8cb1a3b02a 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested.hdf5.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested.nc.dmr @@ -1,6 +1,6 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested3.hdf5.raw b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dap similarity index 66% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested3.hdf5.raw rename to dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dap index 8425a19ed3..b1d33d717f 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_nested3.hdf5.raw and b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dmr similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dmr index 3dd3a8eb5a..cb3acbfedd 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_nested3.hdf5.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct_nested3.nc.dmr @@ -1,6 +1,6 @@ + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_type.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dap similarity index 66% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_type.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dap index 2b3ffbf1bb..549f472e23 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_struct_type.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dmr similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dmr index 691c85d70d..c21ec1e34a 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_struct_type.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_struct_type.nc.dmr @@ -9,4 +9,10 @@ + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dap new file mode 100644 index 0000000000..aa010e4fa3 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dmr new file mode 100644 index 0000000000..9f0b095029 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_test.nc.dmr @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dap new file mode 100644 index 0000000000..302e751410 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dmr new file mode 100644 index 0000000000..4eab6348f8 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_unlim.nc.dmr @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dap new file mode 100644 index 0000000000..80e898ad60 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dmr new file mode 100644 index 0000000000..6e6500053b --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_unlim1.nc.dmr @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_utf8.nc.raw b/dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dap similarity index 63% rename from dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_utf8.nc.raw rename to dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dap index b1518cf6b8..5400f12b29 100644 Binary files a/dap4/d4tests/src/test/data/resources/TestCDMClient/testinput/test_utf8.nc.raw and b/dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dmr similarity index 60% rename from dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dmr index 6330f7b085..a2bc1456e5 100644 --- a/dap4/d4tests/src/test/data/resources/TestServlet/baseline/test_utf8.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_utf8.nc.dmr @@ -9,4 +9,10 @@ + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dap new file mode 100644 index 0000000000..320ba8bc8c Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dmr new file mode 100644 index 0000000000..7d412d7d67 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen1.nc.dmr @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dap new file mode 100644 index 0000000000..9c22858816 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dmr new file mode 100644 index 0000000000..2968757b79 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen11.nc.dmr @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dap new file mode 100644 index 0000000000..a32cf1f1b4 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen2.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dmr similarity index 50% rename from dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen2.nc.dmr rename to dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dmr index cea92859ec..a48223f412 100644 --- a/dap4/d4tests/src/test/data/resources/TestParsers/dmrset/test_vlen2.nc.dmr +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen2.nc.dmr @@ -1,3 +1,4 @@ + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dap new file mode 100644 index 0000000000..b42d3d1fd3 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dmr new file mode 100644 index 0000000000..56966bb8ea --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen3.nc.dmr @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dap new file mode 100644 index 0000000000..e92a15ff10 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dmr new file mode 100644 index 0000000000..8660e39a47 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen4.nc.dmr @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dap new file mode 100644 index 0000000000..4d89d03074 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dap differ diff --git a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen5.hdf5.dmp b/dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dmr similarity index 52% rename from dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen5.hdf5.dmp rename to dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dmr index 20cc09a17b..c28c3fbd10 100644 --- a/dap4/d4tests/src/test/data/resources/TestParsers/baseline/test_vlen5.hdf5.dmp +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen5.nc.dmr @@ -1,5 +1,6 @@ + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dap new file mode 100644 index 0000000000..35f0d2c5c5 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dmr new file mode 100644 index 0000000000..5ef880efc1 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen6.nc.dmr @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dap new file mode 100644 index 0000000000..fd99b6ce49 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dmr new file mode 100644 index 0000000000..7fb3d8b0f5 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen7.nc.dmr @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dap new file mode 100644 index 0000000000..d01d3c4c18 Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dmr new file mode 100644 index 0000000000..c8a12671a8 --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_vlen8.nc.dmr @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dap b/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dap new file mode 100644 index 0000000000..beb062d2bc Binary files /dev/null and b/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dap differ diff --git a/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dmr b/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dmr new file mode 100644 index 0000000000..7c9bab9c5b --- /dev/null +++ b/dap4/src/test/data/resources/rawtestfiles/test_zerodim.nc.dmr @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dap4/src/test/java/dap4/test/Dap4ManifestIF.java b/dap4/src/test/java/dap4/test/Dap4ManifestIF.java new file mode 100644 index 0000000000..0e16966a29 --- /dev/null +++ b/dap4/src/test/java/dap4/test/Dap4ManifestIF.java @@ -0,0 +1,33 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +/** + * This class defines the set of all possible test base names. + * It is the union of all names used any any test. + * Each test excludes names that it cannot process. + */ + +public interface Dap4ManifestIF { + + // List of all file names + static public final String[][] dap4_manifest = {{"test_one_var"}, {"test_atomic_array"}, {"test_atomic_types"}, + {"test_enum_1"}, {"test_enum_2"}, {"test_enum_3"}, {"test_enum_array"}, {"test_fill"}, {"test_fill_2"}, + {"test_groups1"}, {"test_misc1"}, {"test_one_vararray"}, {"test_opaque"}, {"test_opaque_array"}, {"test_struct1"}, + {"test_struct_array"}, {"test_struct_nested"}, {"test_struct_nested3"}, {"test_struct_type"}, {"test_test"}, + {"test_unlim"}, {"test_unlim1"}, {"test_utf8"}, {"test_vlen1"}, {"test_vlen11"}, {"test_vlen2"}, {"test_vlen3"}, + {"test_vlen4"}, {"test_vlen5"}, {"test_vlen6"}, {"test_vlen7"}, {"test_vlen8"}, {"test_zerodim"}}; // dap4manifest + + // Define the Manifest of constrained tests + static public final String[][] constraint_manifest = + {{"test_atomic_array", "1", "/vu8[1][0:2:2];/vd[1];/vs[1][0];/vo[0][1]"}, + {"test_atomic_array", "2", "/v16[0:1,3]"}, {"test_atomic_array", "3", "/v16[3,0:1]"}, + {"test_one_vararray", "4", "/t[1]"}, {"test_one_vararray", "5", "/t[0:1]"}, + {"test_enum_array", "6", "/primary_cloud[1:2:4]"}, {"test_opaque_array", "7", "/vo2[1][0:1]"}, + {"test_struct_array", "8", "/s[0:2:3][0:1]"}}; + +} // Dap4Manifest + diff --git a/dap4/src/test/java/dap4/test/Dap4Server.java b/dap4/src/test/java/dap4/test/Dap4Server.java new file mode 100644 index 0000000000..773b2b8d8d --- /dev/null +++ b/dap4/src/test/java/dap4/test/Dap4Server.java @@ -0,0 +1,110 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import dap4.core.util.DapException; +import ucar.httpservices.HTTPFactory; +import ucar.httpservices.HTTPMethod; + +import java.util.ArrayList; +import java.util.List; + +public class Dap4Server { + + ////////////////////////////////////////////////// + // Server Registry + + // Order is important; testing reachability is in the order listed + static List registry; + + static { + registry = new ArrayList<>(); + } + + static void register(boolean front, Dap4Server svc) { + // If already in registry, then replace it + for (int i = 0; i < registry.size(); i++) { + Dap4Server ds = registry.get(i); + if (ds.id.equals(svc.id)) { + registry.set(i, svc); + return; + } + } + if (front) + registry.add(0, svc); + else + registry.add(svc); + } + + static Dap4Server getServer(String id) { + for (Dap4Server ds : registry) { + if (ds.id.equals(id)) + return ds; + } + return null; + } + + ////////////////////////////////////////////////// + // Instance variables + public String id; + public String ip; + public int port; + public String servletpath; + + ////////////////////////////////////////////////// + // Constructor(s) + + public Dap4Server(String id, String ip, int port, String servletpath) { + this.id = id; + this.ip = ip; + this.port = port; + this.servletpath = servletpath; + } + + public String getURL() { + return getURL(DapConstants.HTTPSCHEME); + } + + public String getURL(String scheme) { + StringBuilder buf = new StringBuilder(); + buf.append(scheme + "//"); + buf.append(this.ip); + if (this.port > 0) { + buf.append(":"); + buf.append(this.port); + } + buf.append("/"); + buf.append(this.servletpath); + return buf.toString(); + } + + public boolean ping() { + boolean ok = false; + String url = getURL(); + try { + try (HTTPMethod method = HTTPFactory.Get(url)) { + int code = method.execute(); + if (code == 200) + ok = true; + } + } catch (Exception e) { + ok = false; + } + return ok; + } + + static public Dap4Server findServer() throws DapException { + // Find the server to use + for (Dap4Server svc : registry) { + if (svc.ping()) + return svc; + } + return null; + } +} + + diff --git a/dap4/src/test/java/dap4/test/DapTestCommon.java b/dap4/src/test/java/dap4/test/DapTestCommon.java new file mode 100644 index 0000000000..71fbc8b0cb --- /dev/null +++ b/dap4/src/test/java/dap4/test/DapTestCommon.java @@ -0,0 +1,404 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import dap4.core.util.DapException; +import dap4.core.util.DapUtil; +import dap4.dap4lib.HttpDSP; +import ucar.nc2.dataset.NetcdfDataset; +import ucar.nc2.write.Ncdump; +import ucar.unidata.util.test.TestDir; +import ucar.unidata.util.test.UnitTestCommon; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +abstract public class DapTestCommon extends UnitTestCommon { + + ////////////////////////////////////////////////// + // Constants + + static final String DEFAULTTREEROOT = "dap4"; + + static public final String FILESERVER = "file://localhost:8080"; + + static public final String ORDERTAG = "ucar.littleendian"; + static public final String TRANSLATETAG = "ucar.translate"; + static public final String TESTTAG = "ucar.testing"; + + static final String D4TESTDIRNAME = ""; + + // Equivalent to the path to the webapp/d4ts for testing purposes + static protected final String DFALTRESOURCEPATH = "/src/test/data/resources"; + + static protected final String[] LEGALEXTENSIONS = {".dap", ".dmr", ".nc", "dmp", ".ncdump", ".dds", ".das", ".dods"}; + + ////////////////////////////////////////////////// + + static class TestFilter implements FileFilter { + boolean debug; + boolean strip; + String[] extensions; + + public TestFilter(boolean debug, String[] extensions) { + this.debug = debug; + this.strip = strip; + this.extensions = extensions; + } + + public boolean accept(File file) { + boolean ok = false; + if (file.isFile() && file.canRead()) { + // Check for proper extension + String name = file.getName(); + if (name != null) { + for (String ext : extensions) { + if (name.endsWith(ext)) + ok = true; + } + } + if (!ok && debug) + System.err.println("Ignoring: " + file.toString()); + } + return ok; + } + + static void filterfiles(String path, List matches, String... extensions) { + File testdirf = new File(path); + assert (testdirf.canRead()); + TestFilter tf = new TestFilter(DEBUG, extensions); + File[] filelist = testdirf.listFiles(tf); + for (int i = 0; i < filelist.length; i++) { + File file = filelist[i]; + if (file.isDirectory()) + continue; + String fname = DapUtil.canonicalpath(file.getAbsolutePath()); + matches.add(fname); + } + } + } + + // Test properties + static class TestProperties { + boolean prop_diff; // Do comparison with baseline files + boolean prop_baseline; // Generate the baseline files + boolean prop_visual; // Debug output: display the test output and the baseline output + boolean prop_debug; // General debug flag + boolean prop_http_debug; // Print request and response headers + + public TestProperties() { + prop_diff = true; + prop_baseline = false; + prop_visual = false; + prop_debug = DEBUG; + prop_http_debug = false; + } + } + + static public class TestCaseCommon { + public String name; + + public TestCaseCommon() { + this(null); + } + + public TestCaseCommon(String name) { + this.name = name; + } + } + + ////////////////////////////////////////////////// + // Static variables + + static protected String dap4root = null; + static protected String dap4testroot = null; + static protected String dap4resourcedir = null; + + static protected TestProperties props = null; + + static { + dap4root = locateDAP4Root(threddsroot); + if (dap4root == null) + System.err.println("Cannot locate /dap4 parent dir"); + dap4testroot = canonjoin(dap4root, D4TESTDIRNAME); + dap4resourcedir = canonjoin(dap4testroot, DFALTRESOURCEPATH); + props = new TestProperties(); + } + + ////////////////////////////////////////////////// + // Static methods + + static protected String getD4TestsRoot() { + return dap4testroot; + } + + static protected String getResourceRoot() { + return dap4resourcedir; + } + + static String locateDAP4Root(String threddsroot) { + String root = threddsroot; + if (root != null) + root = root + "/" + DEFAULTTREEROOT; + // See if it exists + File f = new File(root); + if (!f.exists() || !f.isDirectory()) + root = null; + return root; + } + + ////////////////////////////////////////////////// + // Instance variables + + protected String d4tsserver = null; + + protected String title = "Dap4 Testing"; + + public DapTestCommon() { + this("DapTest"); + } + + public DapTestCommon(String name) { + super(name); + setSystemProperties(); + this.d4tsserver = TestDir.dap4TestServer; + if (DEBUG) + System.err.println("DapTestCommon: d4tsServer=" + d4tsserver); + } + + /** + * Try to get the system properties + */ + protected void setSystemProperties() { + if (System.getProperty("nodiff") != null) + props.prop_diff = false; + if (System.getProperty("baseline") != null) + props.prop_baseline = true; + if (System.getProperty("debug") != null) + props.prop_debug = true; + if (System.getProperty("visual") != null) + props.prop_visual = true; + if (props.prop_baseline && props.prop_diff) + props.prop_diff = false; + } + + public void setup() { + if (props.prop_http_debug) + HttpDSP.setHttpDebug(); + } + + ////////////////////////////////////////////////// + // Accessor + public void setTitle(String title) { + this.title = title; + } + + public String getTitle() { + return this.title; + } + + ////////////////////////////////////////////////// + // Instance Utilities + + public void visual(String header, String captured) { + if (!captured.endsWith("\n")) + captured = captured + "\n"; + // Dump the output for visual comparison + System.err.println("\n" + header + ":"); + System.err.println("---------------"); + System.err.print(captured); + System.err.println("---------------"); + System.err.flush(); + } + + protected void findServer(String path) throws DapException { + String svc = DapConstants.HTTPSCHEME + "//" + this.d4tsserver + "/d4ts"; + if (!checkServer(svc)) + System.err.println("D4TS Server not reachable: " + svc); + // Since we will be accessing it thru NetcdfDataset, we need to change the schema. + d4tsserver = "dap4://" + d4tsserver + "/d4ts"; + } + + ////////////////////////////////////////////////// + + public String getDAP4Root() { + return this.dap4root; + } + + @Override + public String getResourceDir() { + return this.dap4resourcedir; + } + + static void printDir(String path) { + File testdirf = new File(path); + assert (testdirf.canRead()); + File[] filelist = testdirf.listFiles(); + System.err.println("\n*******************"); + System.err.printf("Contents of %s:%n", path); + for (int i = 0; i < filelist.length; i++) { + File file = filelist[i]; + String fname = file.getName(); + System.err.printf("\t%s%s%n", fname, (file.isDirectory() ? "/" : "")); + } + System.err.println("*******************"); + System.err.flush(); + } + + ////////////////////////////////////////////////// + // Filename processing utilities + + /** + * Given a List of file names, return a list of those names except + * for any in the array of filenames to be excluded. + * + * @param manifest The list of file names + * @param exclusions The array of excluded names + * @return manifest with excluded names removed + */ + static public String[][] excludeNames(String[][] manifest, String[] exclusions) { + List xlist = new ArrayList<>(manifest.length); + for (int i = 0; i < manifest.length; i++) { + String name = manifest[i][0]; // Assume tuple element 0 is always the name + boolean matched = false; + for (String excluded : exclusions) { + if (excluded.equals(name)) + matched = true; + } + if (!matched) + xlist.add(manifest[i]); + } + return xlist.toArray(new String[0][]); + } + + // Filter a document with respect to a set of regular expressions + // Used to remove e.g. unwanted attributes + static public boolean regexpFilter(StringBuilder document, String regexp, boolean repeat) { + boolean changed = false; + String doc = document.toString(); + Pattern p = Pattern.compile(regexp, Pattern.DOTALL); + Matcher m = p.matcher(doc); + if (m.find()) { + changed = true; + String newdoc = (repeat ? m.replaceAll("") : m.replaceFirst("")); + doc = newdoc; + document.setLength(0); + document.append(doc); + } + return changed; + } + + static public boolean regexpFilters(StringBuilder sbdoc, String[] regexps, boolean repeat) { + boolean changed = false; + for (String re : regexps) { + if (regexpFilter(sbdoc, re, repeat)) + changed = true; + else + break; + } + return changed; + } + + // Filter a document with respect to a set of regular expressions + // on a per-line basis + static public boolean regexpFilterLine(StringBuilder document, String regexp, boolean repeat) { + boolean changed = false; + Pattern p = Pattern.compile(regexp, Pattern.DOTALL); + String[] lines = document.toString().split("\r?\n"); + document.setLength(0); + for (int i = 0; i < lines.length; i++) { + String line = lines[i]; + Matcher m = p.matcher(line); + if (!m.find()) { + document.append(line); + document.append("\n"); + changed = true; + if (!repeat) + break; + } + } + return changed; + } + + + /** + * Choose a test case based on its name and return its index + * + * @param name to search for + * @param testcases set of testcases to search + */ + static void singleTest(String name, List testcases) { + for (int i = 0; i < testcases.size(); i++) { + TestCaseCommon tc = testcases.get(i); + if (tc.name.equalsIgnoreCase(name)) { + testcases.clear(); + testcases.add(tc); + } + } + return; + } + + /** + * Choose a test case based on its name and return its index + * + * @param index to search for + * @param testcases set of testcases to search + */ + static void singleTest(int index, List testcases) { + TestCaseCommon tc = testcases.get(index); + testcases.clear(); + testcases.add(tc); + return; + } + + protected String dumpmetadata(NetcdfDataset ncfile, String datasetname) throws Exception { + StringWriter sw = new StringWriter(); + StringBuilder args = new StringBuilder("-strict"); + if (datasetname != null) { + args.append(" -datasetname "); + args.append(datasetname); + } + // Print the meta-databuffer using these args to NcdumpW + try { + Ncdump.ncdump(ncfile, args.toString(), sw, null); + // if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) + // throw new Exception("NcdumpW failed"); + } catch (IOException ioe) { + throw new Exception("Ncdump failed", ioe); + } + sw.close(); + return sw.toString(); + } + + protected String dumpdata(NetcdfDataset ncfile, String datasetname) throws Exception { + StringBuilder args = new StringBuilder("-strict -vall"); + if (datasetname != null) { + args.append(" -datasetname "); + args.append(datasetname); + } + StringWriter sw = new StringWriter(); + // Dump the databuffer + try { + Ncdump.ncdump(ncfile, args.toString(), sw, null); + // if (!ucar.nc2.NCdumpW.print(ncfile, args.toString(), sw, null)) + // throw new Exception("NCdumpW failed"); + } catch (IOException ioe) { + ioe.printStackTrace(); + throw new Exception("NCdump failed", ioe); + } + sw.close(); + return sw.toString(); + } + + +} diff --git a/dap4/d4tests/src/test/java/dap4/test/Dump.java b/dap4/src/test/java/dap4/test/Dump.java similarity index 98% rename from dap4/d4tests/src/test/java/dap4/test/Dump.java rename to dap4/src/test/java/dap4/test/Dump.java index 7ebe022f0a..8a2160798f 100644 --- a/dap4/d4tests/src/test/java/dap4/test/Dump.java +++ b/dap4/src/test/java/dap4/test/Dump.java @@ -6,6 +6,7 @@ package dap4.test; +import dap4.core.util.DapConstants; import dap4.core.util.DapUtil; import dap4.core.util.Escape; import java.io.IOException; @@ -168,7 +169,7 @@ public void verifychecksum() throws IOException { return; int localcrc32 = endchecksum(); // Get the checksum from the input stream - ByteBuffer bbuf = readn(DapUtil.CHECKSUMSIZE); + ByteBuffer bbuf = readn(DapConstants.CHECKSUMSIZE); int remotecrc32 = bbuf.getInt(); assert localcrc32 == remotecrc32; newline(); diff --git a/dap4/src/test/java/dap4/test/TestConstraints.java b/dap4/src/test/java/dap4/test/TestConstraints.java new file mode 100644 index 0000000000..5efb52a48f --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestConstraints.java @@ -0,0 +1,186 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ucar.nc2.dataset.NetcdfDataset; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.nio.file.NoSuchFileException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +@RunWith(Parameterized.class) +public class TestConstraints extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + // Define the server to use + static protected final String SERVERNAME = "d4ts"; + static protected final String SERVER = "remotetest.unidata.ucar.edu"; + static protected final int SERVERPORT = -1; + static protected final String SERVERPATH = "d4ts/testfiles"; + + // Define the input set location(s) + static protected final String INPUTEXT = ".nc"; // note that the .dap is deliberately left off + static protected final String INPUTQUERY = "?" + DapConstants.CHECKSUMTAG + "=false&"; + static protected final String INPUTFRAG = "#dap4"; + + static protected final String BASELINEDIR = "/baselineconstraints"; + static protected final String BASELINEEXT = ".nc.ncdump"; + + // Following files cannot be tested because of flaws in sequence handling + // by the CDM code in ucar.nc2.dataset. + static protected String[] EXCLUSIONS = + {"test_vlen2", "test_vlen3", "test_vlen4", "test_vlen5", "test_vlen6", "test_vlen7", "test_vlen8"}; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + static public String resourceroot; + static public Dap4Server server; + + static { + // This test uses remotetest + server = new Dap4Server("remotetest", SERVER, SERVERPORT, SERVERPATH); + Dap4Server.register(true, server); + resourceroot = getResourceRoot(); + } + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String url; + public String baseline; + public String ce; // for debugging + + public TestCase(String name, String url, String baseline, String ce) { + super(name); + this.url = url; + this.baseline = baseline; + this.ce = ce; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.name; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + assert (server != null); + List testcases = new ArrayList<>(); + String[][] manifest = excludeNames(constraint_manifest, EXCLUSIONS); + // Separate the manifest string into the file name and the index and the query parts + for (String[] tuple : manifest) { + String file = tuple[0]; + String index = tuple[1]; + String query = tuple[2]; // excluding leading '?' + String url = + server.getURL() + "/" + file + INPUTEXT + INPUTQUERY + DapConstants.CONSTRAINTTAG + query + INPUTFRAG; + String baseline = resourceroot + BASELINEDIR + "/" + file + "." + index + BASELINEEXT; + TestCase tc = new TestCase(file + "." + index, url, baseline, query); + testcases.add(tc); + } + // singleTest(0,testcases); // choose single test for debugging + return testcases; + } + + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestConstraints(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + // props.prop_visual = true; + // props.prop_baseline = true; + super.setup(); + } + + @Test + public void test() throws Exception { + int i, c; + StringBuilder sb = new StringBuilder(); + + NetcdfDataset ncfile; + try { + ncfile = openDataset(tc.url); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("File open failed: " + tc.url, e); + } + assert ncfile != null; + + String datasetname = tc.name; + String testresult = dumpdata(ncfile, datasetname); + + // Read the baseline file(s) if they exist + String baselinecontent = null; + if (props.prop_baseline) { + writefile(tc.baseline, testresult); + } else { + try { + baselinecontent = readfile(tc.baseline); + } catch (NoSuchFileException nsf) { + Assert.fail(tc.name + ": ***Fail: test comparison file not found: " + tc.baseline); + } + } + if (props.prop_visual) { + if (baselinecontent != null) + visual("Input", baselinecontent); + visual("Output", testresult); + } + if (!props.prop_baseline && props.prop_diff) { // compare with baseline + System.err.println("Comparison: vs " + tc.baseline); + Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, testresult)); + System.out.println(tc.name + ": Passed"); + } + } +} + + diff --git a/dap4/src/test/java/dap4/test/TestHyrax.java b/dap4/src/test/java/dap4/test/TestHyrax.java new file mode 100644 index 0000000000..244b87018c --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestHyrax.java @@ -0,0 +1,190 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ucar.nc2.dataset.NetcdfDataset; + +import java.lang.invoke.MethodHandles; +import java.nio.file.NoSuchFileException; +import java.util.ArrayList; +import java.util.List; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +/** + * This test set reads DAP4 datasets (both constrained and not) + * from the test.opendap.org test server + */ + +@RunWith(Parameterized.class) +public class TestHyrax extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + // Define the server to use + static protected final String SERVERNAME = "hyrax"; + static protected final String SERVER = "test.opendap.org"; + static protected final int SERVERPORT = -1; + static protected final String SERVERPATH = "opendap"; + + // Define the input set location(s) + static protected final String INPUTEXT = ""; + static protected final String INPUTQUERY = "?dap4.checksum=true"; + static protected final String INPUTFRAG = "#dap4&hyrax"; + + static protected final String BASELINEDIR = "/baselinehyrax"; + static protected final String BASELINEEXT = ".ncdump"; + + static final String[][] hyrax_manifest = new String[][] {{"nc4_nc_classic_no_comp.nc", "nc4_test_files", null}, + {"nc4_nc_classic_comp.nc", "nc4_test_files", null}, {"nc4_unsigned_types.nc", "nc4_test_files", null}, + {"nc4_unsigned_types_comp.nc", "nc4_test_files", null}, {"nc4_strings.nc", "nc4_test_files", null}, + {"nc4_strings_comp.nc", "nc4_test_files", null}, {"ref_tst_compounds.nc", "nc4_test_files", null}, + {"amsre_20060131v5.dat", "RSS/amsre/bmaps_v05/y2006/m01", "/time_a[0:2][0:5]"}, + {"AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf", "AIRS/AIRH3STM.003/2002.12.01", "/TotalCounts_A"}}; + + static final String[] HYRAX_EXCLUSIONS = {}; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + static public String resourceroot; + static public Dap4Server server; + + static { + server = new Dap4Server("hyrax", SERVER, SERVERPORT, SERVERPATH); + Dap4Server.register(true, server); + resourceroot = getResourceRoot(); + } + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String url; + public String baseline; + public String ce; // optional + + public TestCase(String name, String url, String baseline, String ce) { + super(name); + this.url = url; + this.baseline = baseline; + this.ce = ce; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.name; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + assert (server != null); + List testcases = new ArrayList<>(); + String[][] manifest = excludeNames(hyrax_manifest, HYRAX_EXCLUSIONS); + // Separate the manifest string into pieces + for (String[] tuple : manifest) { + String file = tuple[0]; + String prefix = tuple[1]; + String query = tuple[2]; // excluding leading '?' + // Unfortunately, The OPeNDAP test server does not appear to support https: + String url = server.getURL("http:") + "/" + prefix + "/" + file + INPUTEXT + INPUTQUERY; + if (query != null) + url += ("&" + DapConstants.CONSTRAINTTAG + "=" + query); + url += INPUTFRAG; + String baseline = resourceroot + BASELINEDIR + "/" + file + BASELINEEXT; + TestCase tc = new TestCase(file, url, baseline, query); + testcases.add(tc); + } + // singleTest("AIRS.2002.12.01.L3.RetStd_H031.v4.0.21.0.G06101132853.hdf", testcases); // choose single test for + // debugging + return testcases; + } + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestHyrax(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + // props.prop_baseline = true; + // props.prop_visual = true; + super.setup(); + } + + @Test + public void test() throws Exception { + int i, c; + StringBuilder sb = new StringBuilder(); + + NetcdfDataset ncfile; + try { + ncfile = openDataset(tc.url); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("File open failed: " + tc.url, e); + } + assert ncfile != null; + + String datasetname = tc.name; + String testresult = dumpdata(ncfile, datasetname); + + // Read the baseline file(s) if they exist + String baselinecontent = null; + if (props.prop_baseline) { + writefile(tc.baseline, testresult); + } else { + try { + baselinecontent = readfile(tc.baseline); + } catch (NoSuchFileException nsf) { + Assert.fail(tc.name + ": ***Fail: test comparison file not found: " + tc.baseline); + } + } + if (props.prop_visual) { + if (baselinecontent != null) + visual("Input", baselinecontent); + visual("Output", testresult); + } + if (!props.prop_baseline && props.prop_diff) { // compare with baseline + System.err.println("Comparison: vs " + tc.baseline); + Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, testresult)); + System.out.println(tc.name + ": Passed"); + } + } + +} diff --git a/dap4/src/test/java/dap4/test/TestParserCE.java b/dap4/src/test/java/dap4/test/TestParserCE.java new file mode 100644 index 0000000000..5216673a8a --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestParserCE.java @@ -0,0 +1,174 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.ce.CECompiler; +import dap4.core.ce.CEConstraint; +import dap4.core.ce.parser.CEParserImpl; +import dap4.core.dmr.DMRFactory; +import dap4.core.dmr.DapDataset; +import dap4.core.dmr.ErrorResponse; +import dap4.core.dmr.parser.DOM4Parser; +import dap4.core.dmr.parser.Dap4Parser; +import dap4.core.dmr.parser.ParseUtil; +import dap4.core.dmr.DMRPrinter; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +/** + * This tests the Constraint Expression (CE) Parser; + * it is completely self-contained. + */ + +@RunWith(Parameterized.class) +public class TestParserCE extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + static final boolean DMRPARSEDEBUG = false; + static final boolean CEPARSEDEBUG = false; + + // DMR Constants + static final String CE1_DMR = "\n" + + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + ""; + + static final String CE2_DMR = "" + " " + + " " + " " + " " + " " + ""; + + static final String[][] testinputs = + {{"/a[1]", null, CE1_DMR}, {"/b[10:16]", null, CE1_DMR}, {"/c[8:2:15]", null, CE1_DMR}, + {"/a[1];/b[10:16];/c[8:2:15]", null, CE1_DMR}, {"/d[1][0:2:2];/a[1];/e[1][0];/f[0][1]", null, CE1_DMR}, + {"/s[0:3][0:2].x;/s[0:3][0:2].y", "/s[0:3][0:2]", CE1_DMR}, {"/seq|i1<0", null, CE1_DMR}, + {"/seq|00,i1<10", CE1_DMR}, {"vo[1:1][0,0]", "/vo[1][0,0]", CE2_DMR}}; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String ce; + public String expected; // null => same as ce + public String dmr; // DMR against which the CE is defined + + public TestCase(String ce, String expected, String dmr) { + super(); + this.ce = ce; + this.expected = expected; + this.dmr = dmr; + if (this.expected == null) + this.expected = ce; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.ce; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + List testcases = new ArrayList<>(); + for (String[] triple : testinputs) { + TestCase tc = new TestCase(triple[0], triple[1], triple[2]); + testcases.add(tc); + } + // singleTest(0, testcases); // choose single test for debugging + return testcases; + } + + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestParserCE(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + super.setup(); + } + + @Test + public void test() throws Exception { + int i, c; + + // Create the DMR tree + Dap4Parser parser = new DOM4Parser(new DMRFactory()); + if (DMRPARSEDEBUG) + parser.setDebugLevel(1); + // Parse document + Assert.assertTrue("DMR Parse failed", parser.parse(tc.dmr)); + Assert.assertNull("DMR Parser returned Error response", parser.getErrorResponse()); // Check result + DapDataset dmr = parser.getDMR(); + Assert.assertNotNull("No DMR created", dmr); + + // Parse the constraint expression against the DMR + CEParserImpl ceparser = new CEParserImpl(dmr); + if (CEPARSEDEBUG) + ceparser.setDebugLevel(1); + Assert.assertTrue("CE Parse failed", ceparser.parse(tc.ce)); + CECompiler compiler = new CECompiler(); + CEConstraint ceroot = compiler.compile(dmr, ceparser.getCEAST()); + Assert.assertNotNull("No CEConstraint created", ceroot); + + // Dump the parsed CE for comparison purposes + String cedump = ceroot.toConstraintString(); + if (props.prop_visual) + visual("|" + tc.ce + "|", cedump); + Assert.assertTrue("expected :: CE mismatch", same(getTitle(), tc.expected, cedump)); + System.out.println(tc.ce + ": Passed"); + } + +} diff --git a/dap4/src/test/java/dap4/test/TestParserDMR.java b/dap4/src/test/java/dap4/test/TestParserDMR.java new file mode 100644 index 0000000000..1f1e8c578c --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestParserDMR.java @@ -0,0 +1,186 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.dmr.DMRFactory; +import dap4.core.dmr.DapDataset; +import dap4.core.dmr.ErrorResponse; +import dap4.core.dmr.parser.DOM4Parser; +import dap4.core.dmr.parser.Dap4Parser; +import dap4.core.dmr.parser.ParseUtil; +import dap4.core.dmr.DMRPrinter; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +@RunWith(Parameterized.class) +public class TestParserDMR extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + static final boolean PARSEDEBUG = false; + + // Define the input set location(s) + static protected final String INPUTDIR = "/rawtestfiles"; + static protected final String INPUTEXT = ".nc.dmr"; + + // Define some common DMR filter regular expression + static String RE_ENDIAN = "\n[ \t]*[ \t]*"; + static String RE_NCPROPS = "\n[ \t]*[ \t]*"; + static protected final String RE_UNLIMITED = "[ \t]+_edu.ucar.isunlimited=\"1\""; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + static public String resourceroot; + + static { + resourceroot = getResourceRoot(); + } + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String name; // Name from manifest + public String input; // Full path or URL for the input file + + public TestCase(String filename, String input) { + super(filename); + this.input = input; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.name; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + List testcases = new ArrayList<>(); + for (String[] tuple : dap4_manifest) { + String name = tuple[0]; + String path = resourceroot + INPUTDIR + "/" + name + INPUTEXT; + TestCase tc = new TestCase(name, path); + testcases.add(tc); + } + // Include the constraint tests also + for (String[] triple : constraint_manifest) { + String file = triple[0]; // unpack + String index = triple[1]; + String ce = triple[2]; // unused + String path = resourceroot + INPUTDIR + "/" + file + "." + index + INPUTEXT; + TestCase tc = new TestCase(file + "." + index, path); + testcases.add(tc); + } + // singleTest(0, testcases); // choose single test for debugging + return testcases; + } + + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestParserDMR(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + // props.prop_visual = true; + super.setup(); + } + + @Test + public void test() throws Exception { + String document; + int i, c; + + document = readfile(tc.input); + + // Remove unneeded attributes + StringBuilder sb = new StringBuilder(); + sb.append(document); + regexpFilters(sb, new String[] {RE_ENDIAN, RE_NCPROPS}, false); + regexpFilters(sb, new String[] {RE_UNLIMITED}, true); + document = sb.toString(); + + Dap4Parser parser = new DOM4Parser(new DMRFactory()); + if (PARSEDEBUG) + parser.setDebugLevel(1); + // Parse document + Assert.assertTrue("Parse failed", parser.parse(document)); + + // Check result + ErrorResponse err = parser.getErrorResponse(); + if (err != null) + Assert.fail("Error response:\n" + err.buildXML()); + + DapDataset dmr = parser.getDMR(); + Assert.assertNotNull("No dataset created", dmr); + + // Dump the parsed DMR for comparison purposes + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + DMRPrinter dapprinter = new DMRPrinter(dmr, pw); + dapprinter.print(); + pw.close(); + sw.close(); + + sb = new StringBuilder(sw.toString()); + // Remove irrelevant dependencies + regexpFilters(sb, new String[] {RE_ENDIAN}, false); + String testresult = sb.toString(); + + // Use the original DMR as the baseline + String baselinecontent = document; + + if (props.prop_visual) { + visual("Baseline", baselinecontent); + visual("Output", testresult); + } + Assert.assertTrue("Files are different", same(getTitle(), baselinecontent, testresult)); + System.out.println(tc.name + ": Passed"); + } + +} diff --git a/dap4/src/test/java/dap4/test/TestRaw.java b/dap4/src/test/java/dap4/test/TestRaw.java new file mode 100644 index 0000000000..cedb66b3f3 --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestRaw.java @@ -0,0 +1,206 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ucar.nc2.dataset.NetcdfDataset; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.nio.file.NoSuchFileException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static dap4.core.util.DapConstants.CHECKSUMATTRNAME; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +@RunWith(Parameterized.class) +public class TestRaw extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + // Define the input set location(s) + static protected final String INPUTDIR = "/rawtestfiles"; + static protected final String INPUTEXT = ".nc.dap"; + static protected final String INPUTQUERY = "?" + DapConstants.CHECKSUMTAG + "=false"; + static protected final String INPUTFRAG = ""; + static protected final String BASELINEDIR = "/baselineraw"; + static protected final String BASELINEEXT = ".nc.ncdump"; + + + // Following files cannot be tested because of flaws in sequence handling + // by the CDM code in ucar.nc2.dataset. + static protected String[] EXCLUSIONS = + {"test_vlen2", "test_vlen3", "test_vlen4", "test_vlen5", "test_vlen6", "test_vlen7", "test_vlen8"}; + + // Attribute suppression + static String RE_ENDIAN = "\n[ \t]*[ \t]*"; + static String RE_CHECKSUM = ":" + DapConstants.CHECKSUMATTRNAME; + static String RE_DAP4_ENDIAN = ":" + DapConstants.LITTLEENDIANATTRNAME; + static String RE_DAP4_CE = ":" + DapConstants.CEATTRNAME; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + static public String resourceroot; + + static { + resourceroot = getResourceRoot(); + } + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String url; + public String baseline; + + public TestCase(String name, String url, String baseline) { + super(name); + this.url = url; + this.baseline = baseline; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.name; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + List testcases = new ArrayList<>(); + String[][] manifest = excludeNames(dap4_manifest, EXCLUSIONS); + for (String[] tuple : manifest) { + String name = tuple[0]; + String url = buildURL(name); + String baseline = resourceroot + BASELINEDIR + "/" + name + BASELINEEXT; + TestCase tc = new TestCase(name, url, baseline); + testcases.add(tc); + } + // singleTest("test_vlen3", testcases); // choose single test for debugging + return testcases; + } + + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestRaw(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + // props.prop_visual = true; + // props.prop_baseline = true; + super.setup(); + } + + @Test + public void test() throws Exception { + int i, c; + StringBuilder sb = new StringBuilder(); + // String url = buildURL(resourceroot + INPUTDIR, tc.name + INPUTEXT); + String url = tc.url; + NetcdfDataset ncfile; + try { + ncfile = openDataset(url); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("File open failed: " + url, e); + } + assert ncfile != null; + + String datasetname = tc.url; + String testresult = dumpdata(ncfile, tc.name); // print data section + + // Remove unused text + sb.setLength(0); + sb.append(testresult); + regexpFilterLine(sb, RE_DAP4_ENDIAN, true); + regexpFilterLine(sb, RE_DAP4_CE, true); + testresult = sb.toString(); + + // Read the baseline file(s) if they exist + String baselinecontent = null; + if (props.prop_baseline) { + writefile(tc.baseline, testresult); + } else { + try { + baselinecontent = readfile(tc.baseline); + // Remove unused text + sb.setLength(0); + sb.append(baselinecontent); + regexpFilterLine(sb, RE_CHECKSUM, true); + baselinecontent = sb.toString(); + } catch (NoSuchFileException nsf) { + Assert.fail(tc.name + ": ***Fail: test comparison file not found: " + tc.baseline); + } + } + if (props.prop_visual) { + if (baselinecontent != null) + visual("Input", baselinecontent); + visual("Output", testresult); + } + if (!props.prop_baseline && props.prop_diff) { // compare with baseline + System.err.println("Comparison: vs " + tc.baseline); + Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, testresult)); + System.out.println(tc.name + ": Passed"); + } + } + + ////////////////////////////////////////////////// + // Support Methods + + static protected String buildURL(String name) { + StringBuilder url = new StringBuilder(); + url.append("file://"); + url.append(resourceroot); + url.append(INPUTDIR); + url.append("/"); + url.append(name); + url.append(INPUTEXT); + url.append(INPUTQUERY); + url.append(INPUTFRAG); + return url.toString(); + } + +} + + diff --git a/dap4/src/test/java/dap4/test/TestRemote.java b/dap4/src/test/java/dap4/test/TestRemote.java new file mode 100644 index 0000000000..772ff6fb91 --- /dev/null +++ b/dap4/src/test/java/dap4/test/TestRemote.java @@ -0,0 +1,180 @@ +/* + * Copyright 2012, UCAR/Unidata. + * See the LICENSE file for more information. + */ + +package dap4.test; + +import dap4.core.util.DapConstants; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ucar.nc2.dataset.NetcdfDataset; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.nio.file.NoSuchFileException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * This Test uses the JUNIT Version 4 parameterized test mechanism. + * The set of arguments for each test is encapsulated in a class + * called TestCase. This allows for code re-use and for extending + * tests by adding fields to the TestCase object. + */ + +@RunWith(Parameterized.class) +public class TestRemote extends DapTestCommon implements Dap4ManifestIF { + + ////////////////////////////////////////////////// + // Constants + + // Define the server to use + static protected final String SERVERNAME = "d4ts"; + static protected final String SERVER = "remotetest.unidata.ucar.edu"; + static protected final int SERVERPORT = -1; + static protected final String SERVERPATH = "d4ts/testfiles"; + + // Define the input set location(s) + static protected final String INPUTEXT = ".nc"; // note that the .dap is deliberately left off + static protected final String INPUTQUERY = "?" + DapConstants.CHECKSUMTAG + "=true"; + static protected final String INPUTFRAG = "#dap4"; + + static protected final String BASELINEDIR = "/baselineremote"; + static protected final String BASELINEEXT = ".nc.ncdump"; + + // Following files cannot be tested because of flaws in sequence handling + // by the CDM code in ucar.nc2.dataset. + static protected String[] EXCLUSIONS = + {"test_vlen2", "test_vlen3", "test_vlen4", "test_vlen5", "test_vlen6", "test_vlen7", "test_vlen8"}; + + ////////////////////////////////////////////////// + // Static Fields + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + static public String resourceroot; + static public Dap4Server server; + + static { + server = new Dap4Server("remotetest", SERVER, SERVERPORT, SERVERPATH); + Dap4Server.register(true, server); + resourceroot = getResourceRoot(); + } + + ////////////////////////////////////////////////// + // Test Case Class + + // Encapulate the arguments for each test + static class TestCase extends TestCaseCommon { + public String url; + public String baseline; + + public TestCase(String name, String url, String baseline) { + super(name); + this.url = url; + this.baseline = baseline; + } + + // This defines how the test is reported by JUNIT. + public String toString() { + return this.name; + } + } + + ////////////////////////////////////////////////// + // Test Generator + + @Parameterized.Parameters(name = "{index}: {0}") + static public List defineTestCases() { + assert (server != null); + List testcases = new ArrayList<>(); + String[][] manifest = excludeNames(dap4_manifest, EXCLUSIONS); + for (String[] tuple : manifest) { + String name = tuple[0]; + String url = server.getURL() + "/" + name + INPUTEXT + INPUTQUERY + INPUTFRAG; + String baseline = resourceroot + BASELINEDIR + "/" + name + BASELINEEXT; + TestCase tc = new TestCase(name, url, baseline); + testcases.add(tc); + } + // singleTest("test_utf8", testcases); // choose single test for debugging + return testcases; + } + + ////////////////////////////////////////////////// + // Test Fields + + TestCase tc; + + ////////////////////////////////////////////////// + // Constructor(s) + + public TestRemote(TestCaseCommon tc) { + super(); + this.tc = (TestCase) tc; + } + + ////////////////////////////////////////////////// + // Junit test method(s) + + @Before + public void setup() { + // Set any properties + // props.prop_visual = true; + // props.prop_baseline = true; + super.setup(); + } + + @Test + public void test() throws Exception { + int i, c; + StringBuilder sb = new StringBuilder(); + + System.err.println(">>> Test: " + tc.url); + + NetcdfDataset ncfile; + try { + ncfile = openDataset(tc.url); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("File open failed: " + tc.url, e); + } + assert ncfile != null; + + String datasetname = tc.name; + String testresult = dumpdata(ncfile, tc.name); // print data section + + // Read the baseline file(s) if they exist + String baselinecontent = null; + if (props.prop_baseline) { + writefile(tc.baseline, testresult); + } else { + try { + baselinecontent = readfile(tc.baseline); + } catch (NoSuchFileException nsf) { + Assert.fail(tc.name + ": ***Fail: test comparison file not found: " + tc.baseline); + } + } + if (props.prop_visual) { + if (baselinecontent != null) + visual("Input", baselinecontent); + visual("Output", testresult); + } + if (!props.prop_baseline && props.prop_diff) { // compare with baseline + System.err.println("Comparison: vs " + tc.baseline); + Assert.assertTrue("*** FAIL", same(getTitle(), baselinecontent, testresult)); + System.out.println(tc.name + ": Passed"); + } + } + +} + + diff --git a/dap4/d4tests/src/test/resources/logback-test.xml b/dap4/src/test/resources/logback-test.xml similarity index 86% rename from dap4/d4tests/src/test/resources/logback-test.xml rename to dap4/src/test/resources/logback-test.xml index d24280d3c9..f48ace23f7 100644 --- a/dap4/d4tests/src/test/resources/logback-test.xml +++ b/dap4/src/test/resources/logback-test.xml @@ -36,6 +36,14 @@ --> + + + + + + + + diff --git a/gradle/any/coverage.gradle b/gradle/any/coverage.gradle index f6ba25970f..141cb5e034 100644 --- a/gradle/any/coverage.gradle +++ b/gradle/any/coverage.gradle @@ -21,7 +21,7 @@ tasksExtendedByJacoco.all { * in cdm/src/main only. * * That's fine for :cdm, but we have subprojects that contain no code in their 'main' source set, namely :it, - * :cdm-test, and :dap4:d4tests. They only have code in their 'test' SourceSets. As a result, the default + * and :cdm-test. They only have code in their 'test' SourceSets. As a result, the default * 'jacocoTestReport' task added to those tasks will generate an empty report, because there's nothing to report on. * * We could remedy this by adding main SourceSets from other projects to report on. This would be particularly diff --git a/gradle/root/fatJars.gradle b/gradle/root/fatJars.gradle index e98c41705b..6f14b09572 100644 --- a/gradle/root/fatJars.gradle +++ b/gradle/root/fatJars.gradle @@ -41,6 +41,7 @@ dependencies { ncIdv project(':bufr') ncIdv project(':grib') ncIdv project(':opendap') + ncIdv project(':dap4') ncIdv project(':visad:cdm-mcidas') ncIdv project(':visad:cdm-vis5d') ncIdv project(':httpservices') @@ -55,6 +56,7 @@ dependencies { netcdfAll project(':grib') netcdfAll project(':netcdf4') netcdfAll project(':opendap') + netcdfAll project(':dap4') netcdfAll project(':httpservices') netcdfAll project(':visad:cdm-mcidas') diff --git a/httpservices/src/main/java/ucar/httpservices/HTTPIntercepts.java b/httpservices/src/main/java/ucar/httpservices/HTTPIntercepts.java new file mode 100644 index 0000000000..cf35f5ee3a --- /dev/null +++ b/httpservices/src/main/java/ucar/httpservices/HTTPIntercepts.java @@ -0,0 +1,416 @@ +/* + * Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata + * See LICENSE for license information. + */ + +package ucar.httpservices; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.apache.http.*; +import org.apache.http.client.entity.DeflateDecompressingEntity; +import org.apache.http.client.entity.GzipDecompressingEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.message.BasicHeader; +import org.apache.http.protocol.HttpContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Package together all the HTTP Intercept code + */ + +public class HTTPIntercepts { + + ////////////////////////////////////////////////// + // Constants + static private final Logger logger = LoggerFactory.getLogger(HTTPIntercepts.class); + + // Allow printing to a variety of targets + static abstract public interface Printer { + public void print(String s); + + public void println(String s); + } + + // Default printer + static public Printer logprinter = new Printer() { + public void print(String s) { + logger.debug(s); + } + + public void println(String s) { + logger.debug(s); + } + }; + + ////////////////////////////////////////////////// + // Inner classes + + abstract static class InterceptCommon { + private static final Logger logger = LoggerFactory.getLogger(InterceptCommon.class); + + protected HttpContext context = null; + protected List

headers = new ArrayList
(); + protected HttpRequest request = null; + protected HttpResponse response = null; + protected Printer printer = null; + + public InterceptCommon setPrint(Printer printer) { + this.printer = printer; + return this; + } + + public void clear() { + context = null; + headers.clear(); + request = null; + response = null; + } + + public synchronized HttpRequest getRequest() { + return this.request; + } + + public synchronized HttpResponse getResponse() { + return this.response; + } + + public synchronized HttpContext getContext() { + return this.context; + } + + public synchronized HttpEntity getRequestEntity() { + if (this.request != null && this.request instanceof HttpEntityEnclosingRequest) { + return ((HttpEntityEnclosingRequest) this.request).getEntity(); + } else + return null; + } + + synchronized HttpEntity getResponseEntity() { + if (this.response != null) { + return this.response.getEntity(); + } else + return null; + } + + public synchronized List
getHeaders(String key) { + List
keyh = new ArrayList
(); + for (Header h : this.headers) { + if (h.getName().equalsIgnoreCase(key.trim())) + keyh.add(h); + } + return keyh; + } + + public synchronized List
getHeaders() { + return this.headers; + } + + public void printHeaders() { + if (this.request != null) { + DebugInterceptRequest thisreq = (DebugInterceptRequest) this; + printer.println("Request: method=" + thisreq.getMethod() + "; uri=" + thisreq.getUri()); + Header[] hdrs = this.request.getAllHeaders(); + if (hdrs == null) + hdrs = new Header[0]; + printer.println("Request Headers:"); + for (Header h : hdrs) { + printer.println(h.toString()); + } + } + if (this.response != null) { + DebugInterceptResponse thisresp = (DebugInterceptResponse) this; + printer.println("Response: code=" + thisresp.getStatusCode()); + Header[] hdrs = this.response.getAllHeaders(); + if (hdrs == null) + hdrs = new Header[0]; + printer.println("Response Headers:"); + for (Header h : hdrs) { + printer.println(h.toString()); + } + } + } + } + + ////////////////////////////////////////////////// + // Static Variables + + // Use this flag to indicate that all instances should set debug. + static protected boolean defaultinterception = false; + + // Global set debug interceptors + static public void setGlobalDebugInterceptors(boolean tf) { + defaultinterception = true; + } + + // Use this flag to have debug interceptors print their info + // in addition to whatever else it does + static protected Printer defaultprinter = null; + + static public void setGlobalPrinter(Printer printer) { + defaultprinter = printer; + } + + ////////////////////////////////////////////////// + // Specific Interceptors + + static public class DebugInterceptResponse extends HTTPIntercepts.InterceptCommon implements HttpResponseInterceptor { + protected StatusLine statusline = null; // Status Line + + public int getStatusCode() { + return (statusline == null ? -1 : statusline.getStatusCode()); + } + + public synchronized void process(HttpResponse response, HttpContext context) throws HttpException, IOException { + this.response = response; + this.context = context; + this.statusline = response.getStatusLine(); + if (this.printer != null) + printHeaders(); + if (this.response != null) { + Header[] hdrs = this.response.getAllHeaders(); + for (int i = 0; i < hdrs.length; i++) { + headers.add(hdrs[i]); + } + } + } + } + + static public class DebugInterceptRequest extends InterceptCommon implements HttpRequestInterceptor { + protected RequestLine requestline = null; // request Line + + public String getMethod() { + return (requestline == null ? null : requestline.getMethod()); + } + + public String getUri() { + return (requestline == null ? null : requestline.getUri()); + } + + public synchronized void process(HttpRequest request, HttpContext context) throws HttpException, IOException { + this.request = request; + this.context = context; + this.requestline = request.getRequestLine(); + if (this.printer != null) + printHeaders(); + if (this.request != null) { + Header[] hdrs = this.request.getAllHeaders(); + for (int i = 0; i < hdrs.length; i++) { + headers.add(hdrs[i]); + } + } + } + } + + /** + * Temporary hack to remove Content-Encoding: XXX-Endian headers + */ + static class ContentEncodingInterceptor extends InterceptCommon implements HttpResponseInterceptor { + public synchronized void process(HttpResponse response, HttpContext context) throws HttpException, IOException { + if (response == null) + return; + Header[] hdrs = response.getAllHeaders(); + if (hdrs == null) + return; + boolean modified = false; + for (int i = 0; i < hdrs.length; i++) { + Header h = hdrs[i]; + if (!h.getName().equalsIgnoreCase("content-encoding")) + continue; + String value = h.getValue(); + if (value.trim().toLowerCase().endsWith("-endian")) { + hdrs[i] = new BasicHeader("X-Content-Encoding", value); + modified = true; + } + } + if (modified) + response.setHeaders(hdrs); + // Similarly, suppress encoding for Entity + HttpEntity entity = response.getEntity(); + if (entity != null) { + Header ceheader = entity.getContentEncoding(); + if (ceheader != null) { + String value = ceheader.getValue(); + } + } + } + } + + static class GZIPResponseInterceptor implements HttpResponseInterceptor { + public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { + HttpEntity entity = response.getEntity(); + if (entity != null) { + Header ceheader = entity.getContentEncoding(); + if (ceheader != null) { + HeaderElement[] codecs = ceheader.getElements(); + for (HeaderElement h : codecs) { + if (h.getName().equalsIgnoreCase("gzip")) { + response.setEntity(new GzipDecompressingEntity(response.getEntity())); + return; + } + } + } + } + } + } + + static class DeflateResponseInterceptor implements HttpResponseInterceptor { + public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { + HttpEntity entity = response.getEntity(); + if (entity != null) { + Header ceheader = entity.getContentEncoding(); + if (ceheader != null) { + HeaderElement[] codecs = ceheader.getElements(); + for (HeaderElement h : codecs) { + if (h.getName().equalsIgnoreCase("deflate")) { + response.setEntity(new DeflateDecompressingEntity(response.getEntity())); + return; + } + } + } + } + } + } + + public DebugInterceptRequest debugRequestInterceptor() { + for (HttpRequestInterceptor hri : reqintercepts) { + if (hri instanceof DebugInterceptRequest) { + return ((DebugInterceptRequest) hri); + } + } + return null; + } + + public DebugInterceptResponse debugResponseInterceptor() { + for (HttpResponseInterceptor hri : rspintercepts) { + if (hri instanceof DebugInterceptResponse) { + return ((DebugInterceptResponse) hri); + } + } + return null; + } + + ////////////////////////////////////////////////// + // Instance variables + + protected Printer printer = logprinter; + + // This is a hack to suppress content-encoding headers from request + // Effectively final because its set in the static initializer and otherwise + // read only. + protected HttpResponseInterceptor CEKILL = null; + + // Define interceptor instances; use copy on write for thread safety + protected List reqintercepts = new CopyOnWriteArrayList<>(); + protected List rspintercepts = new CopyOnWriteArrayList<>(); + + // Debug Header interceptors + protected List dbgreq = new CopyOnWriteArrayList<>(); + protected List dbgrsp = new CopyOnWriteArrayList<>(); + + ////////////////////////////////////////////////// + // Constructor(s) + + public HTTPIntercepts() { + if (defaultinterception) + this.addDebugInterceptors(); + else + this.removeDebugIntercepts(); + this.printer = defaultprinter; + } + + ////////////////////////////////////////////////// + // Methods + + public void setCEKILL(boolean tf) { + if (tf) + CEKILL = new ContentEncodingInterceptor(); + else + CEKILL = null; + } + + public void activateInterceptors(HttpClientBuilder cb) { + for (HttpRequestInterceptor hrq : reqintercepts) { + cb.addInterceptorLast(hrq); + } + for (HttpResponseInterceptor hrs : rspintercepts) { + cb.addInterceptorLast(hrs); + } + // Add debug interceptors + for (HttpRequestInterceptor hrq : dbgreq) { + cb.addInterceptorFirst(hrq); + } + for (HttpResponseInterceptor hrs : dbgrsp) { + cb.addInterceptorFirst(hrs); + } + // Hack: add Content-Encoding suppressor + cb.addInterceptorFirst(CEKILL); + } + + protected synchronized void addDebugInterceptors() { + DebugInterceptRequest rq = new DebugInterceptRequest(); + DebugInterceptResponse rs = new DebugInterceptResponse(); + rq.setPrint(this.printer); + rs.setPrint(this.printer); + /* remove any previous */ + for (int i = reqintercepts.size() - 1; i >= 0; i--) { + HttpRequestInterceptor hr = reqintercepts.get(i); + if (hr instanceof InterceptCommon) { + reqintercepts.remove(i); + } + } + for (int i = rspintercepts.size() - 1; i >= 0; i--) { + HttpResponseInterceptor hr = rspintercepts.get(i); + if (hr instanceof InterceptCommon) { + rspintercepts.remove(i); + } + } + reqintercepts.add(rq); + rspintercepts.add(rs); + } + + public synchronized void resetInterceptors() { + for (HttpRequestInterceptor hri : reqintercepts) { + if (hri instanceof InterceptCommon) { + ((InterceptCommon) hri).clear(); + } + } + } + + public void setGzipCompression() { + HttpResponseInterceptor hrsi = new HTTPIntercepts.GZIPResponseInterceptor(); + rspintercepts.add(hrsi); + } + + public void setDeflateCompression() { + HttpResponseInterceptor hrsi = new HTTPIntercepts.DeflateResponseInterceptor(); + rspintercepts.add(hrsi); + } + + public synchronized void removeCompression() { + for (int i = rspintercepts.size() - 1; i >= 0; i--) { // walk backwards + HttpResponseInterceptor hrsi = rspintercepts.get(i); + if (hrsi instanceof HTTPIntercepts.GZIPResponseInterceptor + || hrsi instanceof HTTPIntercepts.DeflateResponseInterceptor) { + rspintercepts.remove(i); + } + } + } + + public synchronized void removeDebugIntercepts() { + for (int i = rspintercepts.size() - 1; i >= 0; i--) { // walk backwards + HttpResponseInterceptor hrsi = rspintercepts.get(i); + if (hrsi instanceof DebugInterceptResponse) + rspintercepts.remove(i); + } + for (int i = reqintercepts.size() - 1; i >= 0; i--) { // walk backwards + HttpRequestInterceptor hrsi = reqintercepts.get(i); + if (hrsi instanceof DebugInterceptRequest) + reqintercepts.remove(i); + } + } +} diff --git a/httpservices/src/main/java/ucar/httpservices/HTTPMethod.java b/httpservices/src/main/java/ucar/httpservices/HTTPMethod.java index 5ec5b1248d..aff490f31d 100755 --- a/httpservices/src/main/java/ucar/httpservices/HTTPMethod.java +++ b/httpservices/src/main/java/ucar/httpservices/HTTPMethod.java @@ -137,8 +137,7 @@ * is accessible. * *

- * For testing purposes, and to allow use of Spring Servlet Mocking, - * it is possible to set a special execution action (see executeRaw). + * For testing purposes, it is possible to set a special execution action (see executeRaw). */ @NotThreadSafe @@ -158,14 +157,11 @@ public static interface Executor { public static boolean TESTING = false; - /* External tests can Set this to true if they are using Spring Servlet Mocking */ - public static Executor MOCKEXECUTOR = null; - ////////////////////////////////////////////////// // Instance fields protected HTTPSession session = null; - protected boolean localsession = false; + protected boolean islocalsession = false; protected URI methodurl = null; protected String userinfo = null; protected HttpEntity content = null; @@ -224,7 +220,7 @@ protected HTTPMethod() throws HTTPException {} if (session == null) { session = HTTPFactory.newSession(url); - localsession = true; + islocalsession = true; } this.session = session; // user info may contain encoded characters (such as a username containing @@ -305,7 +301,7 @@ public synchronized void close() { } if (session != null) { session.removeMethod(this); - if (localsession) { + if (islocalsession) { session.close(); session = null; } @@ -346,7 +342,7 @@ public HttpResponse executeRaw() throws HTTPException { this.executed = true; if (this.methodurl == null) throw new HTTPException("HTTPMethod: no url specified"); - if (!localsession && !sessionCompatible(this.methodurl)) + if (!islocalsession && !sessionCompatible(this.methodurl)) throw new HTTPException("HTTPMethod: session incompatible url: " + this.methodurl); // Capture the current state of the parent HTTPSession; never to be modified in this class @@ -371,12 +367,7 @@ public HttpResponse executeRaw() throws HTTPException { configClient(cb, this.settings); session.setAuthenticationAndProxy(cb); HttpClient httpclient = cb.build(); - if (MOCKEXECUTOR != null) { - URI uri = this.lastrequest.getURI(); - this.lastresponse = MOCKEXECUTOR.execute(this.lastrequest); - } else { - this.lastresponse = httpclient.execute(targethost, this.lastrequest, session.getContext()); - } + this.lastresponse = httpclient.execute(targethost, this.lastrequest, session.getContext()); if (this.lastresponse == null) throw new HTTPException("HTTPMethod.execute: Response was null"); return this.lastresponse; @@ -422,7 +413,7 @@ protected void configClient(HttpClientBuilder cb, Map settings) th String agent = (String) settings.get(Prop.USER_AGENT); if (agent != null) cb.setUserAgent(agent); - session.setInterceptors(cb); + session.activateInterceptors(cb); session.setContentDecoderRegistry(cb); session.setClientManager(cb, this); session.setRetryHandler(cb); @@ -722,7 +713,7 @@ public HTTPSession getSession() { } public boolean isSessionLocal() { - return this.localsession; + return this.islocalsession; } public boolean hasStreamOpen() { @@ -742,7 +733,7 @@ public HTTPMethod setRange(long lo, long hi) { // Pass thru's to HTTPSession public HTTPMethod setCompression(String compressors) { - this.session.setGlobalCompression(compressors); + this.session.setCompression(compressors); return this; } diff --git a/httpservices/src/main/java/ucar/httpservices/HTTPSession.java b/httpservices/src/main/java/ucar/httpservices/HTTPSession.java index 008a1b927d..f59e850b96 100755 --- a/httpservices/src/main/java/ucar/httpservices/HTTPSession.java +++ b/httpservices/src/main/java/ucar/httpservices/HTTPSession.java @@ -9,7 +9,6 @@ import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.security.KeyManagementException; @@ -26,27 +25,16 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.zip.GZIPInputStream; -import java.util.zip.ZipInputStream; import javax.annotation.concurrent.ThreadSafe; import javax.print.attribute.UnmodifiableSetException; -import org.apache.http.Header; -import org.apache.http.HeaderElement; -import org.apache.http.HttpEntity; -import org.apache.http.HttpException; -import org.apache.http.HttpHost; -import org.apache.http.HttpRequestInterceptor; -import org.apache.http.HttpResponse; -import org.apache.http.HttpResponseInterceptor; + +import org.apache.http.*; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpRequestRetryHandler; import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.DeflateDecompressingEntity; -import org.apache.http.client.entity.GzipDecompressingEntity; import org.apache.http.client.entity.InputStreamFactory; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.socket.ConnectionSocketFactory; @@ -58,7 +46,6 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.protocol.HttpContext; import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.TrustStrategy; @@ -258,57 +245,6 @@ public String getName() { } } - static class GZIPResponseInterceptor implements HttpResponseInterceptor { - public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { - HttpEntity entity = response.getEntity(); - if (entity != null) { - Header ceheader = entity.getContentEncoding(); - if (ceheader != null) { - HeaderElement[] codecs = ceheader.getElements(); - for (HeaderElement h : codecs) { - if (h.getName().equalsIgnoreCase("gzip")) { - response.setEntity(new GzipDecompressingEntity(response.getEntity())); - return; - } - } - } - } - } - } - - static class DeflateResponseInterceptor implements HttpResponseInterceptor { - public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { - HttpEntity entity = response.getEntity(); - if (entity != null) { - Header ceheader = entity.getContentEncoding(); - if (ceheader != null) { - HeaderElement[] codecs = ceheader.getElements(); - for (HeaderElement h : codecs) { - if (h.getName().equalsIgnoreCase("deflate")) { - response.setEntity(new DeflateDecompressingEntity(response.getEntity())); - return; - } - } - } - } - } - } - - static class ZipStreamFactory implements InputStreamFactory { - // InputStreamFactory methods - @Override - public InputStream create(InputStream instream) throws IOException { - return new ZipInputStream(instream, HTTPUtil.UTF8); - } - } - - static class GZIPStreamFactory implements InputStreamFactory { - // InputStreamFactory methods - @Override - public InputStream create(InputStream instream) throws IOException { - return new GZIPInputStream(instream); - } - } //////////////////////////////////////////////////////////////////////// // Static variables @@ -327,19 +263,6 @@ public InputStream create(InputStream instream) throws IOException { // User is responsible for its contents via setCredentials static CredentialsProvider globalprovider = null; - // Define interceptor instances; use copy on write for thread safety - static List reqintercepts = new CopyOnWriteArrayList<>(); - static List rspintercepts = new CopyOnWriteArrayList<>(); - - // This is a hack to suppress content-encoding headers from request - // Effectively final because its set in the static initializer and otherwise - // read only. - protected static HttpResponseInterceptor CEKILL; - - // Debug Header interceptors - protected static List dbgreq = new CopyOnWriteArrayList<>(); - protected static List dbgrsp = new CopyOnWriteArrayList<>(); - protected static HTTPConnections connmgr; protected static Map contentDecoderMap; @@ -355,10 +278,9 @@ public InputStream create(InputStream instream) throws IOException { } else { connmgr = new HTTPConnectionSimple(); } - CEKILL = new HTTPUtil.ContentEncodingInterceptor(); contentDecoderMap = new HashMap<>(); - contentDecoderMap.put("zip", new ZipStreamFactory()); - contentDecoderMap.put("gzip", new GZIPStreamFactory()); + contentDecoderMap.put("zip", new HTTPUtil.ZipStreamFactory()); + contentDecoderMap.put("gzip", new HTTPUtil.GZIPStreamFactory()); globalsettings = new ConcurrentHashMap<>(); setDefaults(globalsettings); authcontrols = new AuthControls(); @@ -603,38 +525,24 @@ public static synchronized Object getGlobalSetting(String key) { ////////////////////////////////////////////////// // Compression - public static synchronized void setGlobalCompression(String compressors) { + public synchronized void setCompression(String compressors) { if (globalsettings.get(Prop.COMPRESSION) != null) { - removeGlobalCompression(); - } - String compresslist = checkCompressors(compressors); - if (HTTPUtil.nullify(compresslist) == null) { - throw new IllegalArgumentException("Bad compressors: " + compressors); - } - globalsettings.put(Prop.COMPRESSION, compresslist); - HttpResponseInterceptor hrsi; - if (compresslist.contains("gzip")) { - hrsi = new GZIPResponseInterceptor(); - rspintercepts.add(hrsi); - } - if (compresslist.contains("deflate")) { - hrsi = new DeflateResponseInterceptor(); - rspintercepts.add(hrsi); - } - } - - public static synchronized void removeGlobalCompression() { - if (globalsettings.remove(Prop.COMPRESSION) != null) { - for (int i = rspintercepts.size() - 1; i >= 0; i--) { // walk backwards - HttpResponseInterceptor hrsi = rspintercepts.get(i); - if (hrsi instanceof GZIPResponseInterceptor || hrsi instanceof DeflateResponseInterceptor) { - rspintercepts.remove(i); - } + if (globalsettings.remove(HTTPSession.Prop.COMPRESSION) != null) { + this.interceptors.removeCompression(); + } + String compresslist = checkCompressors(compressors); + if (HTTPUtil.nullify(compresslist) == null) { + throw new IllegalArgumentException("Bad compressors: " + compressors); } + globalsettings.put(Prop.COMPRESSION, compresslist); + if (compresslist.contains("deflate")) + interceptors.setDeflateCompression(); + if (compresslist.contains("gzip")) + interceptors.setGzipCompression(); } } - protected static synchronized String checkCompressors(String compressors) { + static protected synchronized String checkCompressors(String compressors) { // Syntactic check of compressors Set cset = new HashSet<>(); compressors = compressors.replace(',', ' '); @@ -701,9 +609,6 @@ public static synchronized void setGlobalRetryCount(int n) { protected String identifier = "Session"; protected Map localsettings = new ConcurrentHashMap(); - // We currently only allow the use of global interceptors - // protected List intercepts = new ArrayList(); // current set of interceptors; - // This context is re-used over all method executions so that we maintain // cookies, credentials, etc. // In theory this also supports credentials cache clearing. @@ -712,6 +617,8 @@ public static synchronized void setGlobalRetryCount(int n) { protected URI requestURI = null; // full uri from the HTTPMethod call + protected HTTPIntercepts interceptors = null; + // cached and recreated as needed protected boolean cachevalid = false; // Are cached items up-to-date? protected RequestConfig cachedconfig = null; @@ -750,28 +657,20 @@ protected void init(AuthScope scope, String actualurl) throws HTTPException { } ////////////////////////////////////////////////// - // Interceptors: Only supported at global level + // Accessor(s) - protected static void setInterceptors(HttpClientBuilder cb) { - for (HttpRequestInterceptor hrq : reqintercepts) { - cb.addInterceptorLast(hrq); - } - for (HttpResponseInterceptor hrs : rspintercepts) { - cb.addInterceptorLast(hrs); - } - // Add debug interceptors - for (HttpRequestInterceptor hrq : dbgreq) { - cb.addInterceptorFirst(hrq); - } - for (HttpResponseInterceptor hrs : dbgrsp) { - cb.addInterceptorFirst(hrs); - } - // Hack: add Content-Encoding suppressor - cb.addInterceptorFirst(CEKILL); + public HTTPIntercepts getIntercepts() { + return this.interceptors; } - ////////////////////////////////////////////////// - // Accessor(s) + public HTTPIntercepts.DebugInterceptRequest getDebugRequestInterceptor() { + return this.interceptors.debugRequestInterceptor(); + } + + public synchronized void resetInterceptors() { + if(this.interceptors != null) + this.interceptors.resetInterceptors(); + } public AuthScope getAuthScope() { return this.scope; @@ -1072,6 +971,18 @@ public ImmutableMap getMergedSettings() { return builder.build(); } + public synchronized void setDebugInterceptors() { + if (this.interceptors == null) + this.interceptors = new HTTPIntercepts(); + this.interceptors.addDebugInterceptors(); + } + + public void activateInterceptors(HttpClientBuilder cb) { + if (this.interceptors == null) + this.interceptors = new HTTPIntercepts(); + this.interceptors.activateInterceptors(cb); + } + ////////////////////////////////////////////////// // Utilities @@ -1117,66 +1028,6 @@ protected static synchronized void track(HTTPSession session) { sessionList.add(session); } - public static synchronized void setInterceptors(boolean print) { - if (!TESTING) { - throw new UnsupportedOperationException(); - } - HTTPUtil.InterceptRequest rq = new HTTPUtil.InterceptRequest(); - HTTPUtil.InterceptResponse rs = new HTTPUtil.InterceptResponse(); - rq.setPrint(print); - rs.setPrint(print); - /* remove any previous */ - for (int i = reqintercepts.size() - 1; i >= 0; i--) { - HttpRequestInterceptor hr = reqintercepts.get(i); - if (hr instanceof HTTPUtil.InterceptCommon) { - reqintercepts.remove(i); - } - } - for (int i = rspintercepts.size() - 1; i >= 0; i--) { - HttpResponseInterceptor hr = rspintercepts.get(i); - if (hr instanceof HTTPUtil.InterceptCommon) { - rspintercepts.remove(i); - } - } - reqintercepts.add(rq); - rspintercepts.add(rs); - } - - public static void resetInterceptors() { - if (!TESTING) { - throw new UnsupportedOperationException(); - } - for (HttpRequestInterceptor hri : reqintercepts) { - if (hri instanceof HTTPUtil.InterceptCommon) { - ((HTTPUtil.InterceptCommon) hri).clear(); - } - } - } - - public static HTTPUtil.InterceptRequest debugRequestInterceptor() { - if (!TESTING) { - throw new UnsupportedOperationException(); - } - for (HttpRequestInterceptor hri : reqintercepts) { - if (hri instanceof HTTPUtil.InterceptRequest) { - return ((HTTPUtil.InterceptRequest) hri); - } - } - return null; - } - - public static HTTPUtil.InterceptResponse debugResponseInterceptor() { - if (!TESTING) { - throw new UnsupportedOperationException(); - } - for (HttpResponseInterceptor hri : rspintercepts) { - if (hri instanceof HTTPUtil.InterceptResponse) { - return ((HTTPUtil.InterceptResponse) hri); - } - } - return null; - } - /* Only allow if debugging */ public static void clearkeystore() { if (!TESTING) { @@ -1242,11 +1093,6 @@ public static int getRetryCount() { throw new UnsupportedOperationException(); } - @Deprecated - public static void setGlobalCompression() { - setGlobalCompression("gzip,deflate"); - } - @Deprecated public static void setGlobalProxy(String host, int port) { throw new UnsupportedOperationException("setGlobalProxy: use -D flags"); diff --git a/httpservices/src/main/java/ucar/httpservices/HTTPUtil.java b/httpservices/src/main/java/ucar/httpservices/HTTPUtil.java index 213025a163..afa933265a 100755 --- a/httpservices/src/main/java/ucar/httpservices/HTTPUtil.java +++ b/httpservices/src/main/java/ucar/httpservices/HTTPUtil.java @@ -5,35 +5,20 @@ package ucar.httpservices; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; +import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpEntityEnclosingRequest; -import org.apache.http.HttpException; -import org.apache.http.HttpRequest; -import org.apache.http.HttpRequestInterceptor; -import org.apache.http.HttpResponse; -import org.apache.http.HttpResponseInterceptor; +import java.util.zip.GZIPInputStream; +import java.util.zip.ZipInputStream; +import org.apache.http.client.entity.InputStreamFactory; import org.apache.http.client.utils.URIBuilder; -import org.apache.http.message.BasicHeader; -import org.apache.http.protocol.HttpContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,117 +41,21 @@ enum URIPart { } ////////////////////////////////////////////////// - // Interceptors + // Inner classes - abstract static class InterceptCommon { - private static final Logger logger = LoggerFactory.getLogger(InterceptCommon.class); - - protected HttpContext context = null; - protected List
headers = new ArrayList
(); - protected HttpRequest request = null; - protected HttpResponse response = null; - protected boolean printheaders = false; - - public InterceptCommon setPrint(boolean tf) { - this.printheaders = tf; - return this; - } - - public void clear() { - context = null; - headers.clear(); - request = null; - response = null; - } - - public synchronized HttpRequest getRequest() { - return this.request; - } - - public synchronized HttpResponse getResponse() { - return this.response; - } - - public synchronized HttpContext getContext() { - return this.context; - } - - public synchronized HttpEntity getRequestEntity() { - if (this.request != null && this.request instanceof HttpEntityEnclosingRequest) { - return ((HttpEntityEnclosingRequest) this.request).getEntity(); - } else - return null; - } - - synchronized HttpEntity getResponseEntity() { - if (this.response != null) { - return this.response.getEntity(); - } else - return null; - } - - public synchronized List
getHeaders(String key) { - List
keyh = new ArrayList
(); - for (Header h : this.headers) { - if (h.getName().equalsIgnoreCase(key.trim())) - keyh.add(h); - } - return keyh; - } - - synchronized List
getHeaders() { - return this.headers; - } - - void printHeaders() { - if (this.request != null) { - Header[] hdrs = this.request.getAllHeaders(); - if (hdrs == null) - hdrs = new Header[0]; - logger.debug("Request Headers:"); - for (Header h : hdrs) { - logger.debug(h.toString()); - } - } - if (this.response != null) { - Header[] hdrs = this.response.getAllHeaders(); - if (hdrs == null) - hdrs = new Header[0]; - logger.debug("Response Headers:"); - for (Header h : hdrs) { - logger.debug(h.toString()); - } - } - } - } - - public static class InterceptResponse extends InterceptCommon implements HttpResponseInterceptor { - public synchronized void process(HttpResponse response, HttpContext context) throws HttpException, IOException { - this.response = response; - this.context = context; - if (this.printheaders) - printHeaders(); - else if (this.response != null) { - Header[] hdrs = this.response.getAllHeaders(); - for (int i = 0; i < hdrs.length; i++) { - headers.add(hdrs[i]); - } - } + static class ZipStreamFactory implements InputStreamFactory { + // InputStreamFactory methods + @Override + public InputStream create(InputStream instream) throws IOException { + return new ZipInputStream(instream, HTTPUtil.UTF8); } } - public static class InterceptRequest extends InterceptCommon implements HttpRequestInterceptor { - public synchronized void process(HttpRequest request, HttpContext context) throws HttpException, IOException { - this.request = request; - this.context = context; - if (this.printheaders) - printHeaders(); - else if (this.request != null) { - Header[] hdrs = this.request.getAllHeaders(); - for (int i = 0; i < hdrs.length; i++) { - headers.add(hdrs[i]); - } - } + static class GZIPStreamFactory implements InputStreamFactory { + // InputStreamFactory methods + @Override + public InputStream create(InputStream instream) throws IOException { + return new GZIPInputStream(instream); } } @@ -315,40 +204,6 @@ static URI uriExclude(final URI uri, URIPart... excludes) { } } - /** - * Temporary hack to remove Content-Encoding: XXX-Endian headers - */ - static class ContentEncodingInterceptor extends InterceptCommon implements HttpResponseInterceptor { - public synchronized void process(HttpResponse response, HttpContext context) throws HttpException, IOException { - if (response == null) - return; - Header[] hdrs = response.getAllHeaders(); - if (hdrs == null) - return; - boolean modified = false; - for (int i = 0; i < hdrs.length; i++) { - Header h = hdrs[i]; - if (!h.getName().equalsIgnoreCase("content-encoding")) - continue; - String value = h.getValue(); - if (value.trim().toLowerCase().endsWith("-endian")) { - hdrs[i] = new BasicHeader("X-Content-Encoding", value); - modified = true; - } - } - if (modified) - response.setHeaders(hdrs); - // Similarly, suppress encoding for Entity - HttpEntity entity = response.getEntity(); - if (entity != null) { - Header ceheader = entity.getContentEncoding(); - if (ceheader != null) { - String value = ceheader.getValue(); - } - } - } - } - protected static Map merge(Map globalsettings, Map localsettings) { // merge global and local settings; local overrides global. diff --git a/httpservices/src/main/java/ucar/httpservices/fix b/httpservices/src/main/java/ucar/httpservices/fix deleted file mode 100644 index 62d4a87e51..0000000000 --- a/httpservices/src/main/java/ucar/httpservices/fix +++ /dev/null @@ -1,5 +0,0 @@ -F=`cd ckp2;ls -1|tr '\\r\\n' ' '` -for f in $F ; do - rm -f $f - sed -e 's|ucar[.]httpclient|ucar.httpservices|g' ./$f -done diff --git a/httpservices/src/test/java/ucar/nc2/util/net/TestHTTPSession.java b/httpservices/src/test/java/ucar/nc2/util/net/TestHTTPSession.java index 3e5ed1e79b..7ab6a08845 100755 --- a/httpservices/src/test/java/ucar/nc2/util/net/TestHTTPSession.java +++ b/httpservices/src/test/java/ucar/nc2/util/net/TestHTTPSession.java @@ -88,15 +88,15 @@ public void testAgent() throws Exception { logger.debug("*** URL: {}", TESTURL1); logger.debug("Test: HTTPSession.setGlobalUserAgent({})", GLOBALAGENT); - HTTPSession.setInterceptors(false); HTTPSession.setGlobalUserAgent(GLOBALAGENT); try (HTTPSession session = HTTPFactory.newSession(TESTURL1)) { + session.setDebugInterceptors(); // indicate we want debug intercepts List
agents = null; HTTPMethod method = HTTPFactory.Get(session, TESTURL1); method.execute(); // Use special interface to access the request // Look for the user agent header - agents = HTTPSession.debugRequestInterceptor().getHeaders(HTTPSession.HEADER_USERAGENT); + agents = session.getDebugRequestInterceptor().getHeaders(HTTPSession.HEADER_USERAGENT); Assert.assertFalse("User-Agent Header not found", agents.size() == 0); // It is possible to see multiple same headers, so verify that they have same value String agentvalue = null; @@ -113,12 +113,12 @@ public void testAgent() throws Exception { // method.close(); logger.debug("Test: HTTPSession.setUserAgent({})", SESSIONAGENT); - HTTPSession.resetInterceptors(); + session.resetInterceptors(); session.setUserAgent(SESSIONAGENT); method = HTTPFactory.Get(session, TESTURL1); method.execute(); // Use special interface to access the request - agents = HTTPSession.debugRequestInterceptor().getHeaders(HTTPSession.HEADER_USERAGENT); + agents = session.getDebugRequestInterceptor().getHeaders(HTTPSession.HEADER_USERAGENT); Assert.assertFalse("User-Agent Header not found", agents.size() == 0); agentvalue = null; for (Header h : agents) { diff --git a/netcdf-java-bom/build.gradle b/netcdf-java-bom/build.gradle index 0f33c578d7..400529c0ee 100644 --- a/netcdf-java-bom/build.gradle +++ b/netcdf-java-bom/build.gradle @@ -19,14 +19,12 @@ dependencies { api project(':cdm:cdm-radial') api project(':cdm:cdm-s3') api project(':cdm-test-utils') - api project(':dap4:d4core') - api project(':dap4:d4lib') - api project(':dap4:d4cdm') api project(':grib') api project(':httpservices') api project(':legacy') api project(':netcdf4') api project(':opendap') + api project(':dap4') api project(':udunits') api project(':uibase') api project(':uicdm') diff --git a/netcdf-java-platform/build.gradle b/netcdf-java-platform/build.gradle index 9cbc1a39f6..c10b172e30 100644 --- a/netcdf-java-platform/build.gradle +++ b/netcdf-java-platform/build.gradle @@ -25,7 +25,7 @@ dependencies { api 'org.jdom:jdom2:2.0.6' api 'joda-time:joda-time:2.10.3' // replace by javax.time - // netcdf4, dap4:d4lib + // netcdf4, dap4 // Tricky dependency here. We need to make sure that we keep in-line with the version // that chronicle-map uses in the TDS, or else we see bad things happen on the TDS side. api 'net.java.dev.jna:jna:5.12.1' diff --git a/netcdf4/src/main/java/ucar/nc2/jni/netcdf/Nc4Iosp.java b/netcdf4/src/main/java/ucar/nc2/jni/netcdf/Nc4Iosp.java index 2aa52af3b0..2bcb679edd 100755 --- a/netcdf4/src/main/java/ucar/nc2/jni/netcdf/Nc4Iosp.java +++ b/netcdf4/src/main/java/ucar/nc2/jni/netcdf/Nc4Iosp.java @@ -23,6 +23,7 @@ import ucar.nc2.iosp.hdf4.HdfEos; import ucar.nc2.iosp.hdf5.H5header; import ucar.nc2.ffi.netcdf.NetcdfClibrary; +import ucar.nc2.iosp.netcdf4.Nc4; import ucar.nc2.util.CancelTask; import ucar.nc2.util.DebugFlags; import ucar.nc2.util.EscapeStrings; @@ -60,12 +61,6 @@ public class Nc4Iosp extends AbstractIOServiceProvider implements IOServiceProvi private static Nc4prototypes nc4 = NetcdfClibrary.getForeignFunctionInterface(); - // Define reserved attributes (see Nc4DSP) - public static final String UCARTAGOPAQUE = "_edu.ucar.opaque.size"; - // Not yet implemented - public static final String UCARTAGVLEN = "_edu.ucar.isvlen"; - public static final String UCARTAGORIGTYPE = "_edu.ucar.orig.type"; - // TODO: These flags currently control debug messages that are printed to STDOUT. They ought to be logged to SLF4J. // We could use SLF4J markers to filter which debug-level messages are printed. // See http://stackoverflow.com/questions/12201112/can-i-add-custom-levels-to-slf4j diff --git a/netcdf4/src/test/java/ucar/nc2/jni/netcdf/TestCDF5Reading.java b/netcdf4/src/test/java/ucar/nc2/jni/netcdf/TestCDF5Reading.java index 34a105aabb..8f3b5afa97 100644 --- a/netcdf4/src/test/java/ucar/nc2/jni/netcdf/TestCDF5Reading.java +++ b/netcdf4/src/test/java/ucar/nc2/jni/netcdf/TestCDF5Reading.java @@ -64,12 +64,6 @@ public void testReadSubsection() throws IOException, InvalidRangeException { try (NetcdfFile jni = openJni(location)) { jni.setLocation(location + " (jni)"); Array data = read(jni, "f4", "0:2"); - if (prop_visual) { - String dump = Ncdump.printArray(data); - logger.debug(dump); - String testresult = dump.replace('r', ' ').replace('\n', ' ').trim(); - visual("CDF Read", testresult); - } Assert.assertTrue("***Fail: data mismatch", MAMath.nearlyEquals(data, BASELINE)); System.err.println("***Pass"); } diff --git a/opendap/src/test/data/baseline1/fix b/opendap/src/test/data/baseline1/fix deleted file mode 100644 index 8789443319..0000000000 --- a/opendap/src/test/data/baseline1/fix +++ /dev/null @@ -1,84 +0,0 @@ -F="123.nc.das \ -123bears.nc.das \ -1990-S1700101.HDF.WVC_Lat.das \ -1998-6-avhrr.dat.das \ -D1.das \ -Drifters.das \ -EOSDB.das \ -NestedSeq.das \ -NestedSeq2.das \ -OverideExample.das \ -SimpleDrdsExample.das \ -b31.das \ -b31a.das \ -bears.nc.das \ -ber-2002-10-01.nc.das \ -ce.NAM_CONUS_12km_20100628_1200.grib2.01.das \ -ceopL2AIRS2-2.nc.das \ -ceopL2AIRS2.nc.das \ -ingrid.das \ -nestedDAS.das \ -pbug0001b.das \ -synth1.das \ -synth3.das \ -synth4.das \ -synth5.das \ -test.01.das \ -test.02.das \ -test.03.das \ -test.04.das \ -test.05.das \ -test.06.das \ -test.06a.das \ -test.07.das \ -test.07a.das \ -test.21.das \ -test.22.das \ -test.23.das \ -test.31.das \ -test.32.das \ -test.50.das \ -test.53.das \ -test.55.das \ -test.56.das \ -test.57.das \ -test.66.das \ -test.67.das \ -test.68.das \ -test.69.das \ -test.PointFile.das \ -test.SwathFile.das \ -test.an1.das \ -test.dfp1.das \ -test.dfr1.das \ -test.dfr2.das \ -test.dfr3.das \ -test.gr1.das \ -test.gr2.das \ -test.gr3.das \ -test.gr4.das \ -test.gr5.das \ -test.sds1.das \ -test.sds2.das \ -test.sds3.das \ -test.sds4.das \ -test.sds5.das \ -test.sds6.das \ -test.sds7.das \ -test.vs1.das \ -test.vs2.das \ -test.vs3.das \ -test.vs4.das \ -test.vs5.das \ -test1.das \ -test2.das \ -test3.das \ -whoi.das" - -for f in $F ; do - rm -f ./$f - sed -e 's/\\\\/\\/g' ./$f -done -exit - - diff --git a/opendap/src/test/data/testdata1/fix b/opendap/src/test/data/testdata1/fix deleted file mode 100755 index 8789443319..0000000000 --- a/opendap/src/test/data/testdata1/fix +++ /dev/null @@ -1,84 +0,0 @@ -F="123.nc.das \ -123bears.nc.das \ -1990-S1700101.HDF.WVC_Lat.das \ -1998-6-avhrr.dat.das \ -D1.das \ -Drifters.das \ -EOSDB.das \ -NestedSeq.das \ -NestedSeq2.das \ -OverideExample.das \ -SimpleDrdsExample.das \ -b31.das \ -b31a.das \ -bears.nc.das \ -ber-2002-10-01.nc.das \ -ce.NAM_CONUS_12km_20100628_1200.grib2.01.das \ -ceopL2AIRS2-2.nc.das \ -ceopL2AIRS2.nc.das \ -ingrid.das \ -nestedDAS.das \ -pbug0001b.das \ -synth1.das \ -synth3.das \ -synth4.das \ -synth5.das \ -test.01.das \ -test.02.das \ -test.03.das \ -test.04.das \ -test.05.das \ -test.06.das \ -test.06a.das \ -test.07.das \ -test.07a.das \ -test.21.das \ -test.22.das \ -test.23.das \ -test.31.das \ -test.32.das \ -test.50.das \ -test.53.das \ -test.55.das \ -test.56.das \ -test.57.das \ -test.66.das \ -test.67.das \ -test.68.das \ -test.69.das \ -test.PointFile.das \ -test.SwathFile.das \ -test.an1.das \ -test.dfp1.das \ -test.dfr1.das \ -test.dfr2.das \ -test.dfr3.das \ -test.gr1.das \ -test.gr2.das \ -test.gr3.das \ -test.gr4.das \ -test.gr5.das \ -test.sds1.das \ -test.sds2.das \ -test.sds3.das \ -test.sds4.das \ -test.sds5.das \ -test.sds6.das \ -test.sds7.das \ -test.vs1.das \ -test.vs2.das \ -test.vs3.das \ -test.vs4.das \ -test.vs5.das \ -test1.das \ -test2.das \ -test3.das \ -whoi.das" - -for f in $F ; do - rm -f ./$f - sed -e 's/\\\\/\\/g' ./$f -done -exit - - diff --git a/settings.gradle b/settings.gradle index ab30ed709e..e6d0ff747b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,10 +11,6 @@ include 'cdm:s3' include 'cdm:zarr' include 'cdm-test' include 'cdm-test-utils' -include 'dap4:d4core' -include 'dap4:d4lib' -include 'dap4:d4cdm' -include 'dap4:d4tests' include 'docs' include 'grib' include 'httpservices' @@ -24,6 +20,7 @@ include 'netcdf-java-bom' include 'netcdf-java-platform' include 'netcdf-java-testing-platform' include 'opendap' +include 'dap4' include 'udunits' include 'uibase' include 'uicdm' diff --git a/uicdm/build.gradle b/uicdm/build.gradle index cfe13a028a..d8480ec89f 100644 --- a/uicdm/build.gradle +++ b/uicdm/build.gradle @@ -18,11 +18,11 @@ dependencies { compile project(':cdm:cdm-misc') // misc iosps compile project(':cdm:cdm-radial') // radial data compile project(':bufr') - compile project(':dap4:d4cdm') compile project(':grib') compile project(':httpservices') compile project(':netcdf4') compile project(':opendap') + compile project(':dap4') compile project(':uibase') compile project(':visad:cdm-mcidas') // For Gempak IOSPs. compile project(':waterml') diff --git a/uicdm/src/main/java/ucar/nc2/ui/ToolsUI.java b/uicdm/src/main/java/ucar/nc2/ui/ToolsUI.java index d93ad97829..aacde4acc0 100644 --- a/uicdm/src/main/java/ucar/nc2/ui/ToolsUI.java +++ b/uicdm/src/main/java/ucar/nc2/ui/ToolsUI.java @@ -1458,7 +1458,6 @@ public static void main(String[] args) { for (String arg : args) { System.out.println(" " + arg); } - HTTPSession.setInterceptors(true); } // handle multiple versions of ToolsUI, along with passing a dataset name @@ -1505,7 +1504,6 @@ public void setMessage(SocketMessage.Event event) { for (String arg : args) { System.out.println(" " + arg); } - HTTPSession.setInterceptors(true); } // look for command-line arguments