1 19 20 package soot.dava.toolkits.base.finders; 21 22 import soot.*; 23 import soot.dava.*; 24 import java.util.*; 25 import soot.util.*; 26 import soot.dava.internal.asg.*; 27 import soot.dava.internal.SET.*; 28 import soot.dava.internal.AST.*; 29 30 public class SequenceFinder implements FactFinder 31 { 32 public SequenceFinder( Singletons.Global g ) {} 33 public static SequenceFinder v() { return G.v().soot_dava_toolkits_base_finders_SequenceFinder(); } 34 35 public void find( DavaBody body, AugmentedStmtGraph asg, SETNode SET) throws RetriggerAnalysisException 36 { 37 Dava.v().log( "SequenceFinder::find()"); 38 39 SET.find_StatementSequences( this, body); 40 } 41 42 public void find_StatementSequences( SETNode SETParent, IterableSet body, HashSet childUnion, DavaBody davaBody) 43 { 44 Iterator bit = body.iterator(); 45 while (bit.hasNext()) { 46 AugmentedStmt as = (AugmentedStmt) bit.next(); 47 48 if (childUnion.contains( as)) 49 continue; 50 51 IterableSet sequenceBody = new IterableSet(); 52 53 while (as.bpreds.size() == 1) { 54 AugmentedStmt pas = (AugmentedStmt) as.bpreds.get(0); 55 if ((body.contains( pas) == false) || (childUnion.contains( pas) == true)) 56 break; 57 58 as = pas; 59 } 60 61 while ((body.contains( as)) && (childUnion.contains( as) == false)) { 62 63 childUnion.add( as); 64 sequenceBody.addLast( as); 65 66 if (as.bsuccs.isEmpty() == false) 67 as = (AugmentedStmt) as.bsuccs.get(0); 68 69 if (as.bpreds.size() != 1) 70 break; 71 } 72 73 SETParent.add_Child( new SETStatementSequenceNode( sequenceBody, davaBody), (IterableSet) SETParent.get_Body2ChildChain().get( body)); 74 } 75 } 76 } 77 | Popular Tags |