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

com.ibm.wala.dataflow.IFDS.BoundedTabulationSolver Maven / Gradle / Ivy

/*
 * Copyright (c) 2008 IBM Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 */
package com.ibm.wala.dataflow.IFDS;

import com.ibm.wala.util.MonitorUtil.IProgressMonitor;

/**
 * A {@link TabulationSolver} that gives up after a finite bound.
 *
 * @param  type of node in the supergraph
 * @param 

type of a procedure (like a box in an RSM) * @param type of factoids propagated when solving this problem */ public class BoundedTabulationSolver extends TabulationSolver { public static BoundedTabulationSolver createBoundedTabulationSolver( TabulationProblem p, int bound, IProgressMonitor monitor) { return new BoundedTabulationSolver<>(p, bound, monitor); } private final int bound; private int numSteps = 0; protected BoundedTabulationSolver( TabulationProblem p, int bound, IProgressMonitor monitor) { super(p, monitor); this.bound = bound; } @Override protected boolean propagate(T s_p, int i, T n, int j) { if (numSteps < bound) { numSteps++; return super.propagate(s_p, i, n, j); } return false; } public int getNumSteps() { return numSteps; } public void resetBound() { numSteps = 0; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy