1 19 24 25 package org.netbeans.modules.javacore.parser; 26 27 import org.netbeans.jmi.javamodel.Import; 28 29 33 class ImportInfoMeasure implements Measure { 34 static final ImportInfoMeasure INSTANCE = new ImportInfoMeasure(); 35 36 37 private ImportInfoMeasure() { 38 } 39 40 public int getDistance(Object refObject, Object ast) { 41 if (ast instanceof ElementInfo) { 42 ElementInfo astInfo = (ElementInfo) ast; 43 Import refInfo = (Import) refObject; 44 boolean isOnDemand=refInfo.isOnDemand(); 45 46 if ((isOnDemand && astInfo.infoType==ElementInfo.IMPORT_ON_DEMAND_TYPE) || 47 (!isOnDemand && astInfo.infoType==ElementInfo.SINGLE_IMPORT_TYPE)) { 48 return StringMeasure.INSTANCE.getDistance(refInfo.getName(),astInfo.name); 49 } 50 } 51 return INFINITE_DISTANCE; 52 } 53 } 54 | Popular Tags |