if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) { String[] rtn = new String[ operand.getNumberOfChildren() ]; int x = 0; AST node = operand.getFirstChild(); while ( node != null ) { rtn[ x++ ] = node.getText(); node = node.getNextSibling(); } return rtn; } else if ( operand instanceof SqlNode ) { String nodeText = operand.getText(); if ( nodeText.startsWith( "(" ) ) { nodeText = nodeText.substring( 1 ); } if ( nodeText.endsWith( ")" ) ) { nodeText = nodeText.substring( 0, nodeText.length() - 1 ); } String[] splits = StringHelper.split( ", ", nodeText ); if ( count != splits.length ) { throw new HibernateException( "SqlNode's text did not reference expected number of columns" ); } return splits; } else { throw new HibernateException( "dont know how to extract row value elements from node : " + operand ); }
if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) { String[] rtn = new String[ operand.getNumberOfChildren() ]; int x = 0; AST node = operand.getFirstChild(); while ( node != null ) { rtn[ x++ ] = node.getText(); node = node.getNextSibling(); } return rtn; } else if ( operand instanceof SqlNode ) { String nodeText = operand.getText(); if ( nodeText.startsWith( "(" ) ) { nodeText = nodeText.substring( 1 ); } if ( nodeText.endsWith( ")" ) ) { nodeText = nodeText.substring( 0, nodeText.length() - 1 ); } String[] splits = StringHelper.split( ", ", nodeText ); if ( count != splits.length ) { throw new HibernateException( "SqlNode's text did not reference expected number of columns" ); } return splits; } else { throw new HibernateException( "dont know how to extract row value elements from node : " + operand ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java
Method name: String[] extractMutationTexts(Node, int) Method name: String[] extractMutationTexts(Node, int)
Number of AST nodes: 19 Number of AST nodes: 19
1
if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) {
1
if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) {
2
			String[] rtn = new String[ operand.getNumberOfChildren() ];
2
			String[] rtn = new String[ operand.getNumberOfChildren() ];
3
			int x = 0;
3
			int x = 0;
4
			AST node = operand.getFirstChild();
4
			AST node = operand.getFirstChild();
5
			while ( node != null ) {
5
			while ( node != null ) {
6
				rtn[ x++ ] = node.getText();
6
				rtn[ x++ ] = node.getText();
7
				node = node.getNextSibling();
7
				node = node.getNextSibling();
8
			}
8
			}
9
			return rtn;
9
			return rtn;
10
		}
10
		}
11
		else if ( operand instanceof SqlNode ) {
11
		else if ( operand instanceof SqlNode ) {
12
			String nodeText = operand.getText();
12
			String nodeText = operand.getText();
13
			if ( nodeText.startsWith( "(" ) ) {
13
			if ( nodeText.startsWith( "(" ) ) {
14
				nodeText = nodeText.substring( 1 );
14
				nodeText = nodeText.substring( 1 );
15
			}
15
			}
16
			if ( nodeText.endsWith( ")" ) ) {
16
			if ( nodeText.endsWith( ")" ) ) {
17
				nodeText = nodeText.substring( 0, nodeText.length() - 1 );
17
				nodeText = nodeText.substring( 0, nodeText.length() - 1 );
18
			}
18
			}
19
			String[] splits = StringHelper.split( ", ", nodeText );
19
			String[] splits = StringHelper.split( ", ", nodeText );
20
			if ( count != splits.length ) {
20
			if ( count != splits.length ) {
21
				throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
21
				throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
22
			}
22
			}
23
			return splits;
23
			return splits;
24
		}
24
		}
25
		else {
25
		else {
26
			throw new HibernateException( "dont know how to extract row value elements from node : " + operand );
26
			throw new HibernateException( "dont know how to extract row value elements from node : " + operand );
27
		}
27
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.0
Clones locationClones are in different classes having the same super class
Number of node comparisons107
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements19
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    6
    else if (operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR)
    6
    else if (operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR)
    7
    String[] rtn = new String[operand.getNumberOfChildren()];
    7
    String[] rtn = new String[operand.getNumberOfChildren()];
    8
    int x = 0;
    8
    int x = 0;
    9
    AST node = operand.getFirstChild();
    9
    AST node = operand.getFirstChild();
    10
    while (node != null)
    10
    while (node != null)
    11
    rtn[x++] = node.getText();
    11
    rtn[x++] = node.getText();
    12
    node = node.getNextSibling();
    12
    node = node.getNextSibling();
    13
    return rtn;
    13
    return rtn;
    14
    else if (operand instanceof SqlNode)
    14
    else if (operand instanceof SqlNode)
    15
    String nodeText = operand.getText();
    15
    String nodeText = operand.getText();
    16
    if (nodeText.startsWith("("))
    16
    if (nodeText.startsWith("("))
    17
    nodeText = nodeText.substring(1);
    17
    nodeText = nodeText.substring(1);
    18
    if (nodeText.endsWith(")"))
    18
    if (nodeText.endsWith(")"))
    19
    nodeText = nodeText.substring(0, nodeText.length() - 1);
    19
    nodeText = nodeText.substring(0, nodeText.length() - 1);
    20
    String[] splits = StringHelper.split(", ", nodeText);
    20
    String[] splits = StringHelper.split(", ", nodeText);
    21
    if (count != splits.length)
    21
    if (count != splits.length)
    22
    throw new HibernateException("SqlNode's text did not reference expected number of columns");
    22
    throw new HibernateException("SqlNode's text did not reference expected number of columns");
    23
    return splits;
    23
    return splits;
    else
    else
    24
    throw new HibernateException("dont know how to extract row value elements from node : " + operand);
    24
    throw new HibernateException("dont know how to extract row value elements from node : " + operand);
    Precondition Violations (0)
    Row Violation