All Downloads are FREE. Search and download functionalities are using the official Maven repository.

boomerang.weights.MinDistanceWeightFunctions Maven / Gradle / Ivy

There is a newer version: 3.2.2
Show newest version
package boomerang.weights;

import boomerang.scene.Statement;
import boomerang.scene.Val;
import sync.pds.solver.WeightFunctions;
import sync.pds.solver.nodes.Node;

public class MinDistanceWeightFunctions
    implements WeightFunctions {

  @Override
  public MinDistanceWeight push(
      Node curr, Node succ, Statement callSite) {
    if (!curr.fact().isStatic()) {
      return new MinDistanceWeight(new Integer(1));
    }
    return MinDistanceWeight.one();
  }

  @Override
  public MinDistanceWeight normal(Node curr, Node succ) {
    if (!curr.fact().equals(succ.fact())) {
      return new MinDistanceWeight(new Integer(1));
    }
    if (succ.stmt().containsInvokeExpr() && succ.stmt().uses(curr.fact())) {
      return new MinDistanceWeight(new Integer(1));
    }
    return MinDistanceWeight.one();
  }

  @Override
  public MinDistanceWeight pop(Node curr) {
    return MinDistanceWeight.one();
  }

  @Override
  public MinDistanceWeight getOne() {
    return MinDistanceWeight.one();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy