-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
241 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import java.util.Collections; // +0 | ||
import java.io.IOException; // +0 | ||
// Total NCSS = 12 | ||
|
||
class Foo { // +1, total Ncss = 12 | ||
|
||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x = 0, y = 2; // +1 | ||
boolean a = false, b = true; // +1 | ||
|
||
if (a || b) { // +1 | ||
try { // +1 | ||
do { // +1 | ||
x += 2; // +1 | ||
import java.util.Collections; | ||
import java.io.IOException; | ||
|
||
class Foo { // +1 | ||
|
||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x = 0, y = 2; // +1 | ||
boolean a = false, b = true; // +1 | ||
|
||
if (a || b) { // +1 | ||
try { | ||
do { // +1 | ||
x += 2; // +1 | ||
} while (x < 12); | ||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
|
||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
throw new PatheticFailException(ioe); // +1 | ||
} | ||
} else { | ||
assert false; // +1 | ||
} else { // +1 | ||
assert false; // +1 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Total NCSS = 11 | ||
|
||
class ChainedIfElse { // +1 | ||
public int chainedIfElseMethod(int x) { // +1 | ||
if(x > 10) { // +1 | ||
return 100; // +1 | ||
} else if(x > 5) { // +1 | ||
return 5; // +1 | ||
} else if (x > 0) { // +1 | ||
return 1; // +1 | ||
} else if (x == 0) { // +1 | ||
return 0; // +1 | ||
} | ||
|
||
return -1; // +1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Total NCSS = 12 | ||
|
||
class ChainedIfElse { // +1 | ||
public int chainedIfElseMethod(int x) { // +1 | ||
if(x > 10) { // +1 | ||
return 100; // +1 | ||
} else if(x > 5) { // +1 | ||
return 5; // +1 | ||
} else if (x > 0) { // +1 | ||
return 1; // +1 | ||
} else if (x == 0) { // +1 | ||
return 0; // +1 | ||
} | ||
else { // +1 | ||
return -1; // +1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
// Total NCSS = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Total NCSS = 6 | ||
|
||
class FinallyBlock { // +1 | ||
private int x = 0; // +1 | ||
|
||
public void tryIncrement() { // +1 | ||
try { | ||
// Increment will never raise exception, | ||
// but it can be replaced with something | ||
// more dangerous. | ||
x += 1; // +1 | ||
} finally { // +1 | ||
x = 0; // +1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import java.util.Collections; | ||
import java.io.IOException; | ||
// Total NCSS = 2 | ||
|
||
class Foo { | ||
|
||
public void bigMethod() { | ||
import java.util.Collections; | ||
import java.io.IOException; | ||
|
||
class Foo { // +1 | ||
|
||
public void bigMethod() { // +1 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
import java.util.Collections; // +0 | ||
import java.io.IOException; // +0 | ||
// Total NCSS = 17 | ||
|
||
class Foo { // +1, total Ncss = 16 | ||
|
||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x, y = 2; // +1 | ||
boolean a, b; // +1 | ||
a = false; // +1 | ||
b = true; // +1 | ||
x = 0; // +1 | ||
if (a || b) { // +1 | ||
try { // +1 | ||
do { // +1 | ||
x += 2; // +1 | ||
import java.util.Collections; | ||
import java.io.IOException; | ||
|
||
class Foo { // +1 | ||
|
||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x, y = 2; // +1 | ||
boolean a, b; // +1 | ||
a = false; // +1 | ||
b = true; // +1 | ||
x = 0; // +1 | ||
if (a || b) { // +1 | ||
try { | ||
do { // +1 | ||
x += 2; // +1 | ||
} while (x < 12); | ||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
|
||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
throw new PatheticFailException(ioe); // +1 | ||
} finally { // +1 | ||
System.out.println("Finally Block"); | ||
} finally { // +1 | ||
System.out.println("Finally Block"); // +1 | ||
} | ||
} else { | ||
assert false; // +1 | ||
} else { // +1 | ||
assert false; // +1 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
import java.util.Collections; // +0 | ||
import java.io.IOException; // +0 | ||
// Total NCSS = 18 | ||
|
||
class Foo { // +1, total Ncss = 16 | ||
|
||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x, y = 2; // +1 | ||
boolean a, b; // +1 | ||
a = false; // +1 | ||
b = true; // +1 | ||
x = 0; // +1 | ||
if (a || b) { // +1 | ||
try { // +1 | ||
for(int i = 0, j = 10; i < j; i++){ // +1 | ||
x += 2; // +1 | ||
import java.util.Collections; | ||
import java.io.IOException; | ||
|
||
class Foo { // +1 | ||
public void bigMethod() // +1 | ||
throws IOException { | ||
int x, y = 2; // +1 | ||
boolean a, b; // +1 | ||
a = false; // +1 | ||
b = true; // +1 | ||
x = 0; // +1 | ||
if (a || b) { // +1 | ||
try { | ||
int i, j; // +1 | ||
for(i = 0, j = 10; i < j; i++) { // +1 | ||
x += 2; // +1 | ||
} | ||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
|
||
System.exit(0); // +1 | ||
} catch (IOException ioe) { // +1 | ||
throw new PatheticFailException(ioe); // +1 | ||
} finally { // +1 | ||
System.out.println("Finally Block"); | ||
} finally { // +1 | ||
System.out.println("Finally Block"); // +1 | ||
} | ||
} else { | ||
assert false; // +1 | ||
} else { // +1 | ||
assert false; // +1 | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.