/Users/lyon/j4p/src/bookExamples/ch25Delegation/PollutedWaterImplementation.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: 7:44:18 PM 
9     */ 
10   // HW4 - create a program that automatically generates 
11   // PollutedWaterImplementation,  PollutedWaterInterface, 
12   // PollutionInterface, WaterInterface 
13   public class 
14           PollutedWaterImplementation 
15           implements PollutedWaterInterface { 
16       Water w; 
17       Pollution p; 
18        PollutedWaterImplementation(Water w, Pollution p) { 
19            this.w = w; 
20            this.p = p; 
21        } 
22       public boolean isDirty() { 
23           return p.isDirty(); 
24       } 
25       public boolean isWet() { 
26           return w.isWet() || p.isWet(); 
27       } 
28   } 
29