⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectionimpl.java

📁 对eclipse gef进行封装,可以生成图形化编辑器
💻 JAVA
字号:
/**
 * <copyright>
 * </copyright>
 *
 * $Id: ConnectionImpl.java,v 1.4 2006/12/30 02:45:06 niegy Exp $
 */
package com.primeton.studio.gef.core.impl;

import com.primeton.studio.gef.core.Connection;
import com.primeton.studio.gef.core.CorePackage;
import com.primeton.studio.gef.core.Diagram;
import com.primeton.studio.gef.core.NodeElement;

import com.primeton.studio.gef.core.TLineType;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Connection</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.primeton.studio.gef.core.impl.ConnectionImpl#getSourceNode <em>Source Node</em>}</li>
 *   <li>{@link com.primeton.studio.gef.core.impl.ConnectionImpl#getTargetNode <em>Target Node</em>}</li>
 *   <li>{@link com.primeton.studio.gef.core.impl.ConnectionImpl#getLineType <em>Line Type</em>}</li>
 *   <li>{@link com.primeton.studio.gef.core.impl.ConnectionImpl#getPriority <em>Priority</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ConnectionImpl extends ElementImpl implements Connection {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final String copyright = "";

	/**
	 * The cached value of the '{@link #getSourceNode() <em>Source Node</em>}' reference.
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @see #getSourceNode()
	 * @generated
	 * @ordered
	 */
    protected NodeElement sourceNode = null;

	/**
	 * The cached value of the '{@link #getTargetNode() <em>Target Node</em>}' reference.
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @see #getTargetNode()
	 * @generated
	 * @ordered
	 */
    protected NodeElement targetNode = null;

	/**
	 * The default value of the '{@link #getLineType() <em>Line Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineType()
	 * @generated
	 * @ordered
	 */
	protected static final TLineType LINE_TYPE_EDEFAULT = TLineType.COMMON_LITERAL;

	/**
	 * The cached value of the '{@link #getLineType() <em>Line Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLineType()
	 * @generated
	 * @ordered
	 */
	protected TLineType lineType = LINE_TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getPriority() <em>Priority</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPriority()
	 * @generated
	 * @ordered
	 */
	protected static final int PRIORITY_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getPriority() <em>Priority</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPriority()
	 * @generated
	 * @ordered
	 */
	protected int priority = PRIORITY_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    protected ConnectionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    protected EClass eStaticClass() {
		return CorePackage.Literals.CONNECTION;
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public NodeElement getSourceNode() {
		return sourceNode;
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public void setSourceNode(NodeElement newSourceNode) {
		NodeElement oldSourceNode = sourceNode;
		sourceNode = newSourceNode;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.CONNECTION__SOURCE_NODE, oldSourceNode, sourceNode));
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public NodeElement getTargetNode() {
		return targetNode;
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public void setTargetNode(NodeElement newTargetNode) {
		NodeElement oldTargetNode = targetNode;
		targetNode = newTargetNode;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.CONNECTION__TARGET_NODE, oldTargetNode, targetNode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TLineType getLineType() {
		return lineType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLineType(TLineType newLineType) {
		TLineType oldLineType = lineType;
		lineType = newLineType == null ? LINE_TYPE_EDEFAULT : newLineType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.CONNECTION__LINE_TYPE, oldLineType, lineType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getPriority() {
		return priority;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPriority(int newPriority) {
		int oldPriority = priority;
		priority = newPriority;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.CONNECTION__PRIORITY, oldPriority, priority));
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.CONNECTION__SOURCE_NODE:
				return getSourceNode();
			case CorePackage.CONNECTION__TARGET_NODE:
				return getTargetNode();
			case CorePackage.CONNECTION__LINE_TYPE:
				return getLineType();
			case CorePackage.CONNECTION__PRIORITY:
				return new Integer(getPriority());
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.CONNECTION__SOURCE_NODE:
				setSourceNode((NodeElement)newValue);
				return;
			case CorePackage.CONNECTION__TARGET_NODE:
				setTargetNode((NodeElement)newValue);
				return;
			case CorePackage.CONNECTION__LINE_TYPE:
				setLineType((TLineType)newValue);
				return;
			case CorePackage.CONNECTION__PRIORITY:
				setPriority(((Integer)newValue).intValue());
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.CONNECTION__SOURCE_NODE:
				setSourceNode((NodeElement)null);
				return;
			case CorePackage.CONNECTION__TARGET_NODE:
				setTargetNode((NodeElement)null);
				return;
			case CorePackage.CONNECTION__LINE_TYPE:
				setLineType(LINE_TYPE_EDEFAULT);
				return;
			case CorePackage.CONNECTION__PRIORITY:
				setPriority(PRIORITY_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
	 * @generated
	 */
    public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.CONNECTION__SOURCE_NODE:
				return sourceNode != null;
			case CorePackage.CONNECTION__TARGET_NODE:
				return targetNode != null;
			case CorePackage.CONNECTION__LINE_TYPE:
				return lineType != LINE_TYPE_EDEFAULT;
			case CorePackage.CONNECTION__PRIORITY:
				return priority != PRIORITY_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (lineType: ");
		result.append(lineType);
		result.append(", priority: ");
		result.append(priority);
		result.append(')');
		return result.toString();
	}

} //ConnectionImpl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -