public class ProductManager extends Object
Product
. ProductListeners can be added to inform if a
Product
was added or removed.Modifier and Type | Class and Description |
---|---|
static class |
ProductManager.Event
An event object passed into the
ProductManager.Listener methods. |
static interface |
ProductManager.Listener
A listener for the product manager.
|
Constructor and Description |
---|
ProductManager()
Constructs an product manager with an empty list of products.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(ProductManager.Listener listener)
Adds a
ProductManagerListener to this product manager. |
void |
addProduct(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.
|
boolean |
contains(Product product)
Tests whether the given product is contained in this list.
|
boolean |
containsProduct(String name)
Tests whether a product with the given name is contained in this list.
|
Product |
getProduct(int index)
Gets the product at the given index.
|
Product |
getProduct(String name) |
Product |
getProductByDisplayName(String displayName) |
Product |
getProductByRefNo(int refNo) |
int |
getProductCount() |
String[] |
getProductDisplayNames()
Returns the display names of all products currently managed.
|
int |
getProductIndex(Product product) |
String[] |
getProductNames()
Returns the names of all products currently managed.
|
Product[] |
getProducts()
Returns an array of all products currently managed.
|
void |
removeAllProducts()
Removes all product from this list.
|
boolean |
removeListener(ProductManager.Listener listener)
Removes a
ProductManagerListener from this product manager. |
boolean |
removeProduct(Product product)
Removes the given product from this product manager if it exists.
|
public ProductManager()
public int getProductCount()
public Product getProduct(int index)
index
- the indexpublic String[] getProductDisplayNames()
null
, but the array can have zero lengthProductNode.getDisplayName()
public String[] getProductNames()
null
, but the array can have zero lengthpublic Product[] getProducts()
null
, but the array can have zero lengthpublic Product getProductByDisplayName(String displayName)
displayName
- The product's display name.public Product getProductByRefNo(int refNo)
refNo
- The reference number.public Product getProduct(String name)
name
- The product name.public int getProductIndex(Product product)
public boolean containsProduct(String name)
name
- the product namepublic boolean contains(Product product)
product
- The product.true
if so.public void addProduct(Product product)
product
- the product to be added, ignored if null
public boolean removeProduct(Product product)
product
- the product to be removed, ignored if null
public void removeAllProducts()
public boolean addListener(ProductManager.Listener listener)
ProductManagerListener
to this product manager. The ProductManagerListener
is
informed each time a product was added or removed.listener
- the listener to be added.public boolean removeListener(ProductManager.Listener listener)
ProductManagerListener
from this product manager.listener
- The listener.Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.