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.Serializable
A mutable persistent entity.- Author:
- Pinaki Poddar
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Inventory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decrement(int sold)
Decrement this inventory by the given quantity.Book
getBook()
Gets the Book that this inventory represents.int
getInStock()
Gets the available quantity.int
getSold()
Gets the quantity sold so far.int
getSupplied()
Gets the quantity supplied so far.int
getVersion()
void
increment(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()
-
-