Skip to content

Commit e2618b2

Browse files
committed
Add utility method.
1 parent fea035a commit e2618b2

File tree

1 file changed

+21
-0
lines changed
  • edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis

1 file changed

+21
-0
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/Util.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import com.ibm.wala.ssa.SSAInvokeInstruction;
6161
import com.ibm.wala.ssa.SSAPhiInstruction;
6262
import com.ibm.wala.ssa.Value;
63+
import com.ibm.wala.types.ClassLoaderReference;
6364
import com.ibm.wala.types.MethodReference;
6465
import com.ibm.wala.types.TypeName;
6566
import com.ibm.wala.types.TypeReference;
@@ -688,4 +689,24 @@ public static TypeReference getEvaluationType(IMethod method) {
688689
// use the return type.
689690
return method.getReturnType();
690691
}
692+
693+
/**
694+
* Returns the index of the first {@link IMethod} in methods that is client
695+
* code.
696+
*
697+
* @param methods
698+
* The {@link IMethod}s in question.
699+
* @return The index of the first {@link IMethod} that is client code and -1 if
700+
* none found.
701+
*/
702+
public static int findIndexOfFirstClientMethod(IMethod[] methods) {
703+
for (int i = 0; i < methods.length; i++) {
704+
IMethod meth = methods[i];
705+
706+
if (meth.getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application))
707+
return i;
708+
}
709+
710+
return -1; // not found.
711+
}
691712
}

0 commit comments

Comments
 (0)