/** * Creates a new unmodifiable iterable set as a copy of an existing one * * @param original * The original set to copy */ public UnmodifiableIterableSet(IterableSet<E> original) { for (E e : original) { super.add(e); } }
public void addToImportList(String className) { if (!className.isEmpty()) { importList.add(className); } }
private void add_ThrownType(Type t) { if (t instanceof RefType) { curExceptionSet.add(((RefType) t).getSootClass()); } }
public boolean add_Child(SETNode child, IterableSet children) { if ((this == child) || (children.contains(child))) { return false; } children.add(child); child.parent = this; return true; }
public void add(SETNode sn) { if (body.isEmpty()) { entryNode = sn; } body.add(sn); G.v().SETBasicBlock_binding.put(sn, this); exitNode = sn; }
public IterableSet get_NaturalExits() { IterableSet c = new IterableSet(); c.add(get_CharacterizingStmt()); return c; }
public IterableSet get_NaturalExits() { IterableSet c = new IterableSet(); c.add(get_CharacterizingStmt()); return c; }
private IterableSet<AugmentedStmt> get_EntryPoint(IterableSet<AugmentedStmt> nodeList) { IterableSet<AugmentedStmt> entryPoints = new IterableSet<AugmentedStmt>(); for (AugmentedStmt as : nodeList) { for (AugmentedStmt po : as.cpreds) { if (nodeList.contains(po) == false) { entryPoints.add(as); break; } } } return entryPoints; }
public IterableSet<AugmentedStmt> get_CatchBody(AugmentedStmt handlerAugmentedStmt) { IterableSet<AugmentedStmt> catchBody = new IterableSet<AugmentedStmt>(); LinkedList<AugmentedStmt> catchQueue = new LinkedList<AugmentedStmt>(); catchBody.add(handlerAugmentedStmt); catchQueue.addAll(handlerAugmentedStmt.csuccs); while (catchQueue.isEmpty() == false) { AugmentedStmt as = (AugmentedStmt) catchQueue.removeFirst(); if (catchBody.contains(as)) { continue; } if (as.get_Dominators().contains(handlerAugmentedStmt)) { catchBody.add(as); catchQueue.addAll(as.csuccs); } } return catchBody; } }
private IterableSet find_SubBody(AugmentedStmt switchAS, AugmentedStmt branchS) { IterableSet subBody = new IterableSet(); LinkedList<AugmentedStmt> worklist = new LinkedList<AugmentedStmt>(); subBody.add(branchS); branchS = (AugmentedStmt) branchS.bsuccs.get(0); if (branchS.get_Dominators().contains(switchAS)) { worklist.addLast(branchS); subBody.add(branchS); } while (worklist.isEmpty() == false) { AugmentedStmt as = worklist.removeFirst(); Iterator sit = as.csuccs.iterator(); while (sit.hasNext()) { AugmentedStmt sas = (AugmentedStmt) sit.next(); if ((subBody.contains(sas) == false) && (sas.get_Dominators().contains(branchS))) { worklist.addLast(sas); subBody.add(sas); } } } return subBody; }
tSuccList.add(tSucc); } else { junkBody.add(target);
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; }
public IterableSet get_NaturalExits() { IterableSet c = new IterableSet(); AugmentedStmt last = (AugmentedStmt) get_Body().getLast(); if ((last.csuccs != null) && (last.csuccs.isEmpty() == false)) { c.add(last); } return c; }
public void add_AugmentedStmt(AugmentedStmt as) { Stmt s = as.get_Stmt(); aug_list.add(as); stmt_list.add(s); add_StmtBinding(s, as); if (as.bpreds.isEmpty()) { bheads.add(as); } if (as.cpreds.isEmpty()) { cheads.add(as); } if (as.bsuccs.isEmpty()) { btails.add(as); } if (as.csuccs.isEmpty()) { ctails.add(as); } check_List(as.bpreds, btails); check_List(as.bsuccs, bheads); check_List(as.cpreds, ctails); check_List(as.csuccs, cheads); }
public void calculate_Reachability(AugmentedStmt source, Set<AugmentedStmt> blockers, AugmentedStmt dominator) { if (blockers == null) { throw new RuntimeException("Tried to call AugmentedStmtGraph:calculate_Reachability() with null blockers."); } if (source == null) { return; } LinkedList<AugmentedStmt> worklist = new LinkedList<AugmentedStmt>(); HashSet<AugmentedStmt> touchSet = new HashSet<AugmentedStmt>(); worklist.addLast(source); touchSet.add(source); while (worklist.isEmpty() == false) { AugmentedStmt as = worklist.removeFirst(); for (AugmentedStmt sas : as.csuccs) { if ((touchSet.contains(sas)) || (sas.get_Dominators().contains(dominator) == false)) { continue; } touchSet.add(sas); IterableSet<AugmentedStmt> reachers = sas.get_Reachers(); if (reachers.contains(source) == false) { reachers.add(source); } if (blockers.contains(sas) == false) { worklist.addLast(sas); } } } }
public IterableSet<T> intersection(IterableSet<T> other) { if (other == null) { throw new IllegalArgumentException("Cannot set intersect an IterableSet with \"null\"."); } IterableSet<T> c = new IterableSet<T>(); if (other.size() < size()) { for (T t : other) { if (contains(t)) { c.add(t); } } } else { for (T t : this) { if (other.contains(t)) { c.add(t); } } } return c; }
private IterableSet find_Body(AugmentedStmt targetBranch, AugmentedStmt otherBranch) { IterableSet body = new IterableSet(); if (targetBranch.get_Reachers().contains(otherBranch)) { return body; } LinkedList<AugmentedStmt> worklist = new LinkedList<AugmentedStmt>(); worklist.addLast(targetBranch); while (worklist.isEmpty() == false) { AugmentedStmt as = worklist.removeFirst(); if (body.contains(as) == false) { body.add(as); Iterator sit = as.csuccs.iterator(); while (sit.hasNext()) { AugmentedStmt sas = (AugmentedStmt) sit.next(); if ((sas.get_Reachers().contains(otherBranch) == false) && (sas.get_Dominators().contains(targetBranch) == true)) { worklist.addLast(sas); } } } } return body; } }
public AugmentedStmtGraph(BriefUnitGraph bug, TrapUnitGraph cug) { this(); Dava.v().log("AugmentedStmtGraph::AugmentedStmtGraph() - cug.size() = " + cug.size()); // make the augmented statements for (Unit u : cug) { Stmt s = (Stmt) u; add_StmtBinding(s, new AugmentedStmt(s)); } // make the list of augmented statements in pseudo topological order! List<Unit> cugList = (new PseudoTopologicalOrderer<Unit>()).newList(cug, false); for (Unit u : cugList) { Stmt s = (Stmt) u; aug_list.add(get_AugStmt(s)); stmt_list.add(s); } // now that we've got all the augmented statements, mirror the statement // graph for (AugmentedStmt as : aug_list) { mirror_PredsSuccs(as, bug); mirror_PredsSuccs(as, cug); } find_Dominators(); }