Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
64 | 2 | 2 | 0.980 | class_body_declarations[4] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 64 | 361 | plugins/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringAvailabilityTester.java |
2 | 64 | 820 | plugins/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringAvailabilityTester.java |
| ||||
public static boolean isExtractSupertypeAvailable(IMember member) throws JavaModelException { final int type = member.getElementType(); if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE) return false; if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false; if ( !Checks.isAvailable(member)) return false; if (member instanceof IType) { if ( !JdtFlags.isStatic(member) && !JdtFlags.isEnum(member) && !JdtFlags.isAnnotation(member)) return false; } if (member instanceof IMethod) { final IMethod method = (IMethod) member; if (method.isConstructor()) return false; if (JdtFlags.isNative(method)) return false; final IType declaring = method.getDeclaringType(); if (declaring != null && declaring.isAnnotation()) return false; } return true; } public static boolean isExtractSupertypeAvailable( final IMember[] members) throws JavaModelException { if (members != null && members.length != 0) { final IType type = getTopLevelType(members); if (type != null && !type.isInterface()) return true; for (int index = 0; index < members.length; index++) { if ( !isExtractSupertypeAvailable(members[index])) return false; } return isCommonDeclaringType(members); } return false; } public static boolean isExtractSupertypeAvailable( final IStructuredSelection selection) throws JavaModelException { if ( !selection.isEmpty()) { if (selection.size() == 1) { if (selection.getFirstElement() instanceof ICompilationUnit) return true; // Do not force opening final IType type = getSingleSelectedType(selection); if (type != null) return Checks.isAvailable(type) && isExtractSupertypeAvailable(new IType[] { type } ); } for ( final Iterator iterator = selection.iterator(); iterator.hasNext();) { if ( !(iterator.next() instanceof IMember)) return false; } final Set members = new HashSet(); members.addAll(Arrays.asList(selection.toArray())); return isExtractSupertypeAvailable((IMember[]) members.toArray(new IMember[members.size()])); } return false; } public static boolean isExtractSupertypeAvailable( final JavaTextSelection selection) throws JavaModelException { IJavaElement element = selection.resolveEnclosingElement(); if ( !(element instanceof IMember)) return false; return isExtractSupertypeAvailable(new IMember[] { (IMember) element } ); } |
| ||||
public static boolean isPullUpAvailable(IMember member) throws JavaModelException { final int type = member.getElementType(); if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE) return false; if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false; if ( !Checks.isAvailable(member)) return false; if (member instanceof IType) { if ( !JdtFlags.isStatic(member) && !JdtFlags.isEnum(member) && !JdtFlags.isAnnotation(member)) return false; } if (member instanceof IMethod) { final IMethod method = (IMethod) member; if (method.isConstructor()) return false; if (JdtFlags.isNative(method)) return false; final IType declaring = method.getDeclaringType(); if (declaring != null && declaring.isAnnotation()) return false; } return true; } public static boolean isPullUpAvailable( final IMember[] members) throws JavaModelException { if (members != null && members.length != 0) { final IType type = getTopLevelType(members); if (type != null && getPullUpMembers(type).length != 0) return true; for (int index = 0; index < members.length; index++) { if ( !isPullUpAvailable(members[index])) return false; } return isCommonDeclaringType(members); } return false; } public static boolean isPullUpAvailable( final IStructuredSelection selection) throws JavaModelException { if ( !selection.isEmpty()) { if (selection.size() == 1) { if (selection.getFirstElement() instanceof ICompilationUnit) return true; // Do not force opening final IType type = getSingleSelectedType(selection); if (type != null) return Checks.isAvailable(type) && isPullUpAvailable(new IType[] { type } ); } for ( final Iterator iterator = selection.iterator(); iterator.hasNext();) { if ( !(iterator.next() instanceof IMember)) return false; } final Set members = new HashSet(); members.addAll(Arrays.asList(selection.toArray())); return isPullUpAvailable((IMember[]) members.toArray(new IMember[members.size()])); } return false; } public static boolean isPullUpAvailable( final JavaTextSelection selection) throws JavaModelException { IJavaElement element = selection.resolveEnclosingElement(); if ( !(element instanceof IMember)) return false; return isPullUpAvailable(new IMember[] { (IMember) element } ); } |
| |||
public static boolean [[#variableb76668c0]](IMember member) throws JavaModelException { final int type = member.getElementType(); if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE) return false; if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false; if ( !Checks.isAvailable(member)) return false; if (member instanceof IType) { if ( !JdtFlags.isStatic(member) && !JdtFlags.isEnum(member) && !JdtFlags.isAnnotation(member)) return false; } if (member instanceof IMethod) { final IMethod method = (IMethod) member; if (method.isConstructor()) return false; if (JdtFlags.isNative(method)) return false; final IType declaring = method.getDeclaringType(); if (declaring != null && declaring.isAnnotation()) return false; } return true; } public static boolean [[#variableb76668c0]]( final IMember[] members) throws JavaModelException { if (members != null && members.length != 0) { final IType type = getTopLevelType(members); if (type != null && [[#variableb7666840]]) return true; for (int index = 0; index < members.length; index++) { if ( ! [[#variableb76668c0]](members[index])) return false; } return isCommonDeclaringType(members); } return false; } public static boolean [[#variableb76668c0]]( final IStructuredSelection selection) throws JavaModelException { if ( !selection.isEmpty()) { if (selection.size() == 1) { if (selection.getFirstElement() instanceof ICompilationUnit) return true; // Do not force opening final IType type = getSingleSelectedType(selection); if (type != null) return Checks.isAvailable(type) && [[#variableb76668c0]](new IType[] { type } ); } for ( final Iterator iterator = selection.iterator(); iterator.hasNext();) { if ( !(iterator.next() instanceof IMember)) return false; } final Set members = new HashSet(); members.addAll(Arrays.asList(selection.toArray())); return [[#variableb76668c0]]((IMember[]) members.toArray(new IMember[members.size()])); } return false; } public static boolean [[#variableb76668c0]]( final JavaTextSelection selection) throws JavaModelException { IJavaElement element = selection.resolveEnclosingElement(); if ( !(element instanceof IMember)) return false; return [[#variableb76668c0]](new IMember[] { (IMember) element } ); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#b76668c0]] | isPullUpAvailable |
1 | 2 | [[#b76668c0]] | isExtractSupertypeAvailable |
2 | 1 | [[#b7666840]] | getPullUpMembers(type).length != 0 |
2 | 2 | [[#b7666840]] | !type.isInterface() |