@@ -0,0 +1,2614 @@
+package com.ragnarok.jparseutil.dataobject;%0A%0Aimport com.ragnarok.jparseutil.util.Log;%0A%0Aimport java.io.*;%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0A/**%0A * Created by ragnarok on 15/8/8.%0A * Source Map read from external library reference, which is used in parse import classes from the %22import *%22%0A */%0Apublic class ReferenceSourceMap %7B%0A    %0A    public static final String TAG = %22JParserUtil.ReferenceSourceMap%22;%0A    %0A    public List%3CString%3E classesNameList = new ArrayList%3C%3E();%0A   %0A    private static ReferenceSourceMap INSTANCE;%0A    %0A    private ReferenceSourceMap() %7B%7D%0A    %0A    public static ReferenceSourceMap getInstance() %7B%0A        if (INSTANCE == null) %7B%0A            INSTANCE = new ReferenceSourceMap();%0A        %7D%0A        return INSTANCE;%0A    %7D%0A    %0A    public void clearSourceMap() %7B%0A        classesNameList.clear();%0A    %7D%0A%0A    /**%0A     * add classes from the %7B@param sourceMapFile%7D%0A     * @param sourceMapFile%0A     * @throws FileNotFoundException%0A     */%0A    public void addClassesListFromSourceMapFile(String sourceMapFile) throws FileNotFoundException %7B%0A        FileInputStream fis = new FileInputStream(sourceMapFile);%0A        InputStreamReader isr = new InputStreamReader(fis);%0A        BufferedReader reader = new BufferedReader(isr);%0A        %0A        String className = null;%0A        try %7B%0A            while ((className = reader.readLine()) != null) %7B%0A                classesNameList.add(className);%0A            %7D%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            Log.e(TAG, %22initFromSourceMapFile error: %25s%22, e.getMessage());%0A        %7D%0A    %7D%0A%0A    /**%0A     * prepare for the class name search, must be call before doing any class name search%0A     */%0A    public void prepare() %7B%0A        Collections.sort(classesNameList);%0A    %7D%0A%0A    /**%0A     * search a class qualifed name from a prefix%0A     * @param prefix%0A     * @return%0A     */%0A    public String searchClassNameByPrefix(String prefix) %7B%0A        if (prefix.endsWith(%22.*%22)) %7B // remove the 'import *' note%0A            prefix = prefix.substring(0, prefix.lastIndexOf(%22.*%22));%0A        %7D%0A        int index = Collections.binarySearch(classesNameList, prefix, new Comparator%3CString%3E() %7B%0A            @Override%0A            public int compare(String currentItem, String key) %7B%0A                if (currentItem.startsWith(key)) %7B%0A                    return 0;%0A                %7D%0A                return currentItem.compareTo(key);%0A            %7D%0A        %7D);%0A        if (index %3E= 0) %7B%0A            return classesNameList.get(index);%0A        %7D%0A        return null;%0A    %7D%0A%7D%0A

add ReferenceSourceMap, prepare to support 'import *'