@Test public void testTargetS2BandNameMatches() throws Exception { String targetBandName = "taur_01"; assertFalse(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.TAUR_PATTERN)); targetBandName = "taur_B1"; assertTrue(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.TAUR_PATTERN)); targetBandName = "rBRR_09"; assertFalse(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.R_BRR_PATTERN)); targetBandName = "rBRR_B9"; assertTrue(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.R_BRR_PATTERN)); targetBandName = "rtoa_ng_8A"; assertFalse(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.RTOA_NG_PATTERN)); targetBandName = "rtoa_ng_B8A"; assertTrue(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.RTOA_NG_PATTERN)); targetBandName = "rtoa_12"; assertFalse(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.RTOA_PATTERN)); targetBandName = "rtoa_B12"; assertTrue(S2Utils.targetS2BandNameMatches(targetBandName, RayleighCorrectionOp.RTOA_PATTERN)); }
static boolean targetS2BandNameMatches(String targetBandName, String pattern) { String s2Pattern; if (targetBandName.indexOf("_B") == targetBandName.length() - 3) { s2Pattern = pattern.replace("\\d{2}", "B\\d{1}"); } else { s2Pattern = pattern.replace("\\d{2}", "B\\d{2}"); } final String patternPrefix = pattern.substring(0, pattern.length() - 5); if (targetBandName.endsWith("8A")) { return targetBandName.equals(patternPrefix + "B8A"); } else { return targetBandName.matches(s2Pattern); } }
S2Utils { static boolean targetS2BandNameMatches(String targetBandName, String pattern) { String s2Pattern; if (targetBandName.indexOf("_B") == targetBandName.length() - 3) { s2Pattern = pattern.replace("\\d{2}", "B\\d{1}"); } else { s2Pattern = pattern.replace("\\d{2}", "B\\d{2}"); } final String patternPrefix = pattern.substring(0, pattern.length() - 5); if (targetBandName.endsWith("8A")) { return targetBandName.equals(patternPrefix + "B8A"); } else { return targetBandName.matches(s2Pattern); } } }
S2Utils { static boolean targetS2BandNameMatches(String targetBandName, String pattern) { String s2Pattern; if (targetBandName.indexOf("_B") == targetBandName.length() - 3) { s2Pattern = pattern.replace("\\d{2}", "B\\d{1}"); } else { s2Pattern = pattern.replace("\\d{2}", "B\\d{2}"); } final String patternPrefix = pattern.substring(0, pattern.length() - 5); if (targetBandName.endsWith("8A")) { return targetBandName.equals(patternPrefix + "B8A"); } else { return targetBandName.matches(s2Pattern); } }  }
S2Utils { static boolean targetS2BandNameMatches(String targetBandName, String pattern) { String s2Pattern; if (targetBandName.indexOf("_B") == targetBandName.length() - 3) { s2Pattern = pattern.replace("\\d{2}", "B\\d{1}"); } else { s2Pattern = pattern.replace("\\d{2}", "B\\d{2}"); } final String patternPrefix = pattern.substring(0, pattern.length() - 5); if (targetBandName.endsWith("8A")) { return targetBandName.equals(patternPrefix + "B8A"); } else { return targetBandName.matches(s2Pattern); } }   }
S2Utils { static boolean targetS2BandNameMatches(String targetBandName, String pattern) { String s2Pattern; if (targetBandName.indexOf("_B") == targetBandName.length() - 3) { s2Pattern = pattern.replace("\\d{2}", "B\\d{1}"); } else { s2Pattern = pattern.replace("\\d{2}", "B\\d{2}"); } final String patternPrefix = pattern.substring(0, pattern.length() - 5); if (targetBandName.endsWith("8A")) { return targetBandName.equals(patternPrefix + "B8A"); } else { return targetBandName.matches(s2Pattern); } }    }