001 package nl.cwi.sen1.visbase.factbrowser;
002
003 import nl.cwi.sen1.relationstores.Factory;
004 import aterm.pure.PureFactory;
005
006 /**
007 * A Singleton class to share a single factory instance.
008 * @author A. Belgraver
009 * @author R. van Remortel
010 * @date 20-2-2007
011 */
012 public class FactBrowserFactorySingleton {
013
014 private static Factory m_factory = null;
015 private static PureFactory m_pureFactory = null;
016
017 /**
018 * Get the factory instance.
019 * @author A. Belgraver
020 * @author R. van Remortel
021 * @return a new Factory (if none is present)
022 * @date 20-2-2007
023 */
024 public static Factory getFactoryInstance() {
025 createInstances();
026 return m_factory;
027 }
028
029 /**
030 * Get the factory instance.
031 * @author A. Belgraver
032 * @author R. van Remortel
033 * @return a new Factory (if none is present)
034 * @date 20-2-2007
035 */
036 public static PureFactory getPureFactoryInstance() {
037 createInstances();
038 return m_pureFactory;
039 }
040
041 private static void createInstances() {
042 if (m_factory == null) {
043 m_pureFactory = new PureFactory();
044 m_factory = Factory.getInstance(m_pureFactory);
045 }
046 }
047
048 }