Added containsProduct in Storage.
This commit is contained in:
parent
ad71021bd5
commit
d045767027
@ -76,6 +76,17 @@ public class Storage
|
||||
return products.contains(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether storage contains provided product
|
||||
* @param name name of product to check
|
||||
* @param type type of product to check
|
||||
* @return true if contains, false if not
|
||||
*/
|
||||
public boolean containsProduct(String name, ProductType type)
|
||||
{
|
||||
return this.getProduct(name,type) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes provided product from storage if storage contains this product. (Removes only first found)
|
||||
* @param product product to remove
|
||||
@ -94,8 +105,7 @@ public class Storage
|
||||
public void doAction(ProductOperationType action, Product product) throws IllegalCallerException
|
||||
{
|
||||
if (action.getNode().equals(this.storageOwner.getNodeType()))
|
||||
new Action(this.storageOwner, this.getProduct(product.getName(), product.getProductType()), action);
|
||||
//new Action(this.storageOwner, product, action); //todo má se zpracovat produkt co přichází nebo na jeho základě najít tento produkt ve skladu a ten zpracovat???
|
||||
new Action(this.storageOwner, product, action);
|
||||
else
|
||||
throw new IllegalCallerException("! IllegalCallerException in NodeBase. " + this.storageOwner.getNodeType().toString() + " cannot do action available only for " + action.getNode());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user