EmSE-Figure7: Difference between revisions
Jump to navigation
Jump to search
Programsam (talk | contribs) No edit summary |
Programsam (talk | contribs) No edit summary |
||
| Line 3: | Line 3: | ||
|+ Figure 7. Method <code>addIfPositive</code> | |+ Figure 7. Method <code>addIfPositive</code> | ||
|- | |- | ||
< | | <pre> | ||
public int addIfPositive | public int addIfPositive | ||
(int a, int b) | (int a, int b) | ||
| Line 11: | Line 11: | ||
return -1; | return -1; | ||
} | } | ||
</ | </pre> | ||
| <pre> | |||
public int addIfPositive | |||
(int a, int b) | |||
{ | |||
if (a >= 0 && b < 0) | |||
return (a+b); | |||
return -1; | |||
} | |||
</pre> | |||
| <pre> | |||
public int addIfPositive | |||
(int a, int b) | |||
{ | |||
if (a < 0 && b >= 0) | |||
return (a+b); | |||
return -1; | |||
} | |||
</pre> | |||
|- | |||
| '''Original''' | |||
| '''Mutant #1''' | |||
| '''Mutant #2''' | |||
|} | |} | ||
Revision as of 14:25, 5 September 2013
public int addIfPositive
(int a, int b)
{
if (a >= 0 && b >= 0)
return (a+b);
return -1;
}
|
public int addIfPositive
(int a, int b)
{
if (a >= 0 && b < 0)
return (a+b);
return -1;
}
|
public int addIfPositive
(int a, int b)
{
if (a < 0 && b >= 0)
return (a+b);
return -1;
}
|
| Original | Mutant #1 | Mutant #2 |