All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jnario.impl.ExampleTableImpl Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2012 BMW Car IT and others.
 * 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
 *******************************************************************************/
package org.jnario.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.xtend.core.xtend.impl.XtendMemberImpl;
import org.jnario.ExampleColumn;
import org.jnario.ExampleRow;
import org.jnario.ExampleTable;
import org.jnario.JnarioPackage;

/**
 * 
 * An implementation of the model object 'Example Table'.
 * 
 * 

* The following features are implemented: *

    *
  • {@link org.jnario.impl.ExampleTableImpl#getName Name}
  • *
  • {@link org.jnario.impl.ExampleTableImpl#getRows Rows}
  • *
  • {@link org.jnario.impl.ExampleTableImpl#getColumns Columns}
  • *
*

* * @generated */ public class ExampleTableImpl extends XtendMemberImpl implements ExampleTable { /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getRows() Rows}' containment reference list. * * * @see #getRows() * @generated * @ordered */ protected EList rows; /** * The cached value of the '{@link #getColumns() Columns}' containment reference list. * * * @see #getColumns() * @generated * @ordered */ protected EList columns; /** * * * @generated */ protected ExampleTableImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return JnarioPackage.Literals.EXAMPLE_TABLE; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, JnarioPackage.EXAMPLE_TABLE__NAME, oldName, name)); } /** * * * @generated */ public EList getRows() { if (rows == null) { rows = new EObjectContainmentWithInverseEList(ExampleRow.class, this, JnarioPackage.EXAMPLE_TABLE__ROWS, JnarioPackage.EXAMPLE_ROW__TABLE); } return rows; } /** * * * @generated */ public EList getColumns() { if (columns == null) { columns = new EObjectContainmentWithInverseEList(ExampleColumn.class, this, JnarioPackage.EXAMPLE_TABLE__COLUMNS, JnarioPackage.EXAMPLE_COLUMN__TABLE); } return columns; } /** * * * @generated NOT */ public boolean isValid() { int columnCount = getColumns().size(); for (ExampleRow row : getRows()) { if(row.getCells().size() != columnCount){ return false; } } return true; } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__ROWS: return ((InternalEList)(InternalEList)getRows()).basicAdd(otherEnd, msgs); case JnarioPackage.EXAMPLE_TABLE__COLUMNS: return ((InternalEList)(InternalEList)getColumns()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__ROWS: return ((InternalEList)getRows()).basicRemove(otherEnd, msgs); case JnarioPackage.EXAMPLE_TABLE__COLUMNS: return ((InternalEList)getColumns()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__NAME: return getName(); case JnarioPackage.EXAMPLE_TABLE__ROWS: return getRows(); case JnarioPackage.EXAMPLE_TABLE__COLUMNS: return getColumns(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__NAME: setName((String)newValue); return; case JnarioPackage.EXAMPLE_TABLE__ROWS: getRows().clear(); getRows().addAll((Collection)newValue); return; case JnarioPackage.EXAMPLE_TABLE__COLUMNS: getColumns().clear(); getColumns().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__NAME: setName(NAME_EDEFAULT); return; case JnarioPackage.EXAMPLE_TABLE__ROWS: getRows().clear(); return; case JnarioPackage.EXAMPLE_TABLE__COLUMNS: getColumns().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case JnarioPackage.EXAMPLE_TABLE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case JnarioPackage.EXAMPLE_TABLE__ROWS: return rows != null && !rows.isEmpty(); case JnarioPackage.EXAMPLE_TABLE__COLUMNS: return columns != null && !columns.isEmpty(); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } @Override public boolean isStatic() { return false; } @Override public boolean isFinal() { return true; } } //ExampleTableImpl




© 2015 - 2025 Weber Informatics LLC | Privacy Policy