Java 类org.eclipse.emf.common.util.BasicEMap 实例源码

项目:emfstore-rest    文件:VersionImpl.java   
/**
 * Loads the XMI IDs from the given resource and returns them in a map
 * together with the object each ID belongs to.
 * 
 * @param resource
 *            the resource from which to load the ID mappings
 * @return a map consisting of object/id mappings, if the resource doesn't
 *         contain an eobject/id mapping null will be returned
 */
private EMap<EObject, String> loadIdsFromResourceForEObjects(Set<EObject> modelElements, XMIResource xmiResource) {

    EMap<EObject, String> eObjectToIdMap;

    if (xmiResource != null) {
        // guess a rough initial size by looking at the size of the contents
        eObjectToIdMap = new BasicEMap<EObject, String>(xmiResource.getContents().size());

        for (EObject eObject : modelElements) {
            String objId = xmiResource.getID(eObject);
            if (objId != null) {
                eObjectToIdMap.put(eObject, objId);
            }
        }

        return eObjectToIdMap;
    }

    return null;
}
项目:osate2-agcl    文件:AgclTransform.java   
public T defaultCase(EObject source) {
        Logger.getLogger(getClass()).debug(String.format(" %s+ transforming: '%20s' | %s", AGCLUtil.spaces(indent), serializer.serialize(source), source));
        T target = null; // = AgclPackage.eINSTANCE.getEClassifier(source.eClass());
//      EList<EObject> contents = source.eContents();
        EClass srcClass = source.eClass();
        EList<EStructuralFeature> features = srcClass.getEStructuralFeatures();
        EMap<EStructuralFeature, T> childrenResults = new BasicEMap<EStructuralFeature, T>();
        indent += 4;
//      for (EObject obj: contents) {
        for (EStructuralFeature feature: features) {
            Object obj = source.eGet(feature);
            Logger.getLogger(getClass()).debug(String.format("feature: '%s':'%s' ", feature,obj));
            if (obj instanceof EObjectContainmentEList) {
                EObjectContainmentEList<EObject> eocl = (EObjectContainmentEList<EObject>) obj;
            }
            if (obj instanceof EObject) {
                EObject eobj = (EObject) obj;
                Logger.getLogger(getClass()).debug(String.format("%s- child:        '%20s' | %s", AGCLUtil.spaces(indent), serializer.serialize(eobj), eobj));
                T childResult = doSwitch(eobj);
                childrenResults.put(feature, childResult);
            }
        }
        indent -= 4;
        target = function.apply(childrenResults);
        return target;
    }
项目:Saturn    文件:SaturnDocLoadSaveUtil.java   
private static void addXmlNsPrefixes(SaturnResourceImpl saturnResourceImpl_)
{
  EList<EObject> contents = saturnResourceImpl_.getContents();
  if (contents.size() <= 0) return;
  if (!(contents.get(0) instanceof DocumentRoot)) return;

  DocumentRoot documentRoot = (DocumentRoot) contents.get(0);

  List<BasicEMap.Entry<String, String>> xmlNsList = getXmlNsList();
  for (BasicEMap.Entry<String, String> newEntry : xmlNsList)
  {
    documentRoot.getXMLNSPrefixMap().add(newEntry);
  }
}
项目:xtext-extras    文件:JavaEMFFile.java   
public String importedGenTypeName(EClass clazz) {
    GenClass gc = GenModelAccess.getGenClass(clazz, resourceSet);
    if (gc.isMapEntry()) {
        String entryType = imported(BasicEMap.Entry.class);
        return entryType + "<?, ?>";
    }
    return imported(gc.getQualifiedInterfaceName());
}
项目:osate2-agcl    文件:AnalysisResults.java   
public AnalysisResults(Resource resourceContext) {
    allResults = new BasicEMap<String, EMap<String, VerificationResult>>();
    viewpointCollection = AGCLAnalysisPlugin.getDefault().getActiveModelChecker().getViewpointCollection();
    componentCollection = AGCLAnalysisPlugin.getDefault().getActiveModelChecker().getComponentCollection();
    this.resultsFolder = AGCLUtil.openResultsDir(resourceContext);
    this.resourceContext = resourceContext;
    resultsCollection = AGCLAnalysisPlugin.getDefault().getActiveModelChecker().getResults();
    resourceSet = new ResourceSetImpl();
    serializer = AGCLAnalysisPlugin.getDefault().getSerializer();
}
项目:clickwatch    文件:ClickSocketXSDDummy.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private <X,Y> EMap<X, Y> copyEMap(EMap<X, Y> orig) {
    EMap<X, Y> result = new BasicEMap<X, Y>();
    Iterator<Map.Entry<X, Y>> it = orig.entrySet().iterator();
    while(it.hasNext()) {
        result.add((Map.Entry)EcoreUtil.copy((EObject)it.next()));
    } 
    return result;
}
项目:textram    文件:RAMModelUtil.java   
/**
 * Creates a new layout for a given {@link StructuralView}. 
 * The layout is the {@link ca.mcgill.cs.sel.ram.impl.ContainerMapImpl} specifically
 * that holds all {@link LayoutElement} for children of the given {@link StructuralView}.
 * 
 * @param aspect the aspect
 * @param structuralView the {@link StructuralView} holding the {@link LayoutElement} for its children
 */
