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.
-
B
extends A
.
Precondition Part:
Postcondition Part:
-
C
extends A
.
Precondition Part:
Postcondition Part:
-
A
extends B
.
Precondition Part:
Postcondition Part:
-
C
extends B
.
Precondition Part:
Postcondition Part:
-
A
extends C
.
Precondition Part:
Postcondition Part: