/******************************************************************************* | |
* Copyright (c) 2004-2009 Akos Horvath 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 - initial API and implementation | |
*******************************************************************************/ | |
/** | |
* | |
*/ | |
package org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.searchgraph.traceability; | |
import java.util.ArrayList; | |
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.AnnotatedElement; | |
/** | |
* For each VPM search graph element a traceability Element is created that can point to multiple GTASM element | |
* and its corresponding operation (either pattern or gtRule) | |
* @author Akos Horvath | |
* | |
*/ | |
public abstract class AbstractTraceabilityElement<VPMType> { | |
private ArrayList<AnnotatedElement> emfElements; | |
public AbstractTraceabilityElement(){ | |
emfElements = new ArrayList<AnnotatedElement>(); | |
} | |
public AbstractTraceabilityElement(AnnotatedElement element){ | |
emfElements = new ArrayList<AnnotatedElement>(); | |
if(element != null) | |
emfElements.add(0, element); | |
} | |
/** Adds an EMF element to the traceability node. If it is the first one than it will become the representative one | |
* @param element | |
*/ | |
public void addEMFElement(AnnotatedElement element){ | |
if(element != null) | |
emfElements.add(element); | |
} | |
/** Adds the representative EMF element to the traceability node | |
* @param element | |
*/ | |
public void addRepresentativeElement(AnnotatedElement element){ | |
if(element != null) | |
{ | |
if(emfElements.get(0) != null) | |
{ | |
AnnotatedElement _temp = emfElements.get(0); | |
emfElements.add(0, element); | |
emfElements.add(_temp); | |
} | |
else | |
emfElements.add(0,element); | |
} | |
} | |
/** Return the representative EMF element. | |
* @return | |
*/ | |
public AnnotatedElement getRepresentativeEMFElement(){ | |
return emfElements.get(0); | |
} | |
public abstract VPMType getVPMElement(); | |
} |