Search in sources :

Example 1 with IterableSet

use of soot.util.IterableSet in project soot by Sable.

the class SETNode method find_AbruptEdges.

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);
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) UnmodifiableIterableSet(soot.util.UnmodifiableIterableSet) IterableSet(soot.util.IterableSet)

Example 2 with IterableSet

use of soot.util.IterableSet in project soot by Sable.

the class SETNode method find_StatementSequences.

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);
    }
}
Also used : Iterator(java.util.Iterator) UnmodifiableIterableSet(soot.util.UnmodifiableIterableSet) IterableSet(soot.util.IterableSet) AugmentedStmt(soot.dava.internal.asg.AugmentedStmt) HashSet(java.util.HashSet)

Example 3 with IterableSet

use of soot.util.IterableSet in project soot by Sable.

the class SETNode method find_SmallestSETNode.

/*
	 * Tree traversing utilities.
	 */
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;
}
Also used : Iterator(java.util.Iterator) UnmodifiableIterableSet(soot.util.UnmodifiableIterableSet) IterableSet(soot.util.IterableSet)

Example 4 with IterableSet

use of soot.util.IterableSet in project soot by Sable.

the class SETNode method nest.

public boolean nest(SETNode other) {
    if (other.resolve(this) == false)
        return false;
    IterableSet otherBody = other.get_Body();
    Iterator<IterableSet> sbit = subBodies.iterator();
    while (sbit.hasNext()) {
        IterableSet subBody = sbit.next();
        if (subBody.intersects(otherBody)) {
            IterableSet childChain = body2childChain.get(subBody);
            Iterator ccit = childChain.snapshotIterator();
            while (ccit.hasNext()) {
                SETNode curChild = (SETNode) ccit.next();
                IterableSet childBody = curChild.get_Body();
                if (childBody.intersects(otherBody)) {
                    if (childBody.isSupersetOf(otherBody))
                        return curChild.nest(other);
                    else {
                        remove_Child(curChild, childChain);
                        Iterator<IterableSet> osbit = other.subBodies.iterator();
                        while (osbit.hasNext()) {
                            IterableSet otherSubBody = osbit.next();
                            if (otherSubBody.isSupersetOf(childBody)) {
                                other.add_Child(curChild, other.get_Body2ChildChain().get(otherSubBody));
                                break;
                            }
                        }
                    }
                }
            }
            add_Child(other, childChain);
        }
    }
    return true;
}
Also used : Iterator(java.util.Iterator) UnmodifiableIterableSet(soot.util.UnmodifiableIterableSet) IterableSet(soot.util.IterableSet)

Example 5 with IterableSet

use of soot.util.IterableSet in project soot by Sable.

the class DVariableDeclarationStmt method toString.

public void toString(UnitPrinter up) {
    if (declarations.size() == 0)
        return;
    if (!(up instanceof DavaUnitPrinter))
        throw new RuntimeException("DavaBody should always be printed using the DavaUnitPrinter");
    else {
        DavaUnitPrinter dup = (DavaUnitPrinter) up;
        String type = declarationType.toString();
        if (type.equals("null_type"))
            dup.printString("Object");
        else {
            IterableSet importSet = davaBody.getImportList();
            if (!importSet.contains(type))
                davaBody.addToImportList(type);
            type = RemoveFullyQualifiedName.getReducedName(davaBody.getImportList(), type, declarationType);
            dup.printString(type);
        }
        dup.printString(" ");
        Iterator decIt = declarations.iterator();
        while (decIt.hasNext()) {
            Local tempDec = (Local) decIt.next();
            dup.printString(tempDec.getName());
            if (decIt.hasNext())
                dup.printString(", ");
        }
    }
}
Also used : IterableSet(soot.util.IterableSet)

Aggregations

IterableSet (soot.util.IterableSet)12 Iterator (java.util.Iterator)8 UnmodifiableIterableSet (soot.util.UnmodifiableIterableSet)8 AugmentedStmt (soot.dava.internal.asg.AugmentedStmt)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 BooleanType (soot.BooleanType)1 ByteType (soot.ByteType)1 CharType (soot.CharType)1 DoubleType (soot.DoubleType)1 FloatType (soot.FloatType)1 IntType (soot.IntType)1 LongType (soot.LongType)1 RefType (soot.RefType)1 ShortType (soot.ShortType)1 SootClass (soot.SootClass)1 SootField (soot.SootField)1