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

org.nasdanika.models.excel.impl.RowSheetImpl Maven / Gradle / Ivy

/**
 */
package org.nasdanika.models.excel.impl;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.OptionalInt;

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.util.InternalEList;

import org.nasdanika.models.excel.CellRow;
import org.nasdanika.models.excel.ExcelFactory;
import org.nasdanika.models.excel.ExcelPackage;
import org.nasdanika.models.excel.Row;
import org.nasdanika.models.excel.RowSheet;

/**
 * 
 * An implementation of the model object 'Row Sheet'.
 * 
 * 

* The following features are implemented: *

*
    *
  • {@link org.nasdanika.models.excel.impl.RowSheetImpl#getRows Rows}
  • *
* * @generated */ public class RowSheetImpl extends SheetImpl implements RowSheet { /** * * * @generated */ protected RowSheetImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return ExcelPackage.Literals.ROW_SHEET; } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public EList getRows() { return (EList)eDynamicGet(ExcelPackage.ROW_SHEET__ROWS, ExcelPackage.Literals.ROW_SHEET__ROWS, true, true); } /** * * * @generated NOT */ @Override public CellRow addCellRow() { CellRow cellRow = ((ExcelFactory) eClass().getEPackage().getEFactoryInstance()).createCellRow(); OptionalInt maxRow = getRows().stream().mapToInt(Row::getNumber).max(); cellRow.setNumber(maxRow.orElse(-1) + 1); getRows().add(cellRow); return cellRow; } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExcelPackage.ROW_SHEET__ROWS: return ((InternalEList)getRows()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExcelPackage.ROW_SHEET__ROWS: return getRows(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExcelPackage.ROW_SHEET__ROWS: getRows().clear(); getRows().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExcelPackage.ROW_SHEET__ROWS: getRows().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExcelPackage.ROW_SHEET__ROWS: return !getRows().isEmpty(); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public Object eInvoke(int operationID, EList arguments) throws InvocationTargetException { switch (operationID) { case ExcelPackage.ROW_SHEET___ADD_CELL_ROW: return addCellRow(); } return super.eInvoke(operationID, arguments); } } //RowSheetImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy