| /******************************************************************************* |
| * 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.patternmatcher.exceptions.PatternMatcherCompileTimeException; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.callgraph.FlattenedPattern.Pair; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.GTPatternCall; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.GTPattern; |
| import org.eclipse.viatra2.logger.Logger; |
|
|
|
|
| public class PatternReferenceNode extends OddLevelNode implements
|
| IFlattenedPatternElement {
|
| private PatternNode reference;
|
|
|
| PatternReferenceNode(BodyNode parent, GTPatternCall call, PatternNode reference) {
|
| super(parent,call);
|
| this.reference = reference;
|
| }
|
|
|
| // PatternReferenceNode(PatternNode orig) {
|
| // super(orig.parent,orig.pattern,orig.actualParameters);
|
| // reference = orig;
|
| // }
|
|
|
| protected PatternNode causesRecursion(GTPattern patternToTest) {
|
| return null;
|
| }
|
|
|
| @Override
|
| protected boolean traverse(PatternVariantIterator token) {
|
| assert index == 0 || index == 1;
|
| if (index == 1) {
|
| token.removeLast();
|
| index--;
|
| return false;
|
| } else {
|
| token.addLast(this);
|
| index++;
|
| return true;
|
| }
|
| }
|
|
|
| public void addLocalVariables(FlattenedPattern pattern) {
|
| return;
|
| }
|
|
|
| public void addFormalParameters(FlattenedPattern pattern) {
|
| return;
|
| }
|
|
|
| public void buildSearchGraph(FlattenedPattern result) throws PatternMatcherCompileTimeException {
|
| result.getSearchGraph().add(this, result);
|
| }
|
|
|
| public Collection<Pair> processVariableAssignments(FlattenedPattern pattern) throws PatternMatcherCompileTimeException {
|
| /* for (int i = 1; i < actualParameters.size(); i++) {
|
| VariableReference refI = (VariableReference) actualParameters.get(i);
|
| Integer indexI = pattern.getIndex(((BodyNode) parent).getVariableID(refI.getVariable()));
|
| for (int j = 0; j < i; j++) {
|
| VariableReference refJ = (VariableReference) actualParameters.get(j);
|
| Integer indexJ = pattern.getIndex(((BodyNode) parent).getVariableID(refJ.getVariable()));
|
| pattern.addExclusionPair(indexI, indexJ);
|
| }
|
| }*/ |
| |
| return null;
|
| }
|
|
|
| public void processCheckExpressions(FlattenedPattern pattern, Logger logger) {
|
| return;
|
| }
|
|
|
| public void processNegativeApplicationConditions(FlattenedPattern pattern, Logger logger, IModelManager manager) throws PatternMatcherCompileTimeException {
|
| return;
|
| }
|
|
|
| public PatternNode getReference() {
|
| return reference;
|
| }
|
|
|
| public String toString() {
|
| return getClass().getSimpleName() + " " + getPattern().getName() + "_" + currentLocation;
|
| } |
| |
| public Collection<Pair> processInjectivityAssignments(FlattenedPattern pattern) |
| throws PatternMatcherCompileTimeException { |
| return null; |
| } |
| |
| public void generateElementInjectivityConstraints ( |
| FlattenedPattern flattenedPattern, |
| Collection<Pair> localAdditonalExclusionInjectivityPairs, |
| Collection<Pair> localAdditionalInclusionInjectivityPairs) throws PatternMatcherCompileTimeException { |
| return; |
| } |
| |
|
|
| }
|