/******************************************************************************* | |
* 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.callgraph; | |
import java.util.Collection; | |
import org.eclipse.viatra2.core.IModelManager; | |
import org.eclipse.viatra2.gtasm.interpreter.exception.ViatraTransformationException; | |
import org.eclipse.viatra2.gtasm.patternmatcher.IMatching; | |
import org.eclipse.viatra2.gtasm.patternmatcher.PatternCallSignature; | |
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.logger.Logger; | |
/**Used to wrap the incremental (alternate) pattern matcher PatternMatcher class in order to be used in the rule goal graph | |
* @author Akos Horvath | |
* | |
*/ | |
public class PatternMatcherWrapper extends PatternMatcher { | |
IPatternMatcher alternatepatternMatcher; | |
public PatternMatcherWrapper(IPatternMatcher patternMatcher, Logger logger, | |
IModelManager manager, ITermHandler termHandler) | |
throws PatternMatcherCompileTimeException { | |
super(logger, manager, termHandler); | |
alternatepatternMatcher = patternMatcher; | |
} | |
// public PatternMatcherWrapper(PatternMatcher patternMatcher, Logger logger, | |
// IModelManager modelManager, ITermHandler termHandler) throws PatternMatcherCompileTimeException { | |
// super(logger, modelManager, termHandler); | |
// alternatepatternMatcher = patternMatcher; | |
// } | |
@Override | |
public IMatching match(Object[] inputMapping, | |
PatternCallSignature[] signature) throws ViatraTransformationException{ | |
if(alternatepatternMatcher != null) | |
return alternatepatternMatcher.match(inputMapping,signature); | |
else | |
return super.match(inputMapping, signature); | |
} | |
@Override | |
public boolean match(Object[] inputMapping) | |
throws ViatraTransformationException { | |
if(alternatepatternMatcher != null) | |
return alternatepatternMatcher.match(inputMapping); | |
else | |
return super.match(inputMapping); | |
} | |
@Override | |
public Collection<IMatching> matchAll(Object[] inputMapping, | |
PatternCallSignature[] signature, Integer[] quantificationOrder) | |
throws ViatraTransformationException { | |
if(alternatepatternMatcher != null) | |
return alternatepatternMatcher.matchAll(inputMapping,signature,quantificationOrder); | |
else | |
return super.matchAll(inputMapping, signature, quantificationOrder); | |
} | |
@Override | |
public IMatching matchRandomly(Object[] inputMapping, | |
PatternCallSignature[] signature) throws ViatraTransformationException{ | |
if(alternatepatternMatcher != null) | |
return alternatepatternMatcher.matchRandomly(inputMapping, signature); | |
else | |
return super.matchRandomly(inputMapping, signature); | |
} | |
} |