public Edge next() { Edge ret = position; position = position.nextByUnit(); return ret; }
/** * Find the specific call edge that is going out from the callsite u and the call target is callee. Without advanced data * structure, we can only sequentially search for the match. Fortunately, the number of outgoing edges for a unit is not * too large. * * @param u * @param callee * @return */ public Edge findEdge(Unit u, SootMethod callee) { Edge e = srcUnitToEdge.get(u); while (e.srcUnit() == u && e.kind() != Kind.INVALID) { if (e.tgt() == callee) { return e; } e = e.nextByUnit(); } return null; }
if (e.nextByUnit().srcUnit() == e.srcUnit()) { srcUnitToEdge.put(e.srcUnit(), e.nextByUnit()); } else { srcUnitToEdge.put(e.srcUnit(), null);
public Edge next() { Edge ret = position; position = position.nextByUnit(); return ret; } public void remove() {
public Edge next() { Edge ret = position; position = position.nextByUnit(); return ret; } public void remove() {
/** * Find the specific call edge that is going out from the callsite u and the call target is callee. * Without advanced data structure, we can only sequentially search for the match. * Fortunately, the number of outgoing edges for a unit is not too large. * @param u * @param callee * @return */ public Edge findEdge( Unit u, SootMethod callee ) { Edge e = srcUnitToEdge.get(u); while ( e.srcUnit() == u && e.kind() != Kind.INVALID ) { if ( e.tgt() == callee ) return e; e = e.nextByUnit(); } return null; }
/** * Find the specific call edge that is going out from the callsite u and the call target is callee. * Without advanced data structure, we can only sequentially search for the match. * Fortunately, the number of outgoing edges for a unit is not too large. * @param u * @param callee * @return */ public Edge findEdge( Unit u, SootMethod callee ) { Edge e = srcUnitToEdge.get(u); while ( e.srcUnit() == u && e.kind() != Kind.INVALID ) { if ( e.tgt() == callee ) return e; e = e.nextByUnit(); } return null; }
/** Removes the edge e from the call graph. Returns true iff the edge * was originally present in the call graph. */ public boolean removeEdge( Edge e ) { if( !edges.remove( e ) ) return false; e.remove(); if( srcUnitToEdge.get(e.srcUnit()) == e ) { if( e.nextByUnit().srcUnit() == e.srcUnit() ) { srcUnitToEdge.put(e.srcUnit(), e.nextByUnit() ); } else { srcUnitToEdge.put(e.srcUnit(), null); } } if( srcMethodToEdge.get(e.getSrc()) == e ) { if( e.nextBySrc().getSrc() == e.getSrc() ) { srcMethodToEdge.put(e.getSrc(), e.nextBySrc() ); } else { srcMethodToEdge.put(e.getSrc(), null); } } if( tgtToEdge.get(e.getTgt()) == e ) { if( e.nextByTgt().getTgt() == e.getTgt() ) { tgtToEdge.put(e.getTgt(), e.nextByTgt() ); } else { tgtToEdge.put(e.getTgt(), null); } } return true; }
/** Removes the edge e from the call graph. Returns true iff the edge * was originally present in the call graph. */ public boolean removeEdge( Edge e ) { if( !edges.remove( e ) ) return false; e.remove(); if( srcUnitToEdge.get(e.srcUnit()) == e ) { if( e.nextByUnit().srcUnit() == e.srcUnit() ) { srcUnitToEdge.put(e.srcUnit(), e.nextByUnit() ); } else { srcUnitToEdge.put(e.srcUnit(), null); } } if( srcMethodToEdge.get(e.getSrc()) == e ) { if( e.nextBySrc().getSrc() == e.getSrc() ) { srcMethodToEdge.put(e.getSrc(), e.nextBySrc() ); } else { srcMethodToEdge.put(e.getSrc(), null); } } if( tgtToEdge.get(e.getTgt()) == e ) { if( e.nextByTgt().getTgt() == e.getTgt() ) { tgtToEdge.put(e.getTgt(), e.nextByTgt() ); } else { tgtToEdge.put(e.getTgt(), null); } } return true; }