| /******************************************************************************* |
| * Copyright (c) 2004-2008 Akos Horvath, Gergely Varro and Daniel Varro |
| * 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: |
| * Akos Horvath, Gergely Varro - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.algorithms;
|
|
|
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.viatra2.core.IModelManager; |
|
|
| /**
|
| * Used to return the appropriate SearchGraphProvider (uses the alternate representation if available) for the Flattened Pattern.
|
| * @author Akos Horvath
|
| *
|
| */
|
| public class SearchGraphFactory{
|
|
|
| private static boolean useAlternate = false;
|
| private static List<ISearchGraphProvider> alternateProvider = new ArrayList<ISearchGraphProvider>();
|
|
|
| public static ISearchGraph getSearchGraph(IModelManager manager){
|
|
|
| if( (!useAlternate) || alternateProvider.size() == 0) //use default
|
| return new VPMBasedSearchGraph(manager);
|
| else
|
| return alternateProvider.get(0).getSearchGraph(manager);
|
| }
|
|
|
| /**
|
| * @return the useAlternate
|
| */
|
| public static boolean isUseAlternate() {
|
| return useAlternate;
|
| }
|
|
|
| /**
|
| * @param useAlternate the useAlternate to set
|
| */
|
| public static void setUseAlternate(boolean useAlternate) {
|
| SearchGraphFactory.useAlternate = useAlternate;
|
| }
|
|
|
| /**
|
| * @return the alternateProvider
|
| */
|
| public static List<ISearchGraphProvider> getAlternateProvider() {
|
| return alternateProvider;
|
| }
|
|
|
| /**
|
| * @param alternateProvider the alternateProvider to set
|
| */
|
| public static void setAlternateProvider(
|
| List<ISearchGraphProvider> alternateProvider) {
|
| SearchGraphFactory.alternateProvider = alternateProvider;
|
| }
|
| }
|