HistogramPanelModel { public void removeStxFromProduct(Product product) { List<HistogramConfig> toRemove = new ArrayList<>(7); for (HistogramConfig histogramConfig : stxMap.keySet()) { if (histogramConfig.raster.getProduct() == product) { toRemove.add(histogramConfig); } } for (HistogramConfig histogramConfig : toRemove) { stxMap.remove(histogramConfig); } }  boolean hasStx(HistogramConfig config); Stx getStx(HistogramConfig config); void setStx(HistogramConfig config, Stx stx); void removeStxFromProduct(Product product); void removeStx(HistogramConfig histogramPlotConfig);  }
@Test public void testRemoveStxFromProduct() throws Exception { HistogramPanelModel model = new HistogramPanelModel(); Band band = new Band("name", ProductData.TYPE_UINT32, 10, 10); Product product = new Product("dummy", "dummy", 10, 10); product.addBand(band); HistogramPanelModel.HistogramConfig config = new HistogramPanelModel.HistogramConfig( band, "Roy Mask", 10, true ); model.setStx(config, arbitraryStx()); assertTrue(model.hasStx(config)); model.removeStxFromProduct(product); assertFalse(model.hasStx(config)); }