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

heros.template.DefaultIDETabulationProblem Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2012 Eric Bodden.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Eric Bodden - initial API and implementation
 ******************************************************************************/
package heros.template;

import heros.EdgeFunction;
import heros.EdgeFunctions;
import heros.IDETabulationProblem;
import heros.InterproceduralCFG;
import heros.MeetLattice;

/**
 * This is a template for {@link IDETabulationProblem}s that automatically caches values
 * that ought to be cached. This class uses the Factory Method design pattern.
 * The {@link InterproceduralCFG} is passed into the constructor so that it can be conveniently
 * reused for solving multiple different {@link IDETabulationProblem}s.
 * This class is specific to Soot. 
 * 
 * @param  The type of data-flow facts to be computed by the tabulation problem.
 * @param  The type of values to be computed along flow edges.
 * @param  The type of inter-procedural control-flow graph being used.
 */
public abstract class DefaultIDETabulationProblem>
    extends DefaultIFDSTabulationProblem implements IDETabulationProblem{

	private final EdgeFunction allTopFunction;
	private final MeetLattice joinLattice;
	private final EdgeFunctions edgeFunctions;
	
	public DefaultIDETabulationProblem(I icfg) {
		super(icfg);
		this.allTopFunction = createAllTopFunction();
		this.joinLattice = createMeetLattice();
		this.edgeFunctions = createEdgeFunctionsFactory();
	}

	protected abstract EdgeFunction createAllTopFunction();

	protected abstract MeetLattice createMeetLattice();

	protected abstract EdgeFunctions createEdgeFunctionsFactory();
	
	@Override
	public final EdgeFunction allTopFunction() {
		return allTopFunction;
	}
	
	@Override
	public final MeetLattice meetLattice() {
		return joinLattice;
	}
	
	@Override
	public final EdgeFunctions edgeFunctions() {
		return edgeFunctions;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy