HicoFilename { static HicoFilename create(String filename) { Matcher partMatcher = PARTS_PATTERN.matcher(filename); if (partMatcher.matches()) { try { String collectionDateString = partMatcher.group(1); String processingLevel = partMatcher.group(2); String target = partMatcher.group(3); String processingVersion = partMatcher.group(4); String sceneID = partMatcher.group(5); String l0DateString = partMatcher.group(6); String spatialResolution = partMatcher.group(7); String fileType = partMatcher.group(8); Date collectionDate = COLLECTION_DATE_FORMAT.parse(collectionDateString); ProductData.UTC acquisitionUTC = ProductData.UTC.create(collectionDate, 0L); Date l0Date = L0_DATE_FORMAT.parse(l0DateString); ProductData.UTC l0UTC = ProductData.UTC.create(l0Date, 0L); String productBase = "iss." + collectionDateString + "." + processingLevel + "." + target + "." + processingVersion + "." + sceneID + "." + l0DateString + "." + spatialResolution + "."; return new HicoFilename(acquisitionUTC, l0UTC, processingLevel, processingVersion, target, sceneID, spatialResolution, fileType, productBase); } catch (ParseException ignore) { Debug.trace(ignore); } } return null; } HicoFilename(ProductData.UTC acquisitionUTC, ProductData.UTC l0UTC,
                 String processingLevel, String processingVersion,
                 String target, String sceneID, String spatialResolution, String fileType, String productBase); ProductData.UTC getAcquisitionUTC(); ProductData.UTC getL0UTC(); String getProcessingLevel(); String getProcessingVersion(); String getTarget(); String getSceneID(); String getSpatialResolution(); String getFileType(); String getProductBase(); @Override String toString(); File[] findAllHdrs(File parentFile);  }
@Test public void testCreate() throws Exception { HicoFilename hicoFilename = HicoFilename.create("iss.2011246.0903.143918.L1B.LakeSchaalsee.v03.7863.20110906143420.100m.hico.hdr"); assertNotNull(hicoFilename); assertEquals("03-SEP-2011 14:39:18.000000", hicoFilename.getAcquisitionUTC().format()); assertEquals("06-SEP-2011 14:34:20.000000", hicoFilename.getL0UTC().format()); assertEquals("hico", hicoFilename.getFileType()); assertEquals("L1B", hicoFilename.getProcessingLevel()); assertEquals("v03", hicoFilename.getProcessingVersion()); assertEquals("7863", hicoFilename.getSceneID()); assertEquals("100m", hicoFilename.getSpatialResolution()); assertEquals("LakeSchaalsee", hicoFilename.getTarget()); assertEquals("iss.2011246.0903.143918.L1B.LakeSchaalsee.v03.7863.20110906143420.100m.", hicoFilename.getProductBase()); }