CloneSet383


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
38240.991class_body_declarations[6]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13818
plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameSet.java
23842
plugins/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java
Clone Instance
1
Line Count
38
Source Line
18
Source File
plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameSet.java

// to avoid using Enumerations, walk the individual values skipping nulls
public char[][] names;

public int elementSize; // number of elements in the table

public int threshold;

public NameSet(int size) {
        this.elementSize = 0;
        this.threshold = size; // size represents the expected number of elements
        int extraRoom = (int) (size * 1.5F);
        if (this.threshold == extraRoom)
                extraRoom++;
        this.names = new char[extraRoom][];
}

public char[] add(char[] name) {
        int length = names.length;
        int index = CharOperation.hashCode(name) % length;
        char[] current;
        while ((current = names[index]) != null) {
                if (CharOperation.equals(current, name)) return current;
                if ( ++index == length)index = 0;
        }
        names[index] = name;

        // assumes the threshold is never equal to the size of the table
        if ( ++elementSize > threshold)rehash();
        return name;
}

private void rehash() {
        NameSet newSet = new NameSet(elementSize * 2); // double the number of expected elements
        char[] current;
        for (int i = names.length; --i >= 0;)
                if ((current = names[i]) != null)
                        newSet.add(current);

        this.names = newSet.names;
        this.elementSize = newSet.elementSize;
        this.threshold = newSet.threshold;
}


Clone Instance
2
Line Count
38
Source Line
42
Source File
plugins/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java

public char[][] names;

public int elementSize; // number of elements in the table

public int threshold;

PackageNameSet(int size) {
        this.elementSize = 0;
        this.threshold = size; // size represents the expected number of elements
        int extraRoom = (int) (size * 1.5F);
        if (this.threshold == extraRoom)
                extraRoom++;
        this.names = new char[extraRoom][];
}

char[] add(char[] name) {
        int length = names.length;
        int index = CharOperation.hashCode(name) % length;
        char[] current;
        while ((current = names[index]) != null) {
                if (CharOperation.equals(current, name)) return current;
                if ( ++index == length)index = 0;
        }
        names[index] = name;

        // assumes the threshold is never equal to the size of the table
        if ( ++elementSize > threshold)rehash();
        return name;
}

void rehash() {
        PackageNameSet newSet = new PackageNameSet(elementSize * 2); // double the number of expected elements
        char[] current;
        for (int i = names.length; --i >= 0;)
                if ((current = names[i]) != null)
                        newSet.add(current);

        this.names = newSet.names;
        this.elementSize = newSet.elementSize;
        this.threshold = newSet.threshold;
}


Clone AbstractionParameter Count: 4Parameter Bindings

// to avoid using Enumerations, walk the individual values skipping nulls
public char[][] names;

public int elementSize; // number of elements in the table

public int threshold;

 [[#variablebe7a0320]] [[#variablebe7a0200]](int size) {
  this.elementSize = 0;
  this.threshold = size; // size represents the expected number of elements
  int extraRoom = (int) (size * 1.5F);
  if (this.threshold == extraRoom)
    extraRoom++;
  this.names = new char[extraRoom][];
}

 [[#variablebe7a02c0]]char[] add(char[] name) {
  int length = names.length;
  int index = CharOperation.hashCode(name) % length;
  char[] current;
  while ((current = names[index]) != null) {
    if (CharOperation.equals(current, name))
      return current;
    if ( ++index == length)
      index = 0;
  }
  names[index] = name;
  // assumes the threshold is never equal to the size of the table
  if ( ++elementSize > threshold)
    rehash();
  return name;
}

 [[#variablebf947ee0]]void rehash() {
   [[#variablebe7a0200]] newSet = new [[#variablebe7a0200]](elementSize * 2); // double the number of expected elements
  char[] current;
  for (int i = names.length; --i >= 0;)
    if ((current = names[i]) != null)
      newSet.add(current);
  this.names = newSet.names;
  this.elementSize = newSet.elementSize;
  this.threshold = newSet.threshold;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#be7a0320]]
public 
12[[#be7a0320]]
21[[#be7a0200]]
NameSet 
22[[#be7a0200]]
PackageNameSet 
31[[#be7a02c0]]
public 
32[[#be7a02c0]]
41[[#bf947ee0]]
private 
42[[#bf947ee0]]