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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations