| /******************************************************************************* |
| * Copyright (c) 2004-2008 Andras Balogh 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: |
| * Andras Balogh - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.imports.vtml;
|
|
|
| import org.eclipse.viatra2.core.IEntity; |
| import org.eclipse.viatra2.core.IModelManager; |
| import org.eclipse.viatra2.core.IModelSpace; |
| import org.eclipse.viatra2.errors.VPMCoreException; |
| import org.eclipse.viatra2.logger.Logger; |
|
|
| /**
|
| * @author babo
|
| *
|
| * TODO To change the template for this generated type comment go to
|
| * Window - Preferences - Java - Code Style - Code Templates
|
| */
|
| public abstract class RelationshipDefinition extends ASTNode {
|
| IEntity element = null;
|
|
|
|
|
| public RelationshipDefinition(int l,String n,String m, String s)
|
| {
|
| master = m;
|
| slave = s;
|
| setLine(l);
|
| ns = n;
|
| }
|
| String master;
|
| String slave;
|
| String ns;
|
| ElementDefinition _mstr = null;
|
| ElementDefinition _slv = null;
|
|
|
| /* (non-Javadoc)
|
| * @see org.eclipse.viatra2.imports.vtcl.ASTNode#checkDefintion(org.eclipse.viatra2.imports.vtcl.ASTBuilder, org.eclipse.viatra2.core.IModelSpace)
|
| */
|
| public boolean checkDefintion(ASTBuilder ab, IModelSpace m) {
|
| Logger log = ab.log;
|
| _mstr = ab.getElementWithLookup(ns,master);
|
| if (_mstr==null)
|
| {
|
| log.error("Supplier end of relationship ("+master+") does not exists in the modelspace. Error in line "+getLine());
|
| return false;
|
| }
|
|
|
| if (slave!=null)
|
| {
|
| _slv = ab.getElementWithLookup(ns,slave);
|
| if (_slv==null)
|
| {
|
| log.error("Client end of relationship ("+slave+") does not exists in the modelspace. Error in line "+getLine());
|
| return false;
|
| }
|
| }
|
| return true;
|
| }
|
|
|
| /* (non-Javadoc)
|
| * @see org.eclipse.viatra2.imports.vtcl.ASTNode#generateElements(org.eclipse.viatra2.imports.vtcl.ASTBuilder, org.eclipse.viatra2.core.IModelSpace, org.eclipse.viatra2.core.IEntity)
|
| */
|
| public void generateElements(ASTBuilder ab, IModelSpace m, IEntity temp)
|
| throws VPMCoreException {
|
|
|
| }
|
|
|
|
|
| /* (non-Javadoc)
|
| * @see org.eclipse.viatra2.imports.vtcl.ASTNode#updateModelspace(org.eclipse.viatra2.imports.vtcl.ASTBuilder, org.eclipse.viatra2.core.IModelSpace)
|
| */
|
| IModelManager mm;
|
| public void updateModelspace(ASTBuilder ab, IModelSpace m)
|
| throws VPMCoreException {
|
|
|
|
|
| }
|
|
|
| /**
|
| * @return Returns the master.
|
| */
|
| public String getMaster() {
|
| return master;
|
| }
|
| /**
|
| * @param master The master to set.
|
| */
|
| public void setMaster(String master) {
|
| this.master = master;
|
| }
|
| /**
|
| * @return Returns the slave.
|
| */
|
| public String getSlave() {
|
| return slave;
|
| }
|
| /**
|
| * @param slave The slave to set.
|
| */
|
| public void setSlave(String slave) {
|
| this.slave = slave;
|
| }
|
| }
|