Package openbook.domain
Class Inventory
- java.lang.Object
-
- openbook.domain.Inventory
-
- All Implemented Interfaces:
java.io.Serializable
@Entity public class Inventory extends java.lang.Object implements java.io.SerializableA mutable persistent entity.- Author:
- Pinaki Poddar
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInventory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecrement(int sold)Decrement this inventory by the given quantity.BookgetBook()Gets the Book that this inventory represents.intgetInStock()Gets the available quantity.intgetSold()Gets the quantity sold so far.intgetSupplied()Gets the quantity supplied so far.intgetVersion()voidincrement(int supplied)Increment this inventory by the given quantity.
-
-
-
Method Detail
-
getBook
public Book getBook()
Gets the Book that this inventory represents.- Returns:
- non-null Book.
-
getInStock
public int getInStock()
Gets the available quantity. This is an in-flight value representing the difference between the quantity supplied and quantity sold so far.
-
getSupplied
public int getSupplied()
Gets the quantity supplied so far.- Returns:
- a monotonically increasing positive number.
-
getSold
public int getSold()
Gets the quantity sold so far.- Returns:
- a monotonically increasing positive number.
-
increment
public void increment(int supplied)
Increment this inventory by the given quantity.- Parameters:
supplied- must be positive.
-
decrement
public void decrement(int sold)
Decrement this inventory by the given quantity.- Parameters:
sold- must be positive.
-
getVersion
public int getVersion()
-
-