Package org.esa.snap.core.datamodel
Class ProductManager
java.lang.Object
org.esa.snap.core.datamodel.ProductManager
A type-safe container for elements of the type
Product. ProductListeners can be added to inform if a
Product was added or removed.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn event object passed into theProductManager.Listenermethods.static interfaceA listener for the product manager. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an product manager with an empty list of products. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(ProductManager.Listener listener) Adds aProductManagerListenerto this product manager.voidaddProduct(Product product) Adds the given product to this product manager if it does not already exists and sets it's reference number one biger than the greatest reference number in this product manager.booleanTests whether the given product is contained in this list.booleancontainsProduct(String name) Tests whether a product with the given name is contained in this list.getProduct(int index) Gets the product at the given index.getProduct(String name) getProductByDisplayName(String displayName) getProductByRefNo(int refNo) intString[]Returns the display names of all products currently managed.intgetProductIndex(Product product) String[]Returns the names of all products currently managed.Product[]Returns an array of all products currently managed.voidRemoves all product from this list.booleanremoveListener(ProductManager.Listener listener) Removes aProductManagerListenerfrom this product manager.booleanremoveProduct(Product product) Removes the given product from this product manager if it exists.
-
Constructor Details
-
ProductManager
public ProductManager()Constructs an product manager with an empty list of products.
-
-
Method Details
-
getProductCount
public int getProductCount()- Returns:
- The number of products in this product manager.
-
getProduct
Gets the product at the given index.- Parameters:
index- the index- Returns:
- The product at the given index.
-
getProductDisplayNames
Returns the display names of all products currently managed.- Returns:
- an array containing the display names, never
null, but the array can have zero length - See Also:
-
getProductNames
Returns the names of all products currently managed.- Returns:
- an array containing the names, never
null, but the array can have zero length
-
getProducts
Returns an array of all products currently managed.- Returns:
- an array containing the products, never
null, but the array can have zero length
-
getProductByDisplayName
- Parameters:
displayName- The product's display name.- Returns:
- The product with the given display name.
-
getProductByRefNo
- Parameters:
refNo- The reference number.- Returns:
- The product with the given reference number.
-
getProduct
- Parameters:
name- The product name.- Returns:
- The product with the given name.
-
getProductIndex
-
containsProduct
Tests whether a product with the given name is contained in this list.- Parameters:
name- the product name- Returns:
- true, if so
-
contains
Tests whether the given product is contained in this list.- Parameters:
product- The product.- Returns:
trueif so.
-
addProduct
Adds the given product to this product manager if it does not already exists and sets it's reference number one biger than the greatest reference number in this product manager.- Parameters:
product- the product to be added, ignored ifnull
-
removeProduct
Removes the given product from this product manager if it exists.- Parameters:
product- the product to be removed, ignored ifnull- Returns:
- true, if the product was removed
-
removeAllProducts
public void removeAllProducts()Removes all product from this list. -
addListener
Adds aProductManagerListenerto this product manager. TheProductManagerListeneris informed each time a product was added or removed.- Parameters:
listener- the listener to be added.- Returns:
- true if the listener was added, otherwise false.
-
removeListener
Removes aProductManagerListenerfrom this product manager.- Parameters:
listener- The listener.- Returns:
- true, if the listener was removed, otherwise false.
-