Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
*
*/
package edelta.lib;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
* Static utility functions acting on Ecore and EObject elements.
*
* @author Lorenzo Bettini
*
*/
public class EdeltaEcoreUtil {
private EdeltaEcoreUtil() {
// empty constructor never to be called
}
/**
* If the value of the {@link EObject} o for the {@link EStructuralFeature}
* feature is set it returns a singleton collection with that value, otherwise
* it returns an empty collection. For multiple features, it returns the
* collection value.
*
* This way, it is possible to iterate to the result of
* {@link EObject#eGet(EStructuralFeature)}, uniformly without checking for null
* values.
*
* Moreover, the limit allows the returned collection to contain at most limit
* elements. When -1 is passed it means no limit. Typically one passes the
* result of {@link EStructuralFeature#getUpperBound()} of the feature of the
* object that is meant to contain the (typically) preprocessed values.
*
* @param o
* @param feature
* @param limit size limit for the returned collection, -1 means unlimited
* @return
*/
public static Collection