當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicEList.shrink方法代碼示例

本文整理匯總了Java中org.eclipse.emf.common.util.BasicEList.shrink方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicEList.shrink方法的具體用法?Java BasicEList.shrink怎麽用?Java BasicEList.shrink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.common.util.BasicEList的用法示例。


在下文中一共展示了BasicEList.shrink方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEAllContainments

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
public EList<EReference> getEAllContainments()
{
  if (eAllContainments == null)
  {
    BasicEList<EReference> result = 
      new UniqueEList<EReference>()
      {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object [] newData(int capacity)
        {
          return new EReference [capacity];
        }

        @Override
        protected boolean useEquals()
        {
          return false;
        }
      };

    for (EReference eReference : getEAllReferences())
    {
      if (eReference.isContainment())
      {
        result.add(eReference);
      }
    }

    result.shrink();
    eAllContainments = 
      new EcoreEList.UnmodifiableEList.FastCompare<EReference>
        (this, EcorePackage.eINSTANCE.getEClass_EAllContainments(), result.size(), result.data()); 
    getESuperAdapter().setAllContainmentsCollectionModified(false);
  }

  return eAllContainments;
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:40,代碼來源:EClassImpl.java

示例2: getEAllReferences

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
public EList<EReference> getEAllReferences()
{
  if (eAllReferences == null)
  {
    class ReferenceList extends UniqueEList<EReference>
    {
      private static final long serialVersionUID = 1L;

      public ReferenceList()
      {
        super();
      }

      @Override
      protected Object [] newData(int capacity)
      {
        return new EReference [capacity];
      }

      @Override
      protected boolean useEquals()
      {
        return false;
      }
    }
    BasicEList<EReference> result = new ReferenceList();
    BasicEList<EReference> references = new ReferenceList();

    Set<EClass> computationInProgress = COMPUTATION_IN_PROGRESS.get();
    if (computationInProgress.add(this))
    {
      for (EClass eSuperType : getESuperTypes())
      {
        result.addAll(eSuperType.getEAllReferences());
      }
      computationInProgress.remove(this);
      if (computationInProgress.isEmpty())
      {
        COMPUTATION_IN_PROGRESS.remove();
      }
    }
    for (EStructuralFeature eStructuralFeature : getEStructuralFeatures())
    {
      if (eStructuralFeature instanceof EReference)
      {
        references.add((EReference)eStructuralFeature);
      }
    }

    references.shrink();
    eReferences = 
      new EcoreEList.UnmodifiableEList.FastCompare<EReference>
        (this, EcorePackage.eINSTANCE.getEClass_EReferences(), references.size(), references.data())
      {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public void addUnique(EReference object)
        {
          ((InternalEList<EReference>)(InternalEList<?>)getEStructuralFeatures()).addUnique(object);
        }

        @Override
        public boolean add(EReference object)
        {
          System.err.println("Please fix your code to add using EClass.getEStructuralFeatures() instead of EClass.getEReferences()");
          return getEStructuralFeatures().add(object);
        }
      };

    result.addAll(eReferences);
    result.shrink();
    eAllReferences = 
      new EcoreEList.UnmodifiableEList.FastCompare<EReference>
        (this, EcorePackage.eINSTANCE.getEClass_EAllReferences(), result.size(), result.data());
    getESuperAdapter().setAllReferencesCollectionModified(false);
  }

  return eAllReferences;
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:82,代碼來源:EClassImpl.java

示例3: getEAllOperations

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated modifiable
 */
public EList<EOperation> getEAllOperations()
{
  if (eAllOperations == null)
  {
    BasicEList<EOperation> result = 
      new UniqueEList<EOperation>()
      {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object [] newData(int capacity)
        {
          return new EOperation [capacity];
        }

        @Override
        protected boolean useEquals()
        {
          return false;
        }
      };

    Set<EClass> computationInProgress = COMPUTATION_IN_PROGRESS.get();
    if (computationInProgress.add(this))
    {
      for (EClass eSuperType : getESuperTypes())
      {
        result.addAll(eSuperType.getEAllOperations());
      }
      computationInProgress.remove(this);
      if (computationInProgress.isEmpty())
      {
        COMPUTATION_IN_PROGRESS.remove();
      }
    }
    int operationID = result.size();
    for (Iterator<EOperation> i = getEOperations().iterator(); i.hasNext(); ++operationID)
    {
      ((EOperationImpl)i.next()).setOperationID(operationID);
    }
    result.addAll(getEOperations());
    result.shrink();
    eAllOperations = 
      new EcoreEList.UnmodifiableEList.FastCompare<EOperation>
        (this, EcorePackage.eINSTANCE.getEClass_EAllOperations(), result.size(), result.data());
    eAllOperationsData = (EOperation[])result.data();
    if (eAllOperationsData == null)
    {
      eAllOperationsData = NO_EALL_OPERATIONS_DATA;
    }

    eOperationToOverrideMap = null; 

    getESuperAdapter().setAllOperationsCollectionModified(false);
  }

  return eAllOperations;
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:64,代碼來源:EClassImpl.java

示例4: getEAllSuperTypes

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
/**
 * Returns all the super types in the hierarchy.
 */
public EList<EClass> getEAllSuperTypes()
{
  if (eAllSuperTypes == null)
  {
    BasicEList<EClass> result = 
      new UniqueEList<EClass>()
      {
        private static final long serialVersionUID = 1L;

        @Override
        protected Object [] newData(int capacity)
        {
          return new EClassifier [capacity];
        }

        @Override
        protected boolean useEquals()
        {
          return false;
        }
      };

    Set<EClass> computationInProgress = COMPUTATION_IN_PROGRESS.get();
    if (computationInProgress.add(this))
    {
      for (EClass eSuperType : getESuperTypes())
      {
        EList<EClass> higherSupers = eSuperType.getEAllSuperTypes();
        result.addAll(higherSupers);
        result.add(eSuperType);
      }
      computationInProgress.remove(this);
    }

    result.shrink();
    eAllSuperTypes = 
      new EcoreEList.UnmodifiableEList.FastCompare<EClass>
        (this, EcorePackage.eINSTANCE.getEClass_EAllSuperTypes(), result.size(), result.data());
    getESuperAdapter().setAllSuperCollectionModified(false);
  }

  return eAllSuperTypes;
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:47,代碼來源:EClassImpl.java


注:本文中的org.eclipse.emf.common.util.BasicEList.shrink方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。