X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjshopcore%2Fmodel%2Fbasket%2FBasket.java;h=28d1eeb2735d84bf428598fc15b48c48b9b79068;hb=672084ab2c551cbff8c8c424780ed344f7c13925;hp=72d9e07fb5d1f519a8c7d330abb99856a00b8d06;hpb=96cf8e7324d3dc8d33eb1cad3e0cc17ec76977ae;p=jcustomer-core.git diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index 72d9e07..28d1eeb 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -17,61 +17,65 @@ package org.mxchange.jshopcore.model.basket; import java.io.Serializable; -import java.util.Map; +import java.util.List; +import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException; /** * An interface for baskets - * - * @author Roland Haeder + *

+ * @author Roland Haeder * @param Any addable basket items */ public interface Basket extends Serializable { /** * Adds given item instance to this basket + *

* @param item Item instance to add + * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException + * If the item instance has already been added */ - public void addItem (final T item); - - /** - * Checks whether the given item as already been added. If the product's - * item id number was found in basket, the corresponding item instance will be set - * - * @param item Item instance to check - * @return Whether the given item has been found - */ - public boolean isAdded (final T item); - - /** - * Checks if the basket is empty - * - * @return Whether the basket is empty - */ - public boolean isEmpty (); + public void addItem (final T item) throws BasketItemAlreadyAddedException; /** - * Initializes this instance with given ServletContext + * Clears the basket instance */ - public void init (); + public void clear (); /** * Some "getter" for all entries in this basket - * + *

* @return Map on all basket items */ - public Map getAll (); + public List getAll (); /** * Getter for last entry - * + *

* @return Last added item in basket */ public T getLast (); /** * Getter for last num rows - * + *

* @return Last num rows */ public int getLastNumRows (); + + /** + * Checks whether the given item has already been added by checking the + * item's id. + *

+ * @param item Item instance to check + * @return Whether the given item has been found + */ + public boolean isAdded (final T item); + + /** + * Checks if the basket is empty + *

+ * @return Whether the basket is empty + */ + public boolean isEmpty (); }