| /******************************************************************************* |
| * 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.operation;
|
|
|
| import org.eclipse.viatra2.core.IModelManager;
|
| import org.eclipse.viatra2.gtasm.patternmatcher.exceptions.PatternMatcherRuntimeException; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.MatchingFrame; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.PatternMatcherErrorStrings; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.searchgraph.SearchGraphEdge; |
|
|
|
|
| /**
|
| * @author Akos Horvath
|
| *
|
| */
|
| public class AllRelationsOperation extends ExtendOperation {
|
|
|
| /**
|
| * @param unbound
|
| * @param edge
|
| */
|
| public AllRelationsOperation(Integer unbound, SearchGraphEdge edge, IModelManager m) {
|
| super(unbound, edge);
|
| manager = m;
|
| }
|
| private IModelManager manager;
|
|
|
| public void preprocess(MatchingFrame frame) throws PatternMatcherRuntimeException{
|
| if(edge.isSource())
|
| iterator = manager.getRelations().iterator();
|
| else |
| {
|
| String[] context = {frame.getPattern().getSearchGraph().getSearchNode(unbound).getName()}; |
| throw new PatternMatcherRuntimeException(PatternMatcherErrorStrings.INTERNAL_ALLRELATIONS |
| ,context |
| ,frame.getPattern().getSearchGraph().getSearchNode(unbound).getTraceabilityElement().getRepresentativeEMFElement()); |
| }
|
| }
|
|
|
| public String toString(){
|
| return getClass().getSimpleName() + " : " +
|
| "RELATION -- " + edge.getVPMEdgeType().name() + " -> " + unbound;
|
| }
|
|
|
| }
|