Skip to content

Commit d8359b8

Browse files
committed
added convenience methods for dealing with source and sink categories
1 parent a9d1992 commit d8359b8

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

soot-infoflow/src/soot/jimple/infoflow/results/DataFlowResult.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package soot.jimple.infoflow.results;
22

3+
import soot.jimple.infoflow.sourcesSinks.definitions.ISourceSinkCategory;
4+
import soot.jimple.infoflow.sourcesSinks.definitions.ISourceSinkDefinition;
5+
36
/**
47
* Data class for having the source and sink of a single flow together in one
58
* place
@@ -25,6 +28,38 @@ public ResultSinkInfo getSink() {
2528
return sink;
2629
}
2730

31+
/**
32+
* Convenience function to get the source category ID
33+
*
34+
* @return The source category ID or <code>null</code> if no source data is
35+
* available
36+
*/
37+
public String getSourceCategoryID() {
38+
ISourceSinkDefinition sourceDef = source.getDefinition();
39+
if (sourceDef != null) {
40+
ISourceSinkCategory sourceCat = sourceDef.getCategory();
41+
if (sourceCat != null)
42+
return sourceCat.getID();
43+
}
44+
return null;
45+
}
46+
47+
/**
48+
* Convenience function to get the sink category ID
49+
*
50+
* @return The sink category ID or <code>null</code> if no sink data is
51+
* available
52+
*/
53+
public String getSinkCategoryID() {
54+
ISourceSinkDefinition sinkDef = sink.getDefinition();
55+
if (sinkDef != null) {
56+
ISourceSinkCategory sinkCat = sinkDef.getCategory();
57+
if (sinkCat != null)
58+
return sinkCat.getID();
59+
}
60+
return null;
61+
}
62+
2863
@Override
2964
public String toString() {
3065
StringBuilder sb = new StringBuilder();

0 commit comments

Comments
 (0)