@Override public Iterator<AugmentedStmt> iterator() { return aug_list.iterator(); }
public void printSig() { Iterator it = body.iterator(); while (it.hasNext()) { ((SETNode) it.next()).dump(); } }
public List<Object> emit_ASTBody(IterableSet children) { LinkedList<Object> l = new LinkedList<Object>(); Iterator cit = children.iterator(); while (cit.hasNext()) { ASTNode astNode = ((SETNode) cit.next()).emit_AST(); if (astNode != null) { l.addLast(astNode); } } return l; }
public void verify() { Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { IterableSet body = sbit.next(); Iterator bit = body.iterator(); while (bit.hasNext()) { if ((bit.next() instanceof AugmentedStmt) == false) { logger.debug("Error in body: " + getClass()); } } Iterator cit = body2childChain.get(body).iterator(); while (cit.hasNext()) { ((SETNode) cit.next()).verify(); } } }
public void setup_Graph(HashMap<AugmentedStmt, SwitchNode> binding) { Iterator rit = ((AugmentedStmt) as.bsuccs.get(0)).get_Reachers().iterator(); while (rit.hasNext()) { SwitchNode pred = binding.get(rit.next()); if (pred != null) { if (preds.contains(pred) == false) { preds.add(pred); } if (pred.succs.contains(this) == false) { pred.succs.add(this); } } } }
public void dump() { printSig(); logger.debug("" + "=== preds ==="); Iterator it = predecessors.iterator(); while (it.hasNext()) { ((SETBasicBlock) it.next()).printSig(); } logger.debug("" + "=== succs ==="); it = successors.iterator(); while (it.hasNext()) { ((SETBasicBlock) it.next()).printSig(); } } }
public void find_SmallestSETNode(AugmentedStmt as) { Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { Iterator it = body2childChain.get(sbit.next()).iterator(); while (it.hasNext()) { SETNode child = (SETNode) it.next(); if (child.contains(as)) { child.find_SmallestSETNode(as); return; } } } as.myNode = this; }
public void find_LabeledBlocks(LabeledBlockFinder lbf) { Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { Iterator cit = body2childChain.get(sbit.next()).iterator(); while (cit.hasNext()) { ((SETNode) cit.next()).find_LabeledBlocks(lbf); } } lbf.perform_ChildOrder(this); lbf.find_LabeledBlocks(this); }
public void find_StatementSequences(SequenceFinder sf, DavaBody davaBody) { Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { IterableSet body = sbit.next(); IterableSet children = body2childChain.get(body); HashSet<AugmentedStmt> childUnion = new HashSet<AugmentedStmt>(); Iterator cit = children.iterator(); while (cit.hasNext()) { SETNode child = (SETNode) cit.next(); child.find_StatementSequences(sf, davaBody); childUnion.addAll(child.get_Body()); } sf.find_StatementSequences(this, body, childUnion, davaBody); } }
private void dump(PrintStream out, String indentation) { String TOP = ".---", TAB = "| ", MID = "+---", BOT = "`---"; out.println(indentation); out.println(indentation + TOP); out.println(indentation + TAB + getClass()); out.println(indentation + TAB); Iterator it = body.iterator(); while (it.hasNext()) { out.println(indentation + TAB + ((AugmentedStmt) it.next()).toString()); } Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { IterableSet subBody = sbit.next(); out.println(indentation + MID); Iterator bit = subBody.iterator(); while (bit.hasNext()) { out.println(indentation + TAB + ((AugmentedStmt) bit.next()).toString()); } out.println(indentation + TAB); Iterator cit = body2childChain.get(subBody).iterator(); while (cit.hasNext()) { ((SETNode) cit.next()).dump(out, TAB + indentation); } } out.println(indentation + BOT); }
private boolean catches_Exception(IterableSet tryExceptionSet, SootClass c) { Iterator it = tryExceptionSet.iterator(); while (it.hasNext()) { SootClass thrownException = (SootClass) it.next(); while (true) { if (thrownException == c) { return true; } if (thrownException.hasSuperclass() == false) { break; } thrownException = thrownException.getSuperclass(); } } return false; }
public void find_AbruptEdges(AbruptEdgeFinder aef) { Iterator<IterableSet> sbit = subBodies.iterator(); while (sbit.hasNext()) { IterableSet body = sbit.next(); IterableSet children = body2childChain.get(body); Iterator cit = children.iterator(); while (cit.hasNext()) { ((SETNode) cit.next()).find_AbruptEdges(aef); } aef.find_Continues(this, body, children); } sbit = subBodies.iterator(); while (sbit.hasNext()) { IterableSet children = body2childChain.get(sbit.next()); Iterator cit = children.iterator(); if (cit.hasNext()) { SETNode cur = (SETNode) cit.next(), prev = null; while (cit.hasNext()) { prev = cur; cur = (SETNode) cit.next(); aef.find_Breaks(prev, cur); } } } }
private int get_Priority() { if (priority == -1) { priority = 0; if (predecessors.size() == 1) { Iterator sit = successors.iterator(); while (sit.hasNext()) { int sucScore = ((SETBasicBlock) sit.next()).get_Priority(); if (sucScore > priority) { priority = sucScore; } } priority++; } } return priority; }
private void removeOtherDominatedStmts(IterableSet synchBody, AugmentedStmt sas) { ArrayList toRemove = new ArrayList(); Iterator it = synchBody.iterator(); while (it.hasNext()) { AugmentedStmt as = (AugmentedStmt) it.next(); IterableSet doms = as.get_Dominators(); if (doms.contains(sas)) { // System.out.println("\n\nstmt:"+as+" is dominated by removed stmt"+sas); toRemove.add(as); } } it = toRemove.iterator(); while (it.hasNext()) { AugmentedStmt as = (AugmentedStmt) it.next(); // System.out.println("Removed dominated stmt: "+as); synchBody.remove(as); } }
public static String getReducedName(IterableSet importList, String qualifiedName, Type t) { // if two explicit imports dont import the same class we can remove explicit qualification if (!containsMultiple(importList.iterator(), qualifiedName, t)) { return getClassName(qualifiedName); } return qualifiedName; } }
public IterableSet get_NaturalExits() { IterableSet c = new IterableSet(); Iterator<IterableSet> it = subBodies.iterator(); while (it.hasNext()) { Iterator eit = ((SETNode) body2childChain.get(it.next()).getLast()).get_NaturalExits().iterator(); while (eit.hasNext()) { Object o = eit.next(); if (c.contains(o) == false) { c.add(o); } } } return c; }
IterableSet patch_PackageContext(IterableSet currentContext) { IterableSet newContext = new IterableSet(); Iterator it = currentContext.iterator(); while (it.hasNext()) { String currentPackage = (String) it.next(), newPackage = null;
public void find(DavaBody body, AugmentedStmtGraph asg, SETNode SET) throws RetriggerAnalysisException { Dava.v().log("LabeledBlockFinder::find()"); Iterator bit = SET.get_Body().iterator(); while (bit.hasNext()) { SET.find_SmallestSETNode((AugmentedStmt) bit.next()); } SET.find_LabeledBlocks(this); }
public boolean use_ShortName(String fixedPackageName, String fixedShortClassName) { if (fixed == false) { return false; } if (fixedPackageName.equals(Dava.v().get_CurrentPackage())) { return true; } IterableSet packageContext = Dava.v().get_CurrentPackageContext(); if (packageContext == null) { return true; } packageContext = patch_PackageContext(packageContext); int count = 0; StringTokenizer st = new StringTokenizer(classPath, pathSep); while (st.hasMoreTokens()) { String classpathDir = st.nextToken(); Iterator packIt = packageContext.iterator(); while (packIt.hasNext()) { if (package_ContainsClass(classpathDir, (String) packIt.next(), fixedShortClassName)) { if (++count > 1) { return false; } } } } return true; }
private boolean checkProtectionArea(AugmentedStmt as, DefinitionStmt s) { IterableSet esuccs = new IterableSet(); esuccs.addAll(as.csuccs); esuccs.removeAll(as.bsuccs); // esuccs contains the exception sucessors of as // System.out.println("ESUCCS are:"+esuccs); Iterator it = esuccs.iterator(); while (it.hasNext()) { // going through each exception sucessor AugmentedStmt tempas = (AugmentedStmt) it.next(); Stmt temps = tempas.get_Stmt(); if (temps instanceof GotoStmt) { Unit target = ((GotoStmt) temps).getTarget(); if (target != s) { // System.out.println("DID NOT Match indirectly"); return false; } else { // System.out.println("Matched indirectly"); } } else { if (temps != s) { // System.out.println("DID NOT Match directly"); return false; } else { // System.out.println("Matched directly"); } } } return true; }