| /******************************************************************************* |
| * Copyright (c) 2009, 2019 Xored Software Inc and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.ecl.data.objects.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.rcptt.ecl.data.objects.Attribute; |
| import org.eclipse.rcptt.ecl.data.objects.ObjectsPackage; |
| import org.eclipse.rcptt.ecl.data.objects.Tree; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Tree</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.ecl.data.objects.impl.TreeImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.data.objects.impl.TreeImpl#getText <em>Text</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.data.objects.impl.TreeImpl#getAttributes <em>Attributes</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.data.objects.impl.TreeImpl#getChildren <em>Children</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TreeImpl extends EObjectImpl implements Tree { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getText() <em>Text</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getText() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TEXT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getText() <em>Text</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getText() |
| * @generated |
| * @ordered |
| */ |
| protected String text = TEXT_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Attribute> attributes; |
| |
| /** |
| * The cached value of the '{@link #getChildren() <em>Children</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getChildren() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Tree> children; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TreeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ObjectsPackage.Literals.TREE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ObjectsPackage.TREE__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getText() { |
| return text; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setText(String newText) { |
| String oldText = text; |
| text = newText; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ObjectsPackage.TREE__TEXT, oldText, text)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Attribute> getAttributes() { |
| if (attributes == null) { |
| attributes = new EObjectResolvingEList<Attribute>(Attribute.class, this, ObjectsPackage.TREE__ATTRIBUTES); |
| } |
| return attributes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Tree> getChildren() { |
| if (children == null) { |
| children = new EObjectResolvingEList<Tree>(Tree.class, this, ObjectsPackage.TREE__CHILDREN); |
| } |
| return children; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ObjectsPackage.TREE__NAME: |
| return getName(); |
| case ObjectsPackage.TREE__TEXT: |
| return getText(); |
| case ObjectsPackage.TREE__ATTRIBUTES: |
| return getAttributes(); |
| case ObjectsPackage.TREE__CHILDREN: |
| return getChildren(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ObjectsPackage.TREE__NAME: |
| setName((String)newValue); |
| return; |
| case ObjectsPackage.TREE__TEXT: |
| setText((String)newValue); |
| return; |
| case ObjectsPackage.TREE__ATTRIBUTES: |
| getAttributes().clear(); |
| getAttributes().addAll((Collection<? extends Attribute>)newValue); |
| return; |
| case ObjectsPackage.TREE__CHILDREN: |
| getChildren().clear(); |
| getChildren().addAll((Collection<? extends Tree>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ObjectsPackage.TREE__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case ObjectsPackage.TREE__TEXT: |
| setText(TEXT_EDEFAULT); |
| return; |
| case ObjectsPackage.TREE__ATTRIBUTES: |
| getAttributes().clear(); |
| return; |
| case ObjectsPackage.TREE__CHILDREN: |
| getChildren().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ObjectsPackage.TREE__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case ObjectsPackage.TREE__TEXT: |
| return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text); |
| case ObjectsPackage.TREE__ATTRIBUTES: |
| return attributes != null && !attributes.isEmpty(); |
| case ObjectsPackage.TREE__CHILDREN: |
| return children != null && !children.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); |
| result.append(name); |
| result.append(", text: "); |
| result.append(text); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //TreeImpl |