Search in sources :

Example 41 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project mechanoid by robotoworks.

the class ResultGenerator method mergeMembers.

public EList<Member> mergeMembers(final ComplexTypeLiteral a, final ComplexTypeLiteral b) {
    HashMap<String, Member> members = new HashMap<String, Member>();
    boolean _notEquals = (!Objects.equal(a, null));
    if (_notEquals) {
        EList<Member> _members = a.getMembers();
        for (final Member m : _members) {
            String _name = m.getName();
            members.put(_name, m);
        }
    }
    boolean _notEquals_1 = (!Objects.equal(b, null));
    if (_notEquals_1) {
        EList<Member> _members_1 = b.getMembers();
        for (final Member m_1 : _members_1) {
            String _name_1 = m_1.getName();
            boolean _containsKey = members.containsKey(_name_1);
            boolean _not = (!_containsKey);
            if (_not) {
                String _name_2 = m_1.getName();
                members.put(_name_2, m_1);
            }
        }
    }
    Collection<Member> _values = members.values();
    return new BasicEList<Member>(_values);
}
Also used : HashMap(java.util.HashMap) BasicEList(org.eclipse.emf.common.util.BasicEList) TypedMember(com.robotoworks.mechanoid.net.netModel.TypedMember) Member(com.robotoworks.mechanoid.net.netModel.Member) SkipMember(com.robotoworks.mechanoid.net.netModel.SkipMember)

Example 42 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project vorto by eclipse.

the class ModelConversionUtils method getFlatConfigProperties.

private static List<Property> getFlatConfigProperties(FunctionblockModel fbm) {
    EList<Property> properties = new BasicEList<Property>();
    TreeIterator<EObject> iter = fbm.eAllContents();
    while (iter.hasNext()) {
        EObject obj = iter.next();
        if (obj instanceof Property) {
            Property property = (Property) obj;
            if (property.eContainer() instanceof Configuration) {
                properties.add(copyProperty(property));
                if (property.getType() instanceof ObjectPropertyType) {
                    ObjectPropertyType objectType = (ObjectPropertyType) property.getType();
                    if (objectType.getType() instanceof Entity) {
                        // only flatten entities
                        Entity entity = (Entity) ((ObjectPropertyType) property.getType()).getType();
                        EList<Property> entityProperties = getFlatProperties(entity);
                        entity.getProperties().addAll(entityProperties);
                        if (entity.getSuperType() != null) {
                            removeSuperTypeModelReference(entity);
                        }
                        entity.getProperties().stream().filter(p -> p.getType() instanceof ObjectPropertyType).forEach(p -> createReference(entity, (ObjectPropertyType) p.getType()));
                    }
                }
            }
        }
    }
    if (fbm.getSuperType() != null) {
        properties.addAll(getFlatConfigProperties(fbm.getSuperType()));
    }
    return properties;
}
Also used : InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) java.util(java.util) BasicEList(org.eclipse.emf.common.util.BasicEList) ModelIdFactory(org.eclipse.vorto.core.api.model.model.ModelIdFactory) Operation(org.eclipse.vorto.core.api.model.functionblock.Operation) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) PropertyTypeImpl(org.eclipse.internal.xtend.type.baseimpl.types.PropertyTypeImpl) PropertyAttribute(org.eclipse.vorto.core.api.model.datatype.PropertyAttribute) Configuration(org.eclipse.vorto.core.api.model.functionblock.Configuration) EcoreEList(org.eclipse.emf.ecore.util.EcoreEList) BooleanPropertyAttribute(org.eclipse.vorto.core.api.model.datatype.BooleanPropertyAttribute) Entity(org.eclipse.vorto.core.api.model.datatype.Entity) ModelFactory(org.eclipse.vorto.core.api.model.model.ModelFactory) Function(java.util.function.Function) DictionaryPropertyType(org.eclipse.vorto.core.api.model.datatype.DictionaryPropertyType) Model(org.eclipse.vorto.core.api.model.model.Model) PrimitivePropertyType(org.eclipse.vorto.core.api.model.datatype.PrimitivePropertyType) DatatypePackage(org.eclipse.vorto.core.api.model.datatype.DatatypePackage) Property(org.eclipse.vorto.core.api.model.datatype.Property) FunctionblockFactory(org.eclipse.vorto.core.api.model.functionblock.FunctionblockFactory) DatatypeFactory(org.eclipse.vorto.core.api.model.datatype.DatatypeFactory) MeasurementSystem(com.ibm.icu.util.LocaleData.MeasurementSystem) TreeIterator(org.eclipse.emf.common.util.TreeIterator) ModelReference(org.eclipse.vorto.core.api.model.model.ModelReference) PropertyType(org.eclipse.vorto.core.api.model.datatype.PropertyType) Predicate(java.util.function.Predicate) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) EcoreUtil(org.eclipse.emf.ecore.util.EcoreUtil) ConfigurationImpl(org.eclipse.vorto.core.api.model.functionblock.impl.ConfigurationImpl) EObject(org.eclipse.emf.ecore.EObject) EnumLiteralPropertyAttribute(org.eclipse.vorto.core.api.model.datatype.EnumLiteralPropertyAttribute) Collectors(java.util.stream.Collectors) EList(org.eclipse.emf.common.util.EList) FunctionblockModel(org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel) Status(org.eclipse.vorto.core.api.model.functionblock.Status) BooleanAttribute(com.ibm.icu.text.DateFormat.BooleanAttribute) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) FunctionBlock(org.eclipse.vorto.core.api.model.functionblock.FunctionBlock) PrimitiveType(org.eclipse.vorto.core.api.model.datatype.PrimitiveType) Entity(org.eclipse.vorto.core.api.model.datatype.Entity) Configuration(org.eclipse.vorto.core.api.model.functionblock.Configuration) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) BasicEList(org.eclipse.emf.common.util.BasicEList) EObject(org.eclipse.emf.ecore.EObject) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) Property(org.eclipse.vorto.core.api.model.datatype.Property)

