Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EReference


    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

    // erstes Package, das node, arc und tcg enth�lt
    EPackage graphPackage = ecoreFactory.createEPackage();
    graphPackage.setName("graph");
    graphPackage.setNsPrefix("graph");
View Full Code Here


    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

    // erstes Package, das node, arc und tcg enth�lt
    EPackage graphPackage = ecoreFactory.createEPackage();
    graphPackage.setName("graph");
    graphPackage.setNsPrefix("graph");
View Full Code Here

    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

 
    m_oResourceEcoreOut.getContents().add(oNodeClass);
    m_oResourceEcoreOut.getContents().add(oArcClass);
    m_oResourceEcoreOut.getContents().add(oTCGClass);
View Full Code Here

  private IdentifierReference createIdentifierReferenceWithProxy(Resource resource,
      NamespaceClassifierReference nsClassifierReference) {
    EObject proxy = (EObject) nsClassifierReference
      .getClassifierReferences().get(0).eGet(TypesPackage.Literals.CLASSIFIER_REFERENCE__TARGET, false);
   
    EReference targetReference = ReferencesPackage.Literals.ELEMENT_REFERENCE__TARGET;
   
    IdentifierReference mainIdReference = ReferencesFactory.eINSTANCE.createIdentifierReference();
   
    mainIdReference.eSet(
        targetReference, proxy);
View Full Code Here

              {
                saveNil(o, entryFeature);
              }
              else
              {
                EReference referenceEntryFeature = (EReference)entryFeature;
                if (referenceEntryFeature.isContainment())
                {
                  saveElement((InternalEObject)value, entryFeature);
                }
                else if (referenceEntryFeature.isResolveProxies())
                {
                  saveFeatureMapElementReference((EObject)value, referenceEntryFeature);
                }
                else
                {
View Full Code Here

      EAttribute gatt = (EAttribute)documentRootEClass.getEStructuralFeatures().get(propertyNumber);
      initEAttribute(gatt, (EDataType)type, name, null, 0, -2, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED);
      globalProperty = gatt;
    } else {
      createEReference(documentRootEClass, propertyNumber);
      EReference gref = (EReference)documentRootEClass.getEStructuralFeatures().get(propertyNumber);
      initEReference(gref, (EClass)type, null, name, null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
      globalProperty = gref;
    }
    addAnnotation((ENamedElement)globalProperty, annotationSource, xsdMappings);
    return (Property) globalProperty;
View Full Code Here

            }
          }

          // use namespace declarations defined in the document (if any)
          EObject eRootObject = eDataGraph.getERootObject();
          EReference xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(eRootObject.eClass());
          if (xmlnsPrefixMapFeature != null)
          {
            EMap xmlnsPrefixMap = (EMap)eRootObject.eGet(xmlnsPrefixMapFeature);
            helper.setPrefixToNamespaceMap(xmlnsPrefixMap);
          }
View Full Code Here

            }
          }

          // use namespace declarations defined in the document (if any)
          EObject eRootObject = eDataGraph.getERootObject();
          EReference xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(eRootObject.eClass());
          if (xmlnsPrefixMapFeature != null)
          {
            EMap xmlnsPrefixMap = (EMap)eRootObject.eGet(xmlnsPrefixMapFeature);
            helper.setPrefixToNamespaceMap(xmlnsPrefixMap);
          }
View Full Code Here

        extendedMetaData.setName(eAttribute, ":" + eAttribute.getName());
        return eAttribute;
      }
      else
      {
        EReference eReference = ecoreFactory.createEReference();
        setAnnotations(eReference, xsdComponent);
        eReference.setName(name);
        eReference.setEType(ecorePackage.getEStringToStringMapEntry());
        eReference.setLowerBound(0);
        eReference.setUpperBound(-1);
        eReference.setContainment(true);
        eReference.setResolveProxies(false);
        eReference.setTransient(true);
        eClass.getEStructuralFeatures().add(eReference);
        extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ATTRIBUTE_FEATURE);
        return eReference;
      }
    }

    if (type instanceof EClass)
    {
      EReference eReference = ecoreFactory.createEReference();
      setAnnotations(eReference, xsdComponent);
      eReference.setName(Character.toLowerCase(name.charAt(0)) + name.substring(1));
      eReference.setEType(type);
      eReference.setLowerBound(minOccurs);
      eReference.setUpperBound(maxOccurs);

      eClass.getEStructuralFeatures().add(eReference);
      if (xsdComponent == null)
      {
        extendedMetaData.setName(eReference, ":" + eClass.getEAllStructuralFeatures().indexOf(eReference));
        extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.SIMPLE_FEATURE);
      }
      else
      {
        map(xsdComponent, eReference);
        if (xsdComponent instanceof XSDParticle)
        {
          eReference.setContainment(true);
          eReference.setResolveProxies(false);

          XSDParticle xsdParticle = (XSDParticle)xsdComponent;

          XSDTerm xsdTerm = ((XSDParticle)xsdComponent).getTerm();
          if (xsdTerm instanceof XSDElementDeclaration)
          {
            XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)xsdTerm;
            extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ELEMENT_FEATURE);
            extendedMetaData.setName(eReference, xsdElementDeclaration.getName());
            extendedMetaData.setNamespace(eReference, xsdElementDeclaration.getTargetNamespace());

            XSDTypeDefinition xsdType = getEffectiveTypeDefinition(xsdParticle, xsdElementDeclaration);
            if (xsdType instanceof XSDSimpleTypeDefinition)
            {
              eReference.setContainment(false);
              eReference.setResolveProxies(!isLocalReferenceType((XSDSimpleTypeDefinition)xsdType));
            }

            if (maxOccurs == 1 && xsdElementDeclaration.isNillable())
            {
              eReference.setUnsettable(true);
            }

            if (xsdElementDeclaration.isAbstract())
            {
              eReference.setChangeable(false);
            }

            String opposite = getEcoreAttribute(xsdParticle, "opposite");
            if (opposite != null)
            {
              eReferenceToOppositeNameMap.put(eReference, opposite);
            }
          }
          else if (xsdTerm instanceof XSDWildcard)
          {
            // EATM shouldn't happen
            XSDWildcard xsdWildcard = (XSDWildcard)xsdTerm;
            extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE);
            extendedMetaData.setWildcards(eReference, getWildcards(xsdWildcard));
            extendedMetaData.setProcessingKind(eReference, xsdWildcard.getProcessContents().getValue() + 1);
            extendedMetaData.setName(eReference, ":" + eClass.getEAllStructuralFeatures().indexOf(eReference));
          }
          else
          {
            extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.GROUP_FEATURE);
            extendedMetaData.setName(eReference, ":" + eClass.getEAllStructuralFeatures().indexOf(eReference));
          }
        }
        else if (xsdComponent instanceof XSDElementDeclaration)
        {
          XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)xsdComponent;
          eReference.setContainment(true);
          eReference.setResolveProxies(false);
          extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ELEMENT_FEATURE);
          extendedMetaData.setName(eReference, xsdElementDeclaration.getName());
          extendedMetaData.setNamespace(eReference, xsdElementDeclaration.getTargetNamespace());

          XSDElementDeclaration substitutionGroupAffiliation = xsdElementDeclaration.getSubstitutionGroupAffiliation();
          if (substitutionGroupAffiliation != null)
          {
            EStructuralFeature affiliation = getEStructuralFeature(substitutionGroupAffiliation);
            extendedMetaData.setAffiliation(eReference, affiliation);
          }
          XSDTypeDefinition xsdType = getEffectiveTypeDefinition(null, xsdElementDeclaration);
          if (xsdType instanceof XSDSimpleTypeDefinition)
          {
            eReference.setResolveProxies(!isLocalReferenceType((XSDSimpleTypeDefinition)xsdType));
          }

          if (maxOccurs == 1 && xsdElementDeclaration.isNillable())
          {
            eReference.setUnsettable(true);
          }

          if (xsdElementDeclaration.isAbstract())
          {
            eReference.setChangeable(false);
          }
        }
        else if (xsdComponent instanceof XSDAttributeUse)
        {
          String opposite = getEcoreAttribute(xsdComponent, "opposite");
          if (opposite != null)
          {
            eReferenceToOppositeNameMap.put(eReference, opposite);
          }
         
          XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)xsdComponent;
          XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
          extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ATTRIBUTE_FEATURE);
          extendedMetaData.setName(eReference, xsdAttributeDeclaration.getName());
          extendedMetaData.setNamespace(eReference, xsdAttributeDeclaration.getTargetNamespace());
          eReference.setResolveProxies
            (!isLocalReferenceType((XSDSimpleTypeDefinition)getEffectiveTypeDefinition(xsdAttributeUse, xsdAttributeDeclaration)));
        }
        else if (xsdComponent instanceof XSDAttributeDeclaration)
        {
          XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration)xsdComponent;
          extendedMetaData.setFeatureKind(eReference, ExtendedMetaData.ATTRIBUTE_FEATURE);
          extendedMetaData.setName(eReference, xsdAttributeDeclaration.getName());
          extendedMetaData.setNamespace(eReference, xsdAttributeDeclaration.getTargetNamespace());
          eReference.setResolveProxies
            (!isLocalReferenceType((XSDSimpleTypeDefinition)getEffectiveTypeDefinition(null, xsdAttributeDeclaration)));
        }
      }

      return eReference;
View Full Code Here

            extendedMetaData.setName(holderClass, holderName);
            extendedMetaData.setContentKind(holderClass, ExtendedMetaData.SIMPLE_CONTENT);
                  
            addToSortedList(holderPackage.getEClassifiers(), holderClass);
    
            EReference holderReference =
              (EReference)createFeature
                (holderClass,
                 "value",
                 referenceClassifier,
                 null,
                 0,
                 -1);
    
            holderReference.setResolveProxies(!isLocalReferenceType(xsdSimpleTypeDefinition));
          }
          referenceClassifier = holderClass;
        }
      }
      EStructuralFeature result =
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.