SWE 619 In Class Exercise Number 5B
October 3, 2017


Consider the following:

class A:
   public void reduce (Reducer x)    
   // Effects: if x is null throw NPE 
   // else if x is not appropriate for this throw IAE
   // else reduce this by x

class B:
   public void reduce (Reducer x) 
   // Requires: x is not null
   // Effects: if x is not appropriate for this throw IAE
   // else reduce this by x

class C:
   public void reduce (Reducer x)   
   // Effects: if x is null return with no change to this
   // else if x is not appropriate for this throw IAE
   // else reduce this by x
Analyze the "methods rule" for reduce() in each of these cases: Note: Some analysis may not be necessary. If so, indicate that.