/Users/lyon/j4p/src/bookExamples/ch25Delegation/Hw4Example.java
|
1 package bookExamples.ch25Delegation;
2
3 /**
4 * DocJava, Inc.
5 * http://www.docjava.com
6 * Programmer: dlyon
7 * Date: Oct 13, 2004
8 * Time: 8:39:07 PM
9 */
10 // This is what example output might look like,
11 // with out the Hw4Example class....
12 public class Hw4Example {
13 public class WaterPollution implements WaterPollutionStub {
14 // I added the fields by hand
15 // and I added the implements by hand.
16 // but you will do this automatically.
17 Water water;
18 Pollution pollution;
19 // constructor:
20 public WaterPollution(bookExamples.ch25Delegation.Water _water,
21 bookExamples.ch25Delegation.Pollution _pollution) {
22 water = _water;
23 pollution = _pollution;
24 }
25 // I added the methods for method forwarding
26 // by hand, but you will do this automatically in your
27 // output.
28 public boolean isDirty() {
29 return water.isDirty();
30 }
31 public boolean isWet() {
32 return water.isWet();
33 }
34 }
35
36 interface WaterPollutionStub extends
37 WaterStub, PollutionStub {
38 }
39
40 interface WaterStub {
41 public boolean isDirty();
42
43 public boolean isWet();
44 }
45
46 interface PollutionStub {
47 public boolean isDirty();
48
49 public boolean isWet();
50 }
51 }
52