/** * @return The number of products in this product manager. */ public int getProductCount() { return productList.size(); }
/** * @return The number of product nodes in this product group. */ public int getNodeCount() { return nodeList.size(); }
public NewProductDialog(Window parent, ProductNodeList<Product> sourceProducts, final int selectedSourceIndex, boolean sourceProductOwner, String prefix) { super(parent, "New Product", ModalDialog.ID_OK_CANCEL, null); /* I18N */ Guardian.assertNotNull("sourceProducts", sourceProducts); Guardian.assertGreaterThan("sourceProducts.size()", sourceProducts.size(), 0); this.sourceProducts = sourceProducts; selectedProductIndex = selectedSourceIndex; this.parent = parent; this.prefix = prefix; this.sourceProductOwner = sourceProductOwner; }
/** * Gets the index of the node with the given name. The method performs a case insensitive search. * * @param name the name of the node, must not be <code>null</code> * * @return the index of the node with the given name or <code>-1</code> if a node with the given name is not * contained in this list * * @throws IllegalArgumentException if the name is <code>null</code> */ public final int indexOf(String name) { Guardian.assertNotNull("name", name); int n = size(); for (int i = 0; i < n; i++) { if (getAt(i).getName().equalsIgnoreCase(name)) { return i; } } return -1; }
private Product[] getCompatibleProducts() { List<Product> compatibleProducts = new ArrayList<Product>(productsList.size()); compatibleProducts.add(targetProduct); final float geolocationEps = getGeolocationEps(); Debug.trace("BandMathsDialog.geolocationEps = " + geolocationEps); Debug.trace("BandMathsDialog.getCompatibleProducts:"); Debug.trace(" comparing: " + targetProduct.getName()); for (int i = 0; i < productsList.size(); i++) { final Product product = productsList.getAt(i); if (targetProduct != product) { Debug.trace(" with: " + product.getDisplayName()); final boolean isCompatibleProduct = targetProduct.isCompatibleProduct(product, geolocationEps); Debug.trace(" result: " + isCompatibleProduct); if (isCompatibleProduct) { compatibleProducts.add(product); } } } return compatibleProducts.toArray(new Product[compatibleProducts.size()]); }
/** * Releases all of the resources used by this object instance and all of its owned children. Its primary use is to * allow the garbage collector to perform a vanilla job. * <p/> * <p>This method should be called only if it is for sure that this object instance will never be used again. The * results of referencing an instance of this class after a call to <code>dispose()</code> are undefined. */ public final void dispose() { for (int i = 0; i < size(); i++) { getAt(i).dispose(); } removeAll(); disposeRemovedList(); }
/** * Creates a subset of this list using the given filter. * * @param filter the product node filter to be used, if <code>null</code> a clone of this list is created * * @return the subset */ public ProductNodeList<T> createSubset(ProductNodeFilter<T> filter) { ProductNodeList<T> list = new ProductNodeList<T>(); for (int i = 0; i < size(); i++) { T node = getAt(i); if (filter.accept(node)) { list.add(node); } } return list; }
public void testAddAndRemoveAndSize() { assertEquals(_nodeList.size(), 0); _nodeList.add(_attribute1); assertEquals(_nodeList.size(), 1); _nodeList.add(_attribute2); assertEquals(_nodeList.size(), 2); _nodeList.add(_attribute3); assertEquals(_nodeList.size(), 3); _nodeList.add(_attribute4); assertEquals(_nodeList.size(), 4); _nodeList.remove(_attribute1); assertEquals(_nodeList.size(), 3); _nodeList.removeAll(); assertEquals(_nodeList.size(), 0); }
public BandMathsDialog(final VisatApp visatApp, Product currentProduct, ProductNodeList<Product> productsList, String helpId) { super(visatApp.getMainFrame(), "Band Maths", ID_OK_CANCEL_HELP, helpId); /* I18N */ Guardian.assertNotNull("currentProduct", currentProduct); Guardian.assertNotNull("productsList", productsList); Guardian.assertGreaterThan("productsList must be not empty", productsList.size(), 0); this.visatApp = visatApp; targetProduct = currentProduct; this.productsList = productsList; bindingContext = createBindingContext(); makeUI(); }
} else { if (metadataRoot != null) { final MetadataElement[] elementsArray = new MetadataElement[metadataElementBackup.size()]; metadataElementBackup.toArray(elementsArray); for (final MetadataElement metadataElement : elementsArray) {