| /******************************************************************************* |
| * 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.searchgraph;
|
|
|
| import java.util.Vector;
|
| |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.searchgraph.AbstractNode; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.searchgraph.SearchGraphEdge; |
| import org.eclipse.viatra2.gtasm.patternmatcher.impl.patternmatcher.internal.searchgraph.traceability.AbstractTraceabilityElement; |
|
|
|
|
| public abstract class SearchGraphNode extends AbstractNode implements Comparable{
|
|
|
|
|
| private Vector<SearchGraphEdge> Sources;
|
| private SearchGraphEdge treeEdge = null;
|
| private SearchGraphNode VirtualSearchGraphNode = null;
|
| private int outgoingTreeEdgeNumber = 0;
|
|
|
| public SearchGraphNode() {
|
| super();
|
| Sources = new Vector<SearchGraphEdge>();
|
| outgoingTreeEdgeNumber = 0;
|
|
|
| }
|
| public void addSource(SearchGraphEdge enode){
|
| this.Sources.add(enode);
|
| }
|
| public Vector<SearchGraphEdge> getSources(){
|
| return Sources;
|
| }
|
| public SearchGraphNode getVirtualSearchGraphNode() {
|
| return VirtualSearchGraphNode;
|
| }
|
| public void setVirtualSearchGraphNode(SearchGraphNode virtualVertex) {
|
| this.VirtualSearchGraphNode = virtualVertex;
|
| }
|
| public SearchGraphEdge getTreeEdge() {
|
| return treeEdge;
|
| }
|
| public void setTreeEdge(SearchGraphEdge treeEdge) {
|
| this.treeEdge = treeEdge;
|
| }
|
| public int getOutgoingTreeEdgeNumber() {
|
| return outgoingTreeEdgeNumber;
|
| }
|
| public void setOutgoingTreeEdgeNumber(int outgoingTreeEdge) {
|
| this.outgoingTreeEdgeNumber = outgoingTreeEdge;
|
| }
|
| public void increaseOutgonigTreeEdgeNumber(){
|
| outgoingTreeEdgeNumber++;
|
| }
|
|
|
| public void decreaseOutgoingTreeEdgeNumber(){
|
| outgoingTreeEdgeNumber--;
|
| }
|
| public int compareTo(Object o) {
|
| if (o instanceof SearchGraphNode)
|
| {SearchGraphNode node = (SearchGraphNode) o;
|
| if(this.treeEdge.getOldWeight() < node.getTreeEdge().getOldWeight())
|
| return -1;
|
| else
|
| if(this.treeEdge.getOldWeight() == node.getTreeEdge().getOldWeight())
|
| //because of the set there can be no matching
|
| return 0;
|
| else
|
| return 1;
|
| }
|
|
|
| return 0;
|
| } |
|
|
| }
|