package pta;

import java.util.Collection;

import driver.PTAPattern.ContextKind;
import pag.MethodPAG;
import soot.SootMethod;
import soot.jimple.Stmt;

/**Summary based PTA. will use summaries*/
public class SumContextSensPTA extends ContextSensPTA{

	public SumContextSensPTA(int k, int hk, ContextKind kind) {
		super(k, hk, kind);
	}
	
	@Override
	public MethodPAG getMethodPAG(SootMethod m){
		MethodPAG ret = methodToPag.get(m);
		if (ret == null) {
			Collection<Stmt> stmts;
			if(SumPTA.isLib(m)) {
				long start = System.currentTimeMillis();
				stmts = SumPTA.getMethodStmts(m);
				SumPTA.sumtime+=System.currentTimeMillis()-start;
			}else 
				stmts = PTA.getMethodStmts(m);
			methodToPag.put(m, ret = new MethodPAG(pag, m, stmts));
		}
		return ret;
	}
}