public static void createLayout(Aspect aspect, StructuralView structuralView)
{
    Layout layout = RamFactory.eINSTANCE.createLayout();

    // workaround used here since creating the map, adding the values and then putting it doesn't work
    // EMF somehow does some magic with the passed map instance
    layout.getContainers().put(structuralView, new BasicEMap<EObject, LayoutElement>());

    aspect.setLayout(layout);
}
项目:mappingtools    文件:ModelUtil.java   
/**
 * 
 * @param toObj an Ecore model element
 * @return the details of the MIF annotation
 */
public static EMap<String,String> getMIFAnnotationDetails(EModelElement toObj)
{
    EMap<String,String> details = new BasicEMap<String,String>();
    EAnnotation ann = toObj.getEAnnotation(mifNamespaceURI);
    if (ann != null) details = ann.getDetails();
    return details;
}
项目:Saturn    文件:SaturnDocLoadSaveUtil.java   
private final static List<BasicEMap.Entry<String, String>> getXmlNsList()
{
  List<EPackage> packages = new ArrayList<EPackage>();

  // resource packages
  packages.add(Db2ResourcePackage.eINSTANCE);
  packages.add(DirectoryResourcePackage.eINSTANCE);
  packages.add(FileResourcePackage.eINSTANCE);
  packages.add(InformixResourcePackage.eINSTANCE);
  packages.add(MqResourcePackage.eINSTANCE);
  packages.add(OracleResourcePackage.eINSTANCE);
  packages.add(QueryResourcePackage.eINSTANCE);
  packages.add(ReferenceResourcePackage.eINSTANCE);
  packages.add(ShadowDirectResourcePackage.eINSTANCE);
  packages.add(SoapIOResourcePackage.eINSTANCE);
  packages.add(SybaseResourcePackage.eINSTANCE);
  packages.add(TeradataResourcePackage.eINSTANCE);
  packages.add(UdbResourcePackage.eINSTANCE);
  packages.add(NullResourcePackage.eINSTANCE);
  packages.add(TransactionResourcePackage.eINSTANCE);
  packages.add(SemaphoreResourcePackage.eINSTANCE);
  packages.add(LdapResourcePackage.eINSTANCE);
  packages.add(LdapQueryResourcePackage.eINSTANCE);
  packages.add(SqliteResourcePackage.eINSTANCE);
  packages.add(MssqlResourcePackage.eINSTANCE);

  // global packages
  packages.add(ValuesPackage.eINSTANCE);
  packages.add(TypesPackage.eINSTANCE);
  packages.add(ListenersPackage.eINSTANCE);
  packages.add(RepetitionPackage.eINSTANCE);
  packages.add(SaturnWebPackage.eINSTANCE);
  packages.add(SaturnReportPackage.eINSTANCE);

  // module packages
  packages.add(CpsModulePackage.eINSTANCE);
  packages.add(DatacompareModulePackage.eINSTANCE);
  packages.add(DsConvertModulePackage.eINSTANCE);
  packages.add(DsValidatorModulePackage.eINSTANCE);
  packages.add(EnvValidatorModulePackage.eINSTANCE);
  packages.add(ExtractDDLModulePackage.eINSTANCE);
  packages.add(MailModulePackage.eINSTANCE);
  packages.add(MqModulePackage.eINSTANCE);
  packages.add(ProcedureCallModulePackage.eINSTANCE);
  packages.add(PsManagerModulePackage.eINSTANCE);
  packages.add(RuncmdsModulePackage.eINSTANCE);
  packages.add(SingularityModulePackage.eINSTANCE);
  packages.add(SoapIOModulePackage.eINSTANCE);
  packages.add(SqlModulePackage.eINSTANCE);
  packages.add(Xml2csvModulePackage.eINSTANCE);
  packages.add(XmlDiffModulePackage.eINSTANCE);
  packages.add(XmlGenModulePackage.eINSTANCE);
  packages.add(XmlManipModulePackage.eINSTANCE);
  packages.add(XmlValidatorModulePackage.eINSTANCE);
  packages.add(CometModulePackage.eINSTANCE);

  packages.add(XSplitModulePackage.eINSTANCE);
  packages.add(ReferenceModulePackage.eINSTANCE);
  packages.add(DocumentumModulePackage.eINSTANCE);

  List<BasicEMap.Entry<String, String>> xmlNsList = new ArrayList<BasicEMap.Entry<String, String>>();
  for (EPackage ePackage : packages)
  {
    ((EcoreFactoryImpl) EcoreFactory.eINSTANCE).createEStringToStringMapEntry();
    BasicEMap.Entry<String, String> newEntry = (BasicEMap.Entry<String, String>) EcoreUtil
        .create((EClass) SaturnPackage.eINSTANCE.getDocumentRoot_XMLNSPrefixMap().getEType());
    // new EStringToStringMapEntryImpl();
    // //((EcoreFactoryImpl)EcoreFactory.eINSTANCE).createEStringToStringMapEntry();
    xmlNsList.add(newEntry);

    newEntry.setKey(ePackage.getNsPrefix());
    newEntry.setValue(ePackage.getNsURI());
  }
  return xmlNsList;
}
项目:osate2-agcl    文件:AgclProcessingSwitch.java   
public AgclProcessingSwitch() {
    results = new BasicEMap<EObject,T>();
}
项目:eclipse-avro    文件:EStoreEObjectImpl.java   
protected EList<?> createList(final EStructuralFeature eStructuralFeature)
{
  final EClassifier eType = eStructuralFeature.getEType();
  if (eType.getInstanceClassName() == "java.util.Map$Entry")
  {
    class EStoreEcoreEMap extends EcoreEMap<Object, Object>
    {
      private static final long serialVersionUID = 1L;

      public EStoreEcoreEMap()
      {
        super
          ((EClass)eType, 
           BasicEMap.Entry.class,
           null);
        delegateEList =
           new BasicEStoreEList<BasicEMap.Entry<Object, Object>>(EStoreEObjectImpl.this, eStructuralFeature)
           {
              private static final long serialVersionUID = 1L;

              @Override
              protected void didAdd(int index, BasicEMap.Entry<Object, Object> newObject)
              {
                EStoreEcoreEMap.this.doPut(newObject);
              }

              @Override
              protected void didSet(int index, BasicEMap.Entry<Object, Object> newObject, BasicEMap.Entry<Object, Object> oldObject)
              {
                didRemove(index, oldObject);
                didAdd(index, newObject);
              }

              @Override
              protected void didRemove(int index, BasicEMap.Entry<Object, Object> oldObject)
              {
                EStoreEcoreEMap.this.doRemove(oldObject);
              }

              @Override
              protected void didClear(int size, Object [] oldObjects)
              {
                EStoreEcoreEMap.this.doClear();
              }

              @Override
              protected void didMove(int index, BasicEMap.Entry<Object, Object> movedObject, int oldIndex)
              {
                EStoreEcoreEMap.this.doMove(movedObject);
              }
           };
        size = delegateEList.size();
      }
    }
    return new EStoreEcoreEMap();
  }
  else
  {
    return new BasicEStoreEList<Object>(this, eStructuralFeature);
  }
}
项目:eclipse-avro    文件:MinimalEStoreEObjectImpl.java   
protected EList<?> createList(final EStructuralFeature eStructuralFeature)
{
  final EClassifier eType = eStructuralFeature.getEType();
  if (eType.getInstanceClassName() == "java.util.Map$Entry")
  {
    class EStoreEcoreEMap extends EcoreEMap<Object, Object>
    {
      private static final long serialVersionUID = 1L;

      public EStoreEcoreEMap()
      {
        super
          ((EClass)eType,
           BasicEMap.Entry.class,
           null);
        delegateEList =
           new EStoreEObjectImpl.BasicEStoreEList<BasicEMap.Entry<Object, Object>>(MinimalEStoreEObjectImpl.this, eStructuralFeature)
           {
              private static final long serialVersionUID = 1L;

              @Override
              protected void didAdd(int index, BasicEMap.Entry<Object, Object> newObject)
              {
                EStoreEcoreEMap.this.doPut(newObject);
              }

              @Override
              protected void didSet(int index, BasicEMap.Entry<Object, Object> newObject, BasicEMap.Entry<Object, Object> oldObject)
              {
                didRemove(index, oldObject);
                didAdd(index, newObject);
              }

              @Override
              protected void didRemove(int index, BasicEMap.Entry<Object, Object> oldObject)
              {
                EStoreEcoreEMap.this.doRemove(oldObject);
              }

              @Override
              protected void didClear(int size, Object [] oldObjects)
              {
                EStoreEcoreEMap.this.doClear();
              }

              @Override
              protected void didMove(int index, BasicEMap.Entry<Object, Object> movedObject, int oldIndex)
              {
                EStoreEcoreEMap.this.doMove(movedObject);
              }
           };
        size = delegateEList.size();
      }
    }
    return new EStoreEcoreEMap();
  }
  else
  {
    return new EStoreEObjectImpl.BasicEStoreEList<Object>(this, eStructuralFeature);
  }
}
项目:clickwatch    文件:EStoreEObjectImpl.java   
protected EList<?> createList(final EStructuralFeature eStructuralFeature)
{
  final EClassifier eType = eStructuralFeature.getEType();
  if (eType.getInstanceClassName() == "java.util.Map$Entry")
  {
    class EStoreEcoreEMap extends EcoreEMap<Object, Object>
    {
      private static final long serialVersionUID = 1L;

      public EStoreEcoreEMap()
      {
        super
          ((EClass)eType, 
           BasicEMap.Entry.class,
           null);
        delegateEList =
           new BasicEStoreEList<BasicEMap.Entry<Object, Object>>(EStoreEObjectImpl.this, eStructuralFeature)
           {
              private static final long serialVersionUID = 1L;

              @Override
              protected void didAdd(int index, BasicEMap.Entry<Object, Object> newObject)
              {
                EStoreEcoreEMap.this.doPut(newObject);
              }

              @Override
              protected void didSet(int index, BasicEMap.Entry<Object, Object> newObject, BasicEMap.Entry<Object, Object> oldObject)
              {
                didRemove(index, oldObject);
                didAdd(index, newObject);
              }

              @Override
              protected void didRemove(int index, BasicEMap.Entry<Object, Object> oldObject)
              {
                EStoreEcoreEMap.this.doRemove(oldObject);
              }

              @Override
              protected void didClear(int size, Object [] oldObjects)
              {
                EStoreEcoreEMap.this.doClear();
              }

              @Override
              protected void didMove(int index, BasicEMap.Entry<Object, Object> movedObject, int oldIndex)
              {
                EStoreEcoreEMap.this.doMove(movedObject);
              }
           };
        size = delegateEList.size();
      }
    }
    return new EStoreEcoreEMap();
  }
  else
  {
    return new BasicEStoreEList<Object>(this, eStructuralFeature);
  }
}
项目:NeoEMF    文件:DefaultPersistentEObject.java   
/**
 * Constructs a {@code EStoreEcoreEMap} with the given {@code type} and {@code feature}.
 *
 * @param type    ???
 * @param feature ???
 */
public EStoreEcoreEMap(EClassifier type, EStructuralFeature feature) {
    super((EClass) type, BasicEMap.Entry.class, null);
    delegateEList = new EntryBasicEStoreEList(feature);
    size = delegateEList.size();
}