refactor string replace ops
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@532 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
c96ff262b4
commit
c4c70c6893
|
@ -27,7 +27,6 @@ import com.ibm.wala.ipa.callgraph.CGNode;
|
|||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
|
||||
import com.ibm.wala.properties.WalaProperties;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.HashSetFactory;
|
||||
|
@ -260,9 +259,8 @@ public abstract class BasicCallGraph extends AbstractNumberedGraph<CGNode> imple
|
|||
}
|
||||
|
||||
private String prettyPrint(CGNode n) {
|
||||
// XXX very hacky/inefficient. good enough for debugging though.
|
||||
String s = WalaProperties.replaceString(n.toString(), ",", "\\n");
|
||||
return WalaProperties.replaceString(s, " > Context: ", "\\n");
|
||||
String s = n.toString().replace(",", "\\n");
|
||||
return s.replace(" > Context: ", "\\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -36,24 +36,9 @@ public final class WalaProperties {
|
|||
|
||||
public final static String ECLIPSE_PLUGINS_DIR = "eclipse_plugins_dir"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Like java.lang.String.replace, but replaces substrings not characters.
|
||||
* Inefficient.
|
||||
*/
|
||||
public static String replaceString(String str, String pattern, String replacement) {
|
||||
|
||||
int plen = pattern.length();
|
||||
for (;;) {
|
||||
int index = str.indexOf(pattern);
|
||||
if (index == -1)
|
||||
return str;
|
||||
str = str.substring(0, index) + replacement + str.substring(index + plen);
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getJ2SEJarFiles() {
|
||||
Properties p = null;
|
||||
;
|
||||
try {
|
||||
p = WalaProperties.loadProperties();
|
||||
} catch (WalaException e) {
|
||||
|
|
Loading…
Reference in New Issue