Search in sources :

Example 6 with RectangleNode

use of soot.jimple.spark.geom.dataRep.RectangleNode in project soot by Sable.

the class GeometricManager method mergeManyToMany.

/**
 * Find the bounding rectangle for all the rectangle figures.
 * @return
 */
private RectangleNode mergeManyToMany() {
    long x_min = Long.MAX_VALUE, y_min = Long.MAX_VALUE;
    long x_max = Long.MIN_VALUE, y_max = Long.MIN_VALUE;
    RectangleNode p = (RectangleNode) header[GeometricManager.MANY_TO_MANY];
    header[GeometricManager.MANY_TO_MANY] = null;
    size[GeometricManager.MANY_TO_MANY] = 0;
    while (p != null) {
        if (p.I1 < x_min)
            x_min = p.I1;
        if (p.I2 < y_min)
            y_min = p.I2;
        if (p.I1 + p.L > x_max)
            x_max = p.I1 + p.L;
        if (p.I2 + p.L_prime > y_max)
            y_max = p.I2 + p.L_prime;
        p = (RectangleNode) reclaimRectangleNode(p);
    }
    // We assume the list has at least one element
    p = getRectangleNode();
    p.I1 = x_min;
    p.I2 = y_min;
    p.L = x_max - x_min;
    p.L_prime = y_max - y_min;
    p.next = null;
    return p;
}
Also used : RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode)

Example 7 with RectangleNode

use of soot.jimple.spark.geom.dataRep.RectangleNode in project soot by Sable.

the class GeometricManager method mergeFigures.

/**
 * Merge the set of objects in the same category into one.
 */
public void mergeFigures(int buget_size) {
    RectangleNode p;
    // We don't merge the figures if there are no new figures in this geometric manager
    if (!hasNewFigure)
        return;
    for (int i = 0; i < Divisions; ++i) {
        p = null;
        if (size[i] > buget_size && header[i].is_new == true) {
            switch(i) {
                case GeometricManager.ONE_TO_ONE:
                    p = mergeOneToOne();
                    break;
                case GeometricManager.MANY_TO_MANY:
                    p = mergeManyToMany();
                    break;
            }
        }
        if (p != null) {
            if (i == GeometricManager.ONE_TO_ONE) {
                if (checkRedundancy(GeometricManager.MANY_TO_MANY, p))
                    continue;
                filterOutDuplicates(GeometricManager.MANY_TO_MANY, p);
            }
            p.next = header[GeometricManager.MANY_TO_MANY];
            header[GeometricManager.MANY_TO_MANY] = p;
            size[GeometricManager.MANY_TO_MANY]++;
        }
    }
}
Also used : RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode)

Example 8 with RectangleNode

use of soot.jimple.spark.geom.dataRep.RectangleNode in project soot by Sable.

the class IFigureManager method getRectangleNode.

/**
 * Generate a rectangle node from our own cache.
 * @return
 */
protected static RectangleNode getRectangleNode() {
    RectangleNode ret = null;
    if (rectHeader != null) {
        ret = (RectangleNode) rectHeader;
        rectHeader = ret.next;
        ret.next = null;
        ret.is_new = true;
    } else
        ret = new RectangleNode();
    return ret;
}
Also used : RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode)

Aggregations

RectangleNode (soot.jimple.spark.geom.dataRep.RectangleNode)8 SegmentNode (soot.jimple.spark.geom.dataRep.SegmentNode)5 PlainConstraint (soot.jimple.spark.geom.dataRep.PlainConstraint)2 AllocNode (soot.jimple.spark.pag.AllocNode)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SootMethod (soot.SootMethod)1 GeomPointsTo (soot.jimple.spark.geom.geomPA.GeomPointsTo)1