1 19 package org.netbeans.modules.javacore.parser; 20 21 import org.netbeans.modules.javacore.jmiimpl.javamodel.ConstructorImpl; 22 23 27 class ConstructorInfoMeasure implements Measure { 28 public static final ConstructorInfoMeasure INSTANCE = new ConstructorInfoMeasure(); 29 30 31 private ConstructorInfoMeasure() { 32 } 33 34 39 public int getDistance(Object refObject, Object ast) { 40 if (ast instanceof MethodInfo) { 41 MethodInfo astInfo = (MethodInfo) ast; 42 ConstructorImpl refInfo = (ConstructorImpl) refObject; 43 44 if (astInfo.infoType==MethodInfo.CONSTRUCTOR_TYPE) { 45 if (refInfo.isPersisted()) { 46 TypeRef[] refTypeNames = InfoUtil.getTypeNames(refInfo); 47 TypeRef[] astTypeNames = InfoUtil.getTypeNames(astInfo.parameters); 48 return new OrderedArrayMeasure(ClassNameMeasure.INSTANCE).getDistance(refTypeNames, astTypeNames); 49 } else { 50 return 1; 51 } 52 } 53 } 54 return INFINITE_DISTANCE; 55 } 56 } 57 | Popular Tags |