package prolog.model;


public class SingletonFactory
{
	/**
	 * the singleton instance
	 */
	protected static SingletonFactory gvInstance = null;

	/**
	 * the concrete builder
	 */
	protected  IProgramBuilder builder = null;

	/**
	 * constructor
	 */
	private SingletonFactory()
	{
	}

	/**
	 * returns the singleton instance
	 */
	public static SingletonFactory getInstance()
	{
		if( gvInstance == null )
			gvInstance = new SingletonFactory();
		return gvInstance;
	}

	/**
	 * sets the program builder
	 */
	public void registerBuilder( IProgramBuilder b )
	{
		this.builder = b;
	}

	/**
	 * returns the builder
	 */
	public static IProgramBuilder getBuilder()
	{
		return getInstance().builder;
	}
}
