private static String[] createOutputFeatureNames(String targetName, String[] setVarNames) { if (StringUtils.isNullOrEmpty(targetName)) { throw new IllegalArgumentException("targetName must not be empty"); } String[] featureNames = new String[setVarNames.length + 2]; featureNames[0] = targetName + "_max"; featureNames[1] = targetName + "_mjd"; System.arraycopy(setVarNames, 0, featureNames, 2, setVarNames.length); return featureNames; }
public boolean hasWorkaround(String variableName, DataType dataType) { if (StringUtils.isNullOrEmpty(variableName) || dataType == null) { return false; } NameTypePair nameTypePair = new NameTypePair(variableName, dataType); return workaroundMap.containsKey(nameTypePair); }
public String getMaskExpr() { final String propertyValue = getPropertyValue(PROPERTY_KEY_MASK_EXPR); if (StringUtils.isNullOrEmpty(propertyValue)) { return "true"; } return propertyValue; }
@Override public boolean accept(OpendapLeaf leaf) { String text = expressionTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { return true; } text = text.replace("*", ".*").toLowerCase(); Pattern pattern = Pattern.compile(text); final Matcher matcher = pattern.matcher(leaf.getName().toLowerCase()); return matcher.matches(); }
public int getRasterDataType(String variableName, DataType dataType) { if (StringUtils.isNullOrEmpty(variableName) || dataType == null) { throw new IllegalArgumentException(); } NameTypePair nameTypePair = new NameTypePair(variableName, dataType); return workaroundMap.get(nameTypePair); }
private void assertParameterBandNameValid(String parameterValue, String parameterName) { if (StringUtils.isNullOrEmpty(parameterValue)) { throw new OperatorException(String.format("Parameter '%s' not specified", parameterName)); } }
static ReprocessingVersion detectReprocessingVersion(String calibrationFileName, boolean isReduced) { if (StringUtils.isNullOrEmpty(calibrationFileName)) { return ReprocessingVersion.AUTO_DETECT; } final String parsedDate = calibrationFileName.substring(14, 22); final int date = Integer.parseInt(parsedDate); if (isReduced) { return getReprocessingVersion(date, REPRO2_RR_START_DATE, REPRO3_RR_START_DATE); } else { return getReprocessingVersion(date, REPRO2_FR_START_DATE, REPRO3_FR_START_DATE); } }
public void careForEmptyLines(Object value, JTextArea textArea) { if (StringUtils.isNullOrEmpty(value.toString())) { // imbecile code, but necessary in order to show empty lines textArea.setText("____"); textArea.setForeground(textArea.getBackground()); } } };
@Override public String getProductName() throws IOException { if (StringUtils.isNullOrEmpty(ecsCoreString)) { readEcsCoreString(); } final String productName = ModisUtils.extractValueForKey(ecsCoreString, ModisConstants.LOCAL_GRANULEID_KEY); if (StringUtils.isNullOrEmpty(productName)) { throw new ProductIOException("Unknown MODIS format: ECSCore metadata field '" + ModisConstants.LOCAL_GRANULEID_KEY + "' missing"); } return FileUtils.getFilenameWithoutExtension(new File(productName)); }
@Override public boolean canTransferMask(Mask mask, Product product) { final String rasterName = getRasterName(mask); return !StringUtils.isNullOrEmpty(rasterName) && product.containsRasterDataNode(rasterName); }
@Override public void aggregateMetadata(MetadataElement processingGraphElement) { String productName = Utilities.extractProductName(processingGraphElement); if (StringUtils.isNullOrEmpty(productName)) { productName = "unknown"; } aggregate(productName, processingGraphElement); }
@Override public void aggregateMetadata(MetadataElement processingGraphElement) { String productName = Utilities.extractProductName(processingGraphElement); if (StringUtils.isNullOrEmpty(productName)) { productName = "unknown"; } aggregate(productName); }
@Override public void aggregateMetadata(MetadataElement processingGraphElement) { String productName = Utilities.extractProductName(processingGraphElement); if (StringUtils.isNullOrEmpty(productName)) { productName = "unknown"; } aggregate(productName, processingGraphElement); }
private static int[] getHistogramBins(Element bandStatisticsElem) { final String histogramValues = bandStatisticsElem.getChildTextTrim(DimapProductConstants.TAG_HISTOGRAM); if (StringUtils.isNullOrEmpty(histogramValues)) { return null; } return StringUtils.toIntArray(histogramValues, null); }
private ProductData.UTC getSceneRasterStopTime() { final Element child = getRootElement().getChild(DimapProductConstants.TAG_PRODUCTION); String timeString = child.getChildTextTrim(DimapProductConstants.TAG_PRODUCT_SCENE_RASTER_STOP_TIME); if (StringUtils.isNullOrEmpty(timeString)) { timeString = child.getChildTextTrim(DimapProductConstants.TAG_OLD_SCENE_RASTER_STOP_TIME); } return parseTimeString(timeString); }
private ProductData.UTC getSceneRasterStartTime() { final Element child = getRootElement().getChild(DimapProductConstants.TAG_PRODUCTION); String timeString = child.getChildTextTrim(DimapProductConstants.TAG_PRODUCT_SCENE_RASTER_START_TIME); if (StringUtils.isNullOrEmpty(timeString)) { timeString = child.getChildTextTrim(DimapProductConstants.TAG_OLD_SCENE_RASTER_START_TIME); } return parseTimeString(timeString); }
static String extractProductName(Product product) { String productName; final MetadataElement processingGraphElement = getProcessingGraphElement(product); productName = extractProductName(processingGraphElement); if (StringUtils.isNullOrEmpty(productName)) { productName = product.getName(); } return productName; }
public void testNullOrEmpty() { assertEquals(true, StringUtils.isNullOrEmpty(null)); assertEquals(true, StringUtils.isNullOrEmpty("")); assertEquals(false, StringUtils.isNullOrEmpty("a")); }
private void readHdfEosStructMeta() throws IOException { final Variable structMetaVariable = netCDFVariables.get(ModisConstants.STRUCT_META_KEY); if (structMetaVariable == null) { throw new ProductIOException("Unknown MODIS format: no StructMetadata available"); } final String structMetaString = structMetaVariable.readScalarString(); if (StringUtils.isNullOrEmpty(structMetaString)) { throw new ProductIOException("Unknown MODIS format: no StructMetadata available"); } hdfEosStructMetadata = new HdfEosStructMetadata(structMetaString); }
private void handleMaskAdded(ProductNodeEvent event) { // TODO - move code to where masks are created final Mask mask = (Mask) event.getSourceNode(); if (StringUtils.isNullOrEmpty(mask.getDescription()) && mask.getImageType() == Mask.BandMathsType.INSTANCE) { String expression = Mask.BandMathsType.getExpression(mask); mask.setDescription(getSuitableBitmaskDefDescription(expression)); } }