Java 类org.eclipse.emf.ecore.util.EContentsEList 实例源码

项目:xtext-core    文件:EcoreUtil2.java   
/**
 * @since 2.6
 */
public static Iterator<EObject> getNonDerivedContents(EObject eObject) {
    EClassImpl.FeatureSubsetSupplier featureSupplier = (EClassImpl.FeatureSubsetSupplier) eObject.eClass().getEAllStructuralFeatures();
    EStructuralFeature[] eStructuralFeatures = featureSupplier.containments();

    return (eStructuralFeatures == null 
            ? EContentsEList.<EObject> emptyContentsEList()
            : new EContentsEList<EObject>(eObject, eStructuralFeatures) {
                @Override
                protected ListIterator<EObject> newResolvingListIterator() {
                    return new ResolvingFeatureIteratorImpl<EObject>(eObject, eStructuralFeatures) {
                        @Override
                        protected boolean isIncluded(EStructuralFeature eStructuralFeature) {
                            return !eStructuralFeature.isDerived();
                        }
                    };
                }
            }).iterator();
}
项目:MMINT    文件:ICMT15.java   
private List<String> generateModelEncodings(@NonNull EObject inputRootModelObj) {

        List<String> modelEncodings = new ArrayList<>();
        TreeIterator<EObject> iter = inputRootModelObj.eAllContents();
        while (iter.hasNext()) {
            EObject modelObj = iter.next();
            try {
                modelEncodings.add(getModelObjectEncoding(modelObj));
                EContentsEList.FeatureIterator<EObject> crossIter = (EContentsEList.FeatureIterator<EObject>) modelObj.eCrossReferences().iterator();
                while (crossIter.hasNext()) {
                    modelEncodings.add(getModelReferenceEncoding(modelObj, crossIter.next(), crossIter.feature()));
                }
            }
            catch (MMINTException e) {
                continue;
            }
        }

        return modelEncodings;
    }
