|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Toilet | +--AutoToilet
A better Toilet. It automatically cleans up after itself if it overflows, so it never throws an exception. It also tries to raise and lower the seat for you, although this turned out to be a bad idea.
Field Summary |
Fields inherited from class Toilet |
contents, seatup |
Constructor Summary | |
AutoToilet()
|
Method Summary | |
void |
deposit(LiquidWaste lw)
Although we inherit the general Toilet.deposit(Waste) method
from our parent class, we also override it with this more specific
method for liquid waste. |
void |
flush()
Like Toilet.flush() , but cleans up instead of throwing
an exception. |
static void |
main(java.lang.String[] args)
Test function similar to Toilet.main(java.lang.String[]) . |
void |
raiseSeat(boolean b)
Since this kind of toilet has an automatic seat raiser, the user can't move the seat. |
protected void |
raiseSeatAuto(boolean b)
Internally, the class's implementation will call this protected method to move the seat. |
Methods inherited from class Toilet |
deposit, isYucky |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AutoToilet()
Method Detail |
public void flush()
Toilet.flush()
, but cleans up instead of throwing
an exception.
flush
in class Toilet
public void deposit(LiquidWaste lw)
Toilet.deposit(Waste)
method
from our parent class, we also override it with this more specific
method for liquid waste. The method automatically raises and lowers
the seat for you when you pee. Alas, tests show dissatisfaction
among female users.
lw
- The liquid wastepublic void raiseSeat(boolean b)
raiseSeat
method with one that has no effect. (We do print a warning message;
alternatively, we could throw an exception.)
Really we shouldn't even be able to call raiseSeat
at all on an AutoToilet
. Unfortunately, by defining a
raiseSeat
method for Toilet
, we have told
the compiler that it's legal to call raiseSeat
on
any Toilet
object, including subclasses. So we'd have
to change that -- i.e., only some subclasses of Toilet
should
support this method.
raiseSeat
in class Toilet
b
- true to raise it, false to lower it.protected void raiseSeatAuto(boolean b)
public static void main(java.lang.String[] args)
Toilet.main(java.lang.String[])
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |