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

boomerang.results.ExtractAllocationSiteStateListener Maven / Gradle / Ivy

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

import boomerang.BackwardQuery;
import boomerang.ForwardQuery;
import boomerang.scene.ControlFlowGraph.Edge;
import boomerang.scene.Field;
import boomerang.scene.Val;
import sync.pds.solver.nodes.INode;
import sync.pds.solver.nodes.Node;
import wpds.impl.Transition;
import wpds.impl.Weight;
import wpds.impl.WeightedPAutomaton;
import wpds.interfaces.WPAStateListener;

public abstract class ExtractAllocationSiteStateListener
    extends WPAStateListener>, W> {

  /** */
  private ForwardQuery query;

  private BackwardQuery bwQuery;

  public ExtractAllocationSiteStateListener(
      INode> state, BackwardQuery bwQuery, ForwardQuery query) {
    super(state);
    this.bwQuery = bwQuery;
    this.query = query;
  }

  @Override
  public void onOutTransitionAdded(
      Transition>> t,
      W w,
      WeightedPAutomaton>, W> weightedPAutomaton) {}

  @Override
  public void onInTransitionAdded(
      Transition>> t,
      W w,
      WeightedPAutomaton>, W> weightedPAutomaton) {
    if (t.getStart().fact().equals(bwQuery.asNode()) && t.getLabel().equals(Field.empty())) {
      allocationSiteFound(query, bwQuery);
    }
  }

  protected abstract void allocationSiteFound(ForwardQuery allocationSite, BackwardQuery query);

  @Override
  public int hashCode() {
    // Otherwise we cannot register this listener twice.
    return System.identityHashCode(this);
  }

  @Override
  public boolean equals(Object obj) {
    // Otherwise we cannot register this listener twice.
    return this == obj;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy