|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.test.LibraryBook org.jwalk.test.ReservableBook
public class ReservableBook
A more sophisticated ReservableBook also supports reservations and cancellations. One reservation at a time is allowed. The object introduces orthogonal Default and Reserved states; these combine with the inherited states of LibraryBook to produce four distinct states: Default, OnLoan, Reserved and Reserved&OnLoan.
Constructor Summary | |
---|---|
ReservableBook()
Constructs a ReservableBook in its default state. |
Method Summary | |
---|---|
void |
cancel()
Cancels an existing reservation. |
java.lang.String |
getRequester()
Returns the name of the current requester, or null. |
boolean |
isReserved()
Reports if this ReservableBook has been reserved. |
void |
issue(java.lang.String person)
Issues this ReservableBook to the named person, if allowed. |
void |
reserve(java.lang.String person)
Reserves this ReservableBook for the named person. |
Methods inherited from class org.jwalk.test.LibraryBook |
---|
discharge, getBorrower, isOnLoan |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReservableBook()
Method Detail |
---|
public void issue(java.lang.String person) throws java.lang.Exception
issue
in class LibraryBook
java.lang.Exception
public void reserve(java.lang.String person) throws java.lang.Exception
java.lang.Exception
public void cancel()
public java.lang.String getRequester()
public boolean isReserved()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |