import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.SortedMap;
import java.util.StringTokenizer;
+import java.util.TreeMap;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
}
}
+ class StringComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ String s1 = (String)o1;
+ String s2 = (String)o2;
+ return s1.compareTo(s2);
+ // return s1.toUpperCase().compareTo(s2.toUpperCase());
+ }
+ public boolean equals(Object o) {
+ String s = (String)o;
+ return compare(this, o)==0;
+ }
+ }
+
private HashMap fFileMap;
private String fFilename;
- private HashMap fIndentifierMap;
+ private TreeMap fIndentifierMap;
public IdentifierIndexManager(String filename) {
fFilename = filename;
*
*/
public void initialize() {
- fIndentifierMap = new HashMap();
+ fIndentifierMap = new TreeMap(new StringComparator());
fFileMap = new HashMap();
}
fileWriter.write(line + '\n');
}
fileWriter.close();
+ } catch (FileNotFoundException e) {
+ // ignore exception; project is deleted by user
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
+
+ /**
+ * @param fromKey
+ * @param toKey
+ * @return
+ */
+ public SortedMap getIdentifierMap() {
+ return fIndentifierMap;
+ }
+
}
\ No newline at end of file