项目:emf-fragments    文件:FInternalObjectImpl.java   
private EList<EObject> eContentsWithOutFragments() {
    EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) this.eClass().getEAllStructuralFeatures()).containments();
    EStructuralFeature[] eStructuralFeaturesWithOutFragmentsArray = null;
    if (eStructuralFeatures != null) {
        List<EStructuralFeature> eStructuralFeaturesWithOutFragments = new ArrayList<EStructuralFeature>(eStructuralFeatures.length);
        for (EStructuralFeature eStructuralFeature : eStructuralFeatures) {
            FragmentationType fragmentationType = EMFFragUtil.getFragmentationType(eStructuralFeature);
            if (fragmentationType == FragmentationType.None || eStructuralFeature instanceof EAttribute) {
                eStructuralFeaturesWithOutFragments.add(eStructuralFeature);
            }
        }
        eStructuralFeaturesWithOutFragmentsArray = eStructuralFeaturesWithOutFragments
                .toArray(new EStructuralFeature[eStructuralFeaturesWithOutFragments.size()]);
    }

    EContentsEList<EObject> eContentsEListWithOutFragments = eStructuralFeaturesWithOutFragmentsArray == null ? EContentsEList
            .<EObject> emptyContentsEList() : new EContentsEList<EObject>(this, eStructuralFeaturesWithOutFragmentsArray);

    return eContentsEListWithOutFragments;
}
项目:statecharts    文件:CrossDocumentContentAdapter.java   
@Override
protected void setTarget(EObject target) {
    super.setTarget(target);
    for (EContentsEList.FeatureIterator<EObject> featureIterator = (EContentsEList.FeatureIterator<EObject>) target
            .eCrossReferences().iterator(); featureIterator.hasNext();) {
        Notifier notifier = featureIterator.next();
        EStructuralFeature feature = featureIterator.feature();
        if (shouldAdapt(feature)) {
            addAdapter(notifier);
        }
    }
}
项目:statecharts    文件:CrossDocumentContentAdapter.java   
@Override
protected void unsetTarget(EObject target) {
    super.unsetTarget(target);
    for (EContentsEList.FeatureIterator<EObject> featureIterator = (EContentsEList.FeatureIterator<EObject>) target
            .eCrossReferences().iterator(); featureIterator.hasNext();) {
        Notifier notifier = featureIterator.next();
        EStructuralFeature feature = featureIterator.feature();
        if (shouldAdapt(feature)) {
            removeAdapter(notifier);
        }
    }
}
项目:eclipse-avro    文件:FlatEObjectImpl.java   
@Override
public EList<EObject> eContents()
{
  if (eContents == null)
  {
    eContents = EContentsEList.createEContentsEList(this);
  }
  return eContents;
}
项目:eclipse-avro    文件:BasicEObjectImpl.java   
public EList<EObject> eContents()
{
  EList<EObject> result = eProperties().getEContents();
  if (result == null)
  {
    eBasicProperties().setEContents(result = EContentsEList.createEContentsEList(this));
  }

  return result;
}
项目:clickwatch    文件:FlatEObjectImpl.java   
@Override
public EList<EObject> eContents()
{
  if (eContents == null)
  {
    eContents = EContentsEList.createEContentsEList(this);
  }
  return eContents;
}
项目:clickwatch    文件:BasicEObjectImpl.java   
public EList<EObject> eContents()
{
  EList<EObject> result = eProperties().getEContents();
  if (result == null)
  {
    eBasicProperties().setEContents(result = EContentsEList.createEContentsEList(this));
  }

  return result;
}
项目:eclipse-avro    文件:ENamedElementImpl.java   
@Override
public EList<EObject> eContents()
{
  EStructuralFeature [] eStructuralFeatures = 
    ((EClassImpl.FeatureSubsetSupplier)eClass().getEAllStructuralFeatures()).containments();

  return
    eStructuralFeatures == null ?
      EContentsEList.<EObject>emptyContentsEList() :
      new EContentsEList<EObject>(this, eStructuralFeatures)
      {
        @Override
        protected boolean useIsSet()
        {
          return false;
        }

        @Override
        protected ListIterator<EObject> newResolvingListIterator()
        {
          return 
            new ResolvingFeatureIteratorImpl<EObject>(eObject, eStructuralFeatures)
            {
              @Override
              protected boolean useIsSet()
              {
                return false;
              }
            };
        }

        @Override
        protected ListIterator<EObject> newNonResolvingListIterator()
        {
          return 
            new FeatureIteratorImpl<EObject>(eObject, eStructuralFeatures)
            {
              @Override
              protected boolean useIsSet()
              {
                return false;
              }
            };
        }

      };
}
项目:eclipse-avro    文件:MinimalEObjectImpl.java   
@Override
public EList<EObject> eContents()
{
  return EContentsEList.createEContentsEList(this);
}
项目:clickwatch    文件:ENamedElementImpl.java   
@Override
public EList<EObject> eContents()
{
  EStructuralFeature [] eStructuralFeatures = 
    ((EClassImpl.FeatureSubsetSupplier)eClass().getEAllStructuralFeatures()).containments();

  return
    eStructuralFeatures == null ?
      EContentsEList.<EObject>emptyContentsEList() :
      new EContentsEList<EObject>(this, eStructuralFeatures)
      {
        @Override
        protected boolean useIsSet()
        {
          return false;
        }

        @Override
        protected ListIterator<EObject> newResolvingListIterator()
        {
          return 
            new ResolvingFeatureIteratorImpl<EObject>(eObject, eStructuralFeatures)
            {
              @Override
              protected boolean useIsSet()
              {
                return false;
              }
            };
        }

        @Override
        protected ListIterator<EObject> newNonResolvingListIterator()
        {
          return 
            new FeatureIteratorImpl<EObject>(eObject, eStructuralFeatures)
            {
              @Override
              protected boolean useIsSet()
              {
                return false;
              }
            };
        }

      };
}
项目:clickwatch    文件:MinimalEObjectImpl.java   
@Override
public EList<EObject> eContents()
{
  return EContentsEList.createEContentsEList(this);
}
项目:eclectic    文件:StreamedEmfModel.java   
@Override
public Collection<Object> receive(IStreamedFragment<EObject, ?> frg) {
    EmfFragment fragment = (EmfFragment) frg;
    LinkedList<Object> newObjects = new LinkedList<Object>();

    // System.out.println("Received: " + receivedObjectsByKey.size());

    Object[] objects = fragment.getObjects();
    for(int i = 0; i < objects.length; i++) {
        EObject eobject = (EObject) objects[i];
        if ( ! classesWithoutKey.contains(eobject.eClass().getName()) ) {
            String key = findKey(eobject, explicitKey);
            if ( key != null ) {

                if ( receivedObjectsByKey.containsKey(key) ) {
                    // System.out.println("* " + eobject);
                    for(int j = 0; j < objects.length; j++) {
                        EContentsEList.FeatureIterator it = (EContentsEList.FeatureIterator) ((EObject) objects[j]).eCrossReferences().iterator();
                        while ( it.hasNext() ) {
                            EObject refObject = (EObject) it.next();
                            if ( refObject == eobject ) {
                                EStructuralFeature f = it.feature();
                                EcoreUtil.replace((EObject) objects[j], f, eobject, receivedObjectsByKey.get(key));
                            }
                        }
                    }
                    // System.out.println(eobject.eCrossReferences());
                    // REPLACE THE ARRIVED OBJECT WITH THE EXISTING ONE!!
                    //((EObject) objects[i]).ese
                    // Force opposite...
                    continue;
                }

                receivedObjectsByKey.put(key, (EObject) objects[i]);
            }
        }

        newObjects.add(objects[i]);
        handler.addToResource((EObject) objects[i]);
    }
    // handler.packRootElements();

    // TODO: Now assuming the same proxy is not referenced from several places
    IsProxyAnnotation[] annotations = fragment.getProxyAnnotations();
    for(int i = 0; i < annotations.length; i++) {
        EObject object = (EObject) annotations[i].getObject();
        String k       = findKey(object, false);
        if ( receivedObjectsByKey.containsKey(k) ) {
            EObject realObj = receivedObjectsByKey.get(k);

            // TODO: Assuming mono-valued reference
            EcoreUtil.replace(annotations[i].getReferenceSource(), 
                    annotations[i].getObject().eClass().getEStructuralFeature(annotations[i].getReferenceName()), 
                    object, realObj);

            // Now it seems that it does not work
            // EcoreUtil.replace(object, realObj);
        } 
        else {
            // Needed for "needsWaiting"
            proxiesTemp.put(object, annotations[i]);            
        }
    }

    return newObjects;
}