BandMathsOp extends Operator { @Deprecated public static BandMathsOp createBooleanExpressionBand(String expression, Product sourceProduct) { BandDescriptor bandDescriptor = new BandDescriptor(); bandDescriptor.name = "band1"; bandDescriptor.expression = expression; bandDescriptor.type = ProductData.TYPESTRING_INT8; BandMathsOp bandMathsOp = new BandMathsOp(); bandMathsOp.setParameterDefaultValues(); bandMathsOp.setSourceProduct(sourceProduct); bandMathsOp.setTargetBandDescriptors(bandDescriptor); return bandMathsOp; } BandMathsOp(); BandDescriptor[] getTargetBandDescriptors(); void setTargetBandDescriptors(BandDescriptor... targetBandDescriptors); Variable[] getVariables(); void setVariables(Variable... variables); @Override void initialize(); @Override void computeTile(Band band, Tile targetTile, ProgressMonitor pm); @Deprecated static BandMathsOp createBooleanExpressionBand(String expression, Product sourceProduct);  }
@Test public void testSimplestCaseWithFactoryMethod() throws Exception { Product sourceProduct = createTestProduct(4, 4); BandMathsOp bandMathsOp = createBooleanExpressionBand(sourceProduct, "band1 > 0"); assertNotNull(bandMathsOp); Product targetProduct = bandMathsOp.getTargetProduct(); assertNotNull(targetProduct); Band band = targetProduct.getBandAt(0); assertNotNull(band); assertEquals(ProductData.TYPE_INT8, band.getDataType()); int[] intValues = new int[16]; band.readPixels(0, 0, 4, 4, intValues, ProgressMonitor.NULL); int[] expectedValues = new int[16]; Arrays.fill(expectedValues, 1); assertTrue(Arrays.equals(expectedValues, intValues)); }