1 19 package org.netbeans.modules.javacore.parser; 20 21 25 public class ClassNameMeasure implements Measure { 26 public static final ClassNameMeasure INSTANCE = new ClassNameMeasure(); 27 28 private ClassNameMeasure() { 29 } 30 31 public int getDistance(Object first, Object second) { 32 if (first==second) 33 return 0; 34 if (first==null || second==null) 35 return INFINITE_DISTANCE; 36 if (first.getClass().equals(second.getClass())) { 37 TypeRef firstRef=(TypeRef)first; 38 TypeRef secondRef=(TypeRef)second; 39 return StringMeasure.INSTANCE.getDistance(firstRef.getName(), secondRef.getName()); 40 } 41 return INFINITE_DISTANCE; 42 } 43 } 44 | Popular Tags |