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


Java BasicEList.data方法代碼示例

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


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

示例1: getPositions

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
/**
 * Lifted from the removeAll method in NotifyingListImpl. (and simplified)
 * 
 * @param <T>
 * @param data
 * @param collection
 * @return
 */
public static <T> int[] getPositions(EList<T> data, List<? extends T> collection) {
	int listSize = collection.size();
	int [] positions = new int [listSize];
	int count = 0;
	BasicEList<Object> list = new BasicEList<Object>(collection);
       Object[] objects = list.data();
	for (int i = 0; i < data.size(); ++i) {
		@SuppressWarnings("unchecked") T initialObject = data.get(i);
		T object = initialObject;
		LOOP:
		for (int repeat = 0; repeat < 2; ++repeat) {
			for (int j = listSize; --j >= 0; ) {
				if (object == objects[j]) {
					if (positions.length <= count) {
						int [] oldPositions = positions;
						positions = new int [2 * positions.length];
						System.arraycopy(oldPositions, 0, positions, 0, count);
					}
					positions[count++] = i;
					break LOOP;
				}
			}
			if (object == initialObject) {
				break;
			}
		}
	}
	return positions;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:38,代碼來源:Util.java

示例2: remove

import org.eclipse.emf.common.util.BasicEList; //導入方法依賴的package包/類
public void remove(EObject eObject, EReference eReference, EObject crossReferencedEObject)
{
  if (!resolve())
  {
    removeProxy(crossReferencedEObject, eObject);
  }
  BasicEList<EStructuralFeature.Setting> collection = (BasicEList<EStructuralFeature.Setting>)get(crossReferencedEObject);
  if (collection != null)
  {
    EStructuralFeature.Setting [] settingData =  (EStructuralFeature.Setting[])collection.data();
    for (int i = 0, size = collection.size(); i < size; ++i)
    {
      EStructuralFeature.Setting setting = settingData[i];
      if (setting.getEObject() == eObject && setting.getEStructuralFeature() == eReference)
      {
        if (collection.size() == 1)
        {
          super.remove(crossReferencedEObject);  
        }
        else
        {
          collection.remove(i);
        }
        break;
      }
    }
  }      
}
 
開發者ID:LangleyStudios,項目名稱:eclipse-avro,代碼行數:29,代碼來源:ECrossReferenceAdapter.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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.data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。