UseMode getMethodUsage(String mthd) { MethodCountData mcd = method_data.get(mthd); if (mcd == null) { int idx0 = mthd.indexOf("("); if (idx0 < 0) return UseMode.NONE; String mthd0 = mthd.substring(0, idx0); String mthd1 = mthd.substring(idx0); for (Map.Entry<String, MethodCountData> ent : method_data.entrySet()) { String nm = ent.getKey(); nm = nm.replace('/', '.'); int idx = nm.indexOf("("); if (idx < 0) continue; if (mthd0.equals(nm.substring(0, idx))) { if (BumpLocation.compareParameters(mthd1, nm.substring(idx))) { mcd = ent.getValue(); method_data.put(mthd, mcd); break; } } } } if (mcd != null) { if (mcd.getTopCount() > 0) return UseMode.DIRECT; if (mcd.getCalledCount() > 0) return UseMode.INDIRECT; } return UseMode.NONE; }
/** ***************************************************************************** */ BuenoLocationStatic(String proj, String nm, String ins, boolean after) { BumpClient bcc = BumpClient.getBump(); project_name = proj; package_name = null; class_name = null; location_file = null; insert_name = ins; insert_after = after; List<BumpLocation> locs = null; if (nm != null && nm.indexOf("<") < 0) locs = bcc.findPackage(proj, nm); if (locs != null && locs.size() > 0) { BumpLocation loc = locs.get(0); if (loc.getProject() != null) project_name = loc.getProject(); location_file = loc.getFile(); class_name = null; package_name = nm; } else if (nm != null) { locs = bcc.findClassDefinition(proj, nm); if (locs != null && locs.size() > 0) { BumpLocation loc = locs.get(0); // Is this always correct? if (loc.getProject() != null) project_name = loc.getProject(); location_file = loc.getFile(); String snm = loc.getSymbolName(); class_name = snm; String key = loc.getKey(); int ct = 0; for (int i = key.indexOf('$'); i >= 0; i = key.indexOf('$', i + 1)) ct++; int idx = snm.lastIndexOf("."); if (ct > 0) { for (int j = 0; idx > 0 && j < ct; ++j) { idx = snm.lastIndexOf(".", idx - 1); } } if (idx > 0) package_name = snm.substring(0, idx); } } }