private static final class InventorySet.RecordObj extends java.lang.Object implements Record
This is a utility class for Inventory. Fields are mutable and package-private.
Class Invariant: No two instances may reference the same Video.
Record
Modifier and Type | Field and Description |
---|---|
(package private) int |
numOut |
(package private) int |
numOwned |
(package private) int |
numRentals |
(package private) Video |
video |
Constructor and Description |
---|
RecordObj(Video video,
int numOwned,
int numOut,
int numRentals) |
Modifier and Type | Method and Description |
---|---|
int |
numOut()
Returns the number of copies of the video that are currently checked out.
|
int |
numOwned()
Returns the number of copies of the video that are in the inventory.
|
int |
numRentals()
Returns the total number of times this video has ever been checked out.
|
java.lang.String |
toString()
Return a string representation of the object in the following format:
"video [numOwned,numOut,numRentals]" . |
Video |
video()
Returns the video.
|
int numOwned
int numOut
int numRentals
public Video video()
Record
Invariant: video() != null
.
public int numOwned()
Record
Invariant: numOwned() > 0
.
public int numOut()
Record
Invariant: numOut() <= numOwned()
.
public int numRentals()
Record
Invariant: numRentals() >= numOut()
.
numRentals
in interface Record