CloneSet139


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
38201.000statement_list[3]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1391354
src/NHibernate/Hql/Classic/QueryTranslator.cs
23878
src/NHibernate/Hql/QuerySplitter.cs
Clone Instance
1
Line Count
39
Source Line
1354
Source File
src/NHibernate/Hql/Classic/QueryTranslator.cs

                                string token = tokens[i];
                                if ( !ParserHelper.IsWhitespace(token) || last == null)
                                {
                                        // scan for the next non-whitespace token
                                        if (nextIndex <= i)
                                        {
                                                for (nextIndex = i + 1; nextIndex < tokens.Length; nextIndex++)
                                                {
                                                        next = tokens[nextIndex].ToLowerInvariant();
                                                        if ( !ParserHelper.IsWhitespace(next))
                                                        {
                                                                break;
                                                        }
                                                }
                                        }

                                        //if ( Character.isUpperCase( token.charAt( token.lastIndexOf(".") + 1 ) ) ) {
                                        // added the checks for last!=null and next==null because an ISet can not contain 
                                        // a null key in .net - it is valid for a null key to be in a java.util.Set
                                        if (
                                                ((last != null && beforeClassTokens.Contains(last)) && (next == null || !notAfterClassTokens.Contains(next))) ||
                                                PathExpressionParser.EntityClass.Equals(last))
                                        {
                                                System.Type clazz = helper.GetImportedClass(token);
                                                if (clazz != null)
                                                {
                                                        string[] implementors = factory.GetImplementors(clazz.FullName);
                                                        string placeholder = "$clazz" + count++ + "$";

                                                        if (implementors != null)
                                                        {
                                                                placeholders.Add(placeholder);
                                                                replacements.Add(implementors);
                                                        }
                                                        token = placeholder; //Note this!!
                                                }
                                        }
                                }
                                templateQuery.Append(token);


Clone Instance
2
Line Count
38
Source Line
78
Source File
src/NHibernate/Hql/QuerySplitter.cs

                                string token = tokens[i];
                                if ( !ParserHelper.IsWhitespace(token) || last == null)
                                {
                                        //scan for next non-whitespace token
                                        if (nextIndex <= i)
                                        {
                                                for (nextIndex = i + 1; nextIndex < tokens.Length; nextIndex++)
                                                {
                                                        next = tokens[nextIndex].ToLowerInvariant();
                                                        if ( !ParserHelper.IsWhitespace(next))
                                                        {
                                                                break;
                                                        }
                                                }
                                        }

                                        // TODO H3.2 Different behavior
                                        // NHb: This block is not an exactly port from H3.2 but a port from previous implementation of QueryTranslator
                                        if (((last != null && beforeClassTokens.Contains(last)) &&
                                             (next == null || !notAfterClassTokens.Contains(next))) ||
                                            PathExpressionParser.EntityClass.Equals(last))
                                        {
                                                System.Type clazz = helper.GetImportedClass(token);
                                                if (clazz != null)
                                                {
                                                        string[] implementors = factory.GetImplementors(clazz.FullName);
                                                        string placeholder = "$clazz" + count++ + "$";

                                                        if (implementors != null)
                                                        {
                                                                placeholders.Add(placeholder);
                                                                replacements.Add(implementors);
                                                        }
                                                        token = placeholder; //Note this!!
                                                }
                                        }
                                }
                                templateQuery.Append(token);


Clone AbstractionParameter Count: 0Parameter Bindings

string token = tokens[i];
if ( !ParserHelper.IsWhitespace(token) || last == null)
{
   //scan for next non-whitespace token
   // scan for the next non-whitespace token
   if (nextIndex <= i)
   {
      for (nextIndex = i + 1; nextIndex < tokens.Length; nextIndex++)
      {
         next = tokens[nextIndex].ToLowerInvariant();
         if ( !ParserHelper.IsWhitespace(next))
         {
            break;
         }
      }
   }
   // TODO H3.2 Different behavior
   // NHb: This block is not an exactly port from H3.2 but a port from previous implementation of QueryTranslator
   //if ( Character.isUpperCase( token.charAt( token.lastIndexOf(".") + 1 ) ) ) {
   // added the checks for last!=null and next==null because an ISet can not contain 
   // a null key in .net - it is valid for a null key to be in a java.util.Set
   if (((last != null && beforeClassTokens.Contains(last)) && (next == null || !notAfterClassTokens.Contains(next))) || PathExpressionParser.EntityClass.Equals(last))
   {
      System.Type clazz = helper.GetImportedClass(token);
      if (clazz != null)
      {
         string[] implementors = factory.GetImplementors(clazz.FullName);
         string placeholder = "$clazz" + count++ + "$";
         if (implementors != null)
         {
            placeholders.Add(placeholder);
            replacements.Add(implementors);
         }
         token = placeholder; //Note this!!
      }
   }
}
templateQuery.Append(token);
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None