File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/util/DDLFormatterImpl.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/util/DDLFormatterImpl.java | |||
Method name: String formatCommentOn(String)
|
Method name: String formatAlterTable(String)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | StringBuffer result = new StringBuffer( 60 ).append( "\n " );↵ | 1 | StringBuffer result = new StringBuffer( 60 ).append( "\n " );↵ | |
2 | StringTokenizer tokens = new StringTokenizer( sql, " '[]\"", true );↵ | 2 | StringTokenizer tokens = new StringTokenizer( sql, " (,)'[]\"", true );↵ | |
3 | boolean quoted = false;↵ | 3 | boolean quoted = false;↵ | |
4 | while ( tokens.hasMoreTokens() ) {↵ | 4 | while ( tokens.hasMoreTokens() ) {↵ | |
5 | String token = tokens.nextToken();↵ | 5 | String token = tokens.nextToken();↵ | |
6 | result.append( token );↵ | 6 | ↵ | |
7 | if ( isQuote( token ) ) {↵ | 7 | if ( isQuote( token ) ) {↵ | |
8 | quoted = !quoted;↵ | 8 | quoted = !quoted;↵ | |
9 | }↵ | 9 | }↵ | |
10 | else if ( !quoted ) {↵ | 10 | else if ( !quoted ) {↵ | |
11 | if ( "is".equals( token ) ) {↵ | 11 | if ( isBreak( token ) ) {↵ | |
12 | result.append( "\n " );↵ | 12 | result.append( "\n " );↵ | |
13 | }↵ | 13 | }↵ | |
14 | }↵ | 14 | }↵ | |
15 | ↵ | 15 | result.append( token );↵ | |
16 | }↵ | 16 | }↵ | |
17 | return result.toString(); | 17 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 23 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 2.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | StringBuffer result = new StringBuffer(60).append("\n "); | 1 | StringBuffer result = new StringBuffer(60).append("\n "); | |||||||||||
2 | StringTokenizer tokens = new StringTokenizer(sql, " '[]\"", true); |
| 2 | StringTokenizer tokens = new StringTokenizer(sql, " (,)'[]\"", true); | ||||||||||
3 | boolean quoted = false; | 3 | boolean quoted = false; | |||||||||||
4 | while (tokens.hasMoreTokens()) | 4 | while (tokens.hasMoreTokens()) | |||||||||||
5 | String token = tokens.nextToken(); | 5 | String token = tokens.nextToken(); | |||||||||||
6 | result.append(token); | 11 | result.append(token); | |||||||||||
7 | if (isQuote(token)) | 6 | if (isQuote(token)) | |||||||||||
8 | quoted = !quoted; | 7 | quoted = !quoted; | |||||||||||
|
| 8 | else if (!quoted) | |||||||||||
|
| 9 | if (isBreak(token)) | |||||||||||
|
| 10 | result.append("\n "); | |||||||||||
9 | else if (!quoted) |
| | |||||||||||
10 | if ("is".equals(token)) |
| | |||||||||||
11 | result.append("\n "); |
| | |||||||||||
12 | return result.toString(); | 12 | return result.toString(); |
Row | Violation |
---|---|
1 | Unmatched statement if(!quoted) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement if(isBreak(token)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement result.append("\n "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement if(!quoted) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement if("is".equals(token)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement result.append("\n "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |