1 19 package org.netbeans.modules.javacore.parser; 20 21 import org.netbeans.modules.javacore.jmiimpl.javamodel.FieldGroupImpl; 22 23 27 class FieldGroupInfoMeasure implements Measure { 28 public static final FieldGroupInfoMeasure INSTANCE = new FieldGroupInfoMeasure(); 29 30 31 private FieldGroupInfoMeasure() { 32 } 33 34 39 public int getDistance(Object refObject, Object ast) { 40 if (ast instanceof FieldGroupInfo) { 41 FieldGroupInfo astInfo = (FieldGroupInfo) ast; 42 FieldGroupImpl refInfo = (FieldGroupImpl) refObject; 43 int result; 44 if (refInfo.isPersisted()) { 45 result= new ArrayMeasure(FieldInfoMeasure.INSTANCE).getDistance(refInfo.getFields().toArray(), astInfo.fields); 46 } else { 47 result = 1; 48 } 49 return result > INFINITE_DISTANCE ? INFINITE_DISTANCE : result; 50 } 51 return INFINITE_DISTANCE; 52 } 53 } 54 | Popular Tags |