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;
private void parseDeclarations(StringBuffer buf, boolean goBack) {
char[] ident;
+ char[] classVariable;
int counter = 0;
int phpdocOffset = -1;
int phpdocLength = -1;
getNextToken();
if (fToken == TokenNameVariable) {
ident = fScanner.getCurrentIdentifierSource();
- addIdentifierInformation('v', ident, buf, phpdocOffset, phpdocLength);
+ classVariable = new char[ident.length-1];
+ System.arraycopy(ident, 1, classVariable, 0, ident.length-1);
+ addIdentifierInformation('v', classVariable, buf, phpdocOffset, phpdocLength);
getNextToken();
}
} else if (fToken == TokenNamefunction) {
}
}
+ 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