| /******************************************************************************* |
| * 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.core;
|
|
|
| |
| import org.eclipse.viatra2.core.IModelManager; |
| import org.eclipse.viatra2.gtasm.patternmatcher.exceptions.PatternMatcherCompileTimeException; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.PatternMatcher; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.term.ITermHandler; |
| import org.eclipse.viatra2.gtasm.patternmatcher.patterns.IPatternMatcher; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.GTPattern; |
| import org.eclipse.viatra2.logger.Logger; |
|
|
| /**
|
| * PatternBuilder reads the specification (i.e., a model that conforms to
|
| * the GTPattern metamodel), and after an invocation graph analysis
|
| * it generates PatternMatchers, and the corresponding FlattenedPatterns
|
| * and SearchGraph structure.
|
| *
|
| * @author Gergely Varro & Akos Horvath
|
| */
|
| public class PatternBuilder {
|
| private final Logger logger;
|
| private final IModelManager manager;
|
| private final ITermHandler termHandler;
|
|
|
| public PatternBuilder(Logger logger, IModelManager manager, ITermHandler termHandler) {
|
| this.logger = logger;
|
| this.manager = manager;
|
| this.termHandler = termHandler;
|
| }
|
|
|
| public IPatternMatcher construct(GTPattern pattern)
|
| throws PatternMatcherCompileTimeException {
|
| return new PatternMatcher(pattern, logger, manager, termHandler); |
| // TODO gervarro: call graph analysis may be integrated into the parser |
| |
| //Use hacked pattern matcher with extreme caution: Can only be used if there are no containment constraints on the input parameters |
| // and the patterns is not recursively matched. Additionally it cannot be used with the Hybrid approach! |
| //return new HackedPatternMatcher(pattern, logger, manager, termHandler);
|
| }
|
| }
|