Example 43 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project vorto by eclipse.

the class ModelConversionUtils method getFlatProperties.

private static EList<Property> getFlatProperties(Entity entity) {
    EList<Property> properties = new BasicEList<Property>();
    TreeIterator<EObject> iter = entity.eAllContents();
    while (iter.hasNext()) {
        EObject obj = iter.next();
        if (obj instanceof Property) {
            Property property = (Property) obj;
            properties.add(copyProperty(property));
        }
    }
    if (entity.getSuperType() != null) {
        properties.addAll(getFlatProperties(entity.getSuperType()));
    }
    return properties;
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) EObject(org.eclipse.emf.ecore.EObject) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) Property(org.eclipse.vorto.core.api.model.datatype.Property)

Example 44 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project vorto by eclipse.

the class Utils method getReferencedTypes.

public static EList<Type> getReferencedTypes(Property property) {
    BasicEList<Type> types = new BasicEList<Type>();
    if (property.getType() instanceof ObjectPropertyType) {
        ObjectPropertyType objectType = (ObjectPropertyType) property.getType();
        types.add(objectType.getType());
        if (objectType.getType() instanceof Entity) {
            types.addAll(getReferencedTypes((Entity) objectType.getType()));
        }
    }
    return types;
}
Also used : Entity(org.eclipse.vorto.core.api.model.datatype.Entity) ReturnObjectType(org.eclipse.vorto.core.api.model.functionblock.ReturnObjectType) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) Type(org.eclipse.vorto.core.api.model.datatype.Type) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 45 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project vorto by eclipse.

the class Utils method getReferencedTypes.

public static EList<Type> getReferencedTypes(Type type) {
    BasicEList<Type> types = new BasicEList<Type>();
    types.add(type);
    if (type instanceof Entity) {
        Entity entityType = (Entity) type;
        for (Property property : entityType.getProperties()) {
            types.addAll(getReferencedTypes(property));
        }
        types.add(entityType.getSuperType());
    }
    return types;
}
Also used : Entity(org.eclipse.vorto.core.api.model.datatype.Entity) ReturnObjectType(org.eclipse.vorto.core.api.model.functionblock.ReturnObjectType) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) Type(org.eclipse.vorto.core.api.model.datatype.Type) BasicEList(org.eclipse.emf.common.util.BasicEList) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) Property(org.eclipse.vorto.core.api.model.datatype.Property)

Aggregations

BasicEList (org.eclipse.emf.common.util.BasicEList)82 Test (org.junit.Test)25 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)16 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)16 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)16 EEFFeatureEditorDialog (org.eclipse.emf.eef.runtime.ui.widgets.EEFFeatureEditorDialog)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)16 GridData (org.eclipse.swt.layout.GridData)16 EObject (org.eclipse.emf.ecore.EObject)13 TdExpression (org.talend.cwm.relational.TdExpression)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)9 Button (org.eclipse.swt.widgets.Button)8 EList (org.eclipse.emf.common.util.EList)7 ObjectPropertyType (org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType)7 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)7 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)7 ProductVersion (org.talend.utils.ProductVersion)7 Property (org.eclipse.vorto.core.api.model.datatype.Property)6 FunctionblockProperty (org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)6