Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EStructuralFeature


    EClass eClass = eObject.eClass();
    int openFeatureCount = featureID - eClass.getFeatureCount();
    Set openFeatureSet = new HashSet();
    for (int i = 0, count = eClass.getEAllStructuralFeatures().size(); i < count; ++i)
    {
      EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
      if (!eStructuralFeature.isDerived() && FeatureMapUtil.isFeatureMap(eStructuralFeature))
      {
        List features = (List)eObject.eGet(eStructuralFeature);
        for (int j = 0, size = features.size(); j < size; ++j)
        {
          FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j);
          EStructuralFeature entryFeature = entry.getEStructuralFeature();
          if (openFeatureSet.add(entryFeature))
          {
            if (--openFeatureCount < 0) return entryFeature;
          }
        }
View Full Code Here


  protected Property createGlobalProperty(String name, Type type, String[] xsdMappings, boolean asAttribute, String annotationSource)
  {
    int propertyNumber = documentRootEClass.getEStructuralFeatures().size();

    EStructuralFeature globalProperty;
    if(asAttribute) {
      createEAttribute(documentRootEClass, propertyNumber);
      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;
View Full Code Here

  {
    EClass eClass = eObject.eClass();
    Set openFeatureSet = new HashSet();
    for (int i = 0, count = eClass.getEAllStructuralFeatures().size(); i < count; ++i)
    {
      EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
      if (/*!eStructuralFeature.isDerived() && */FeatureMapUtil.isFeatureMap(eStructuralFeature))
      {
        List features = (List)eObject.eGet(eStructuralFeature);
        for (int j = 0, size = features.size(); j < size; ++j)
        {
          FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j);
          EStructuralFeature entryFeature = entry.getEStructuralFeature();
          if (openFeatureSet.add(entryFeature))
          {
            Property property = (Property)entryFeature;
            if (property.getName().equals(featureName)) return entryFeature;

View Full Code Here

   * @return the Sequence corresponding to the specified substitutable Property of the specified DataObject or
   *         null if the specified Property isn't a substitution head.
   */
  public static Sequence getSubstitutionValues(DataObject dataObject, Property head)
  {
      final EStructuralFeature  group = ExtendedMetaData.INSTANCE.getGroup((EStructuralFeature)head);
      return null == group
           ? null
           : (Sequence)((FeatureMap.Internal)((EObject)dataObject).eGet(group)).getWrapper();
  }
View Full Code Here

    ((EClassifier)type).setInstanceClassName(javaClassName);
  }
 
  public static Property createProperty(Type containingType, String name, Type propertyType)
  {
    EStructuralFeature eStructuralFeature =
      propertyType.isDataType() ?
        (EStructuralFeature)SDOFactory.eINSTANCE.createAttribute() :
        (EStructuralFeature)SDOFactory.eINSTANCE.createReference();

    eStructuralFeature.setName(name);
    eStructuralFeature.setEType((EClassifier)propertyType);
    ((EClass)containingType).getEStructuralFeatures().add(eStructuralFeature);

    //if (containingType.getName() == null)
    if ("".equals(ExtendedMetaData.INSTANCE.getName((EClass)containingType))) // DocumentRoot containingType?
    {
      //FB TBD ... figure out how to decide whether to use ELEMENT_FEATURE or ATTRIBUTE_FEATURE
      ExtendedMetaData.INSTANCE.setFeatureKind(eStructuralFeature, ExtendedMetaData.ELEMENT_FEATURE);
     
      ExtendedMetaData.INSTANCE.setNamespace(eStructuralFeature, containingType.getURI());
      //FB???eStructuralFeature.setUnique(false);
      //FB???eStructuralFeature.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
    }
   
    if (containingType.isSequenced()) {
      eStructuralFeature.setDerived(true);
      eStructuralFeature.setTransient(true);
      eStructuralFeature.setVolatile(true);
    }
   
    return (Property)eStructuralFeature;
  }
View Full Code Here

  protected EEnum computeEEnum(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
    return null;
  }
   
  protected EStructuralFeature createFeature(EClass eClass, String name, EClassifier type, XSDComponent xsdComponent, int minOccurs, int maxOccurs) {
    EStructuralFeature feature =
      super.createFeature(eClass, name, type, xsdComponent, minOccurs, maxOccurs);
    feature.setName(name); // this is needed because super.createFeature() does EMF name mangling (toLower)
    if (xsdComponent != null) {
      String aliasNames = getEcoreAttribute(xsdComponent.getElement(), "aliasName");
      if (aliasNames != null) {
        SDOExtendedMetaData.INSTANCE.setAliasNames(feature, aliasNames);
      }
View Full Code Here

    return featureMap.size();
  }

  public Property getProperty(int index)
  {
    EStructuralFeature feature = featureMap.getEStructuralFeature(index);
    boolean isText =
      feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
      feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
      feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
    return isText ? null : (Property)feature;
View Full Code Here

    return result.toString();
  }
 
  public String getInstanceClassName()
  {
    EStructuralFeature javaClassFeature = JavaPackageImpl.eINSTANCE.getDocumentRoot_JavaClass();
    Sequence anyAttribute = getAnyAttribute();
    int count = anyAttribute.size();
    for (int i = 0; i < count; i++)
    {
      EStructuralFeature eFeature = (EStructuralFeature)anyAttribute.getProperty(i);
      if (eFeature == javaClassFeature)
      {
        return (String)anyAttribute.getValue(i);
      }
    }
View Full Code Here

   */
  public boolean isOpen()
  {
    for (int i = 0, count = getFeatureCount(); i < count; ++i)
    {
      EStructuralFeature eStructuralFeature = getEStructuralFeature(i);
      switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature))
      {
        case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE:
          if (eStructuralFeature == ExtendedMetaData.INSTANCE.getMixedFeature(this)) break;
        case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE:
View Full Code Here

    protected static int matchingIndex(List eObjects, String attributeName, String attributeValue)
    {
      for (int i = 0, size = eObjects.size(); i < size; i++)
      {
        EObject eObject = (EObject)eObjects.get(i);
        EStructuralFeature feature = (EStructuralFeature)((Type)eObject.eClass()).getProperty(attributeName);
        // If feature is null, that means it could be an open feature.
        if (feature == null)
        {
          feature = (EStructuralFeature)DataObjectUtil.getOpenFeature(eObject, attributeName);
        }
        if (feature != null)
        {
          Object test = eObject.eGet(feature, true);
          if (test != null)
          {
            String testString = EcoreUtil.convertToString((EDataType)feature.getEType(), test);
            if (attributeValue.equals(testString))
            {
              return i;
            }
          }
View Full Code Here

TOP

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

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.