private String getMethodbaseName(APIMtd mtd) { String name = ASTBuilder.getJavaMethodName(mtd.getName()); if (name == null || name.length() == 0) { String methodNameTrunc = mtd.getName().substring(0, mtd.getName().indexOf('(')).trim(); String[] methodTokens = methodNameTrunc.split("\\s+"); String methodBaseName = mtd.getName(); if (methodTokens.length >= 2) methodBaseName = methodTokens[methodTokens.length - 1]; else methodBaseName = methodNameTrunc; return methodBaseName; } return name; }
@Override public List<String[]> getTermVector(APIMtd mtd) { tstSet = topicClassMap.get(mtd.getParentClass().getPackage().trim()); List<String[]> termList = new ArrayList<String[]>(); String apiName = MultiFieldQueryParser.escape(APITYPE.ANDROID.name().toLowerCase()); String clazzName = MultiFieldQueryParser.escape(mtd.getParentClass().getName()); String methodBaseName = MultiFieldQueryParser.escape(getMethodbaseName(mtd)); String methodDesc = MultiFieldQueryParser.escape(getMethodDescription(mtd)); String[] termVec1 = new String[] {apiName, clazzName, methodBaseName, methodDesc}; String[] termVec2 = new String[] {apiName, clazzName + "*", methodBaseName, methodDesc}; String[] termVec3 = new String[] {apiName, clazzName, methodBaseName, methodDesc}; String[] termVec4 = new String[] {apiName, clazzName + "*", methodBaseName, methodDesc}; String[] termVec5 = new String[] {apiName, clazzName + "*", methodBaseName, methodDesc}; termList.add(termVec1); termList.add(termVec2); termList.add(termVec3); termList.add(termVec4); termList.add(termVec5); return termList; }
private String getMethodDescription(APIMtd mtd) { String desclist[] = mtd.getDescription().split("\\."); String methodDesc = "a"; methodDesc = desclist[0] == null ? "a" : desclist[0]; return methodDesc; }