当前位置: 首页>>代码示例>>Java>>正文


Java ETypedElement类代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.ETypedElement的典型用法代码示例。如果您正苦于以下问题:Java ETypedElement类的具体用法?Java ETypedElement怎么用?Java ETypedElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ETypedElement类属于org.eclipse.emf.ecore包,在下文中一共展示了ETypedElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: caseGNavigationExpression

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
@Override
public EClassifier caseGNavigationExpression(GNavigationExpression object) {
	EObject referencedEObject = object.getReferencedEObject();
	if (referencedEObject instanceof ETypedElement) {
		ETypedElement typedElement = (ETypedElement) referencedEObject;
		return typedElement.getEType();
	} else if (referencedEObject instanceof EClassifier) {
		EClassifier classifier = (EClassifier) referencedEObject;
		return classifier;
	} else {
		return referencedEObject.eClass();
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:14,代码来源:GExpressionsTypeEvaluator.java

示例2: ResourceContentsEStructuralFeature

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
/**
 * Constructs a new {@code ResourceContentsEStructuralFeature}.
 */
public ResourceContentsEStructuralFeature() {
    setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
    setLowerBound(0);
    setName(CONTENTS);
    setEType(new EClassifierImpl() {
    });
    setFeatureID(RESOURCE__CONTENTS);
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:12,代码来源:DefaultPersistentResource.java

示例3: shouldUnset

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
protected boolean shouldUnset(EStructuralFeature feature, Object value)
{
  // If the feature is unsettable, then regardless of the value, we should not be unsetting the feature.
  //
  if (feature.isUnsettable())
  {
    return false;
  }
  // If it's not an open content element, unset the feature if the value is the same as the default value.
  //
  else if (feature.getUpperBound() != ETypedElement.UNSPECIFIED_MULTIPLICITY)
  {
    Object defaultValue = feature.getDefaultValue();
    return defaultValue == null ? value == null : defaultValue.equals(value);
  }
  // If this is a feature of the document root itself, unset if the value is null.
  // If it was a nillable element, it would have been unsettable.
  //
  else if (feature.getEContainingClass() == owner.eClass())
  {
    return value == null;
  }
  // Otherwise, return false.
  //
  else
  {
    return false;
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:30,代码来源:BasicFeatureMap.java

示例4: shouldUnset

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
protected boolean shouldUnset(EStructuralFeature feature, Object value)
{
  if (feature.getUpperBound() != ETypedElement.UNSPECIFIED_MULTIPLICITY && !feature.isUnsettable())
  {
    Object defaultValue = feature.getDefaultValue();
    return defaultValue == null ? value == null : defaultValue.equals(value);
  }
  else
  {
    return false;
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:13,代码来源:DelegatingFeatureMap.java

示例5: findETypedElementById

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public static org.eclipse.emf.ecore.ETypedElement findETypedElementById(java.util.List<org.eclipse.emf.ecore.ETypedElement> list, String id){
	    for (ETypedElement obji : list) {
		if (getETypedElementId(obji).equals(id))
			return obji;
	}
	return null;
}
 
开发者ID:SOM-Research,项目名称:emf-rest,代码行数:8,代码来源:IdentificationResolver.java

示例6: getCardinalityString

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public String getCardinalityString(final ETypedElement prop) {
	final int upper = prop.getUpperBound();
	final int lower = prop.getLowerBound();

	if(upper==lower)
		return upper==-1 ? "*" : String.valueOf(upper);
	return String.valueOf(lower) + ".." + (upper==-1 ? "*" : String.valueOf(upper));
}
 
开发者ID:arnobl,项目名称:kompren,代码行数:9,代码来源:ModelUtils.java

示例7: visit

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
@Override
public void visit(Field field, String param) {
    if (hasElement(field)) {
        return;
    }

    Type fieldType = field.getType();
    // Ecore defaults, only changed if an container
    boolean ordered = true;
    boolean unique = true;
    if (fieldType instanceof Container) {
        Container cmContainer = (Container) fieldType;
        fieldType = cmContainer.getType();

        if (cmContainer.getContainerType() == Kind.SET
            || cmContainer.getContainerType() == Kind.BAG) {
            ordered = false;
        }
        if (cmContainer.getContainerType() == Kind.BAG
            || cmContainer.getContainerType() == Kind.SEQ) {
            unique = false;
        }
    }

    EStructuralFeature eFieldFeature = null;
    // Tuples/Containers are represented by classes, so would be a reference
    if (fieldType instanceof Class || fieldType instanceof Tuple
        || fieldType instanceof Container) {
        // Create EReference
        eFieldFeature = g_EcoreFactory.createEReference();
    } else {
        // Create EAttribute
        eFieldFeature = g_EcoreFactory.createEAttribute();
    }
    setElement(field, eFieldFeature);

    eFieldFeature.setName(field.getName()
        .toString());
    eFieldFeature.setOrdered(ordered);
    eFieldFeature.setUnique(unique);

    EObject eType = getElement(fieldType);
    eFieldFeature.setEType((EClassifier) eType);

    if (field.getUpperBound() == -1) {
        eFieldFeature.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
    } else {
        eFieldFeature.setUpperBound(field.getUpperBound());
    }
    if (field.getType() instanceof Class && !((Class) field.getType()).isProper()) {
        eFieldFeature.setLowerBound(0);
    } else {
        eFieldFeature.setLowerBound(field.getLowerBound());
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:56,代码来源:TypeToEcore.java

示例8: caseETypedElement

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
@Override
public Adapter caseETypedElement(ETypedElement object) {
	return createETypedElementAdapter();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:EcorePerPlatformPluginAdapterFactory.java

示例9: caseEcore_ETypedElement

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
@Override
public Adapter caseEcore_ETypedElement(ETypedElement object) {
	return createEcore_ETypedElementAdapter();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:5,代码来源:DictionaryAdapterFactory.java

示例10: isMany

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public static boolean isMany(EObject owner, EStructuralFeature feature)
{
  if (feature.isMany())
  {
    return true;
  }
  else if (feature.getUpperBound() == ETypedElement.UNSPECIFIED_MULTIPLICITY)
  {
    if (feature == XMLTypeFeatures.TEXT ||
          feature == XMLTypeFeatures.CDATA ||
          feature == XMLTypeFeatures.COMMENT ||
          feature == XMLTypeFeatures.PROCESSING_INSTRUCTION)
    {
      return true;
    }
    else
    {
      EClass eClass = owner.eClass();
      if (eClass.getFeatureID(feature) >= 0)
      {
        return false;
      }
      else
      {
        EStructuralFeature affiliation = ExtendedMetaData.INSTANCE.getAffiliation(eClass, feature);
        if (affiliation == null)
        {
          return true;
        }
        else
        {
          int affiliationUpperBound = affiliation.getUpperBound();
          return 
            (affiliationUpperBound > 1 || affiliationUpperBound == ETypedElement.UNBOUNDED_MULTIPLICITY) && 
              ExtendedMetaData.INSTANCE.getFeatureKind(affiliation) != ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE;
        }
      }
    }
  }
  else
  {
    return false;
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:45,代码来源:FeatureMapUtil.java

示例11: demandFeature

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public EStructuralFeature demandFeature(String namespace, String name, boolean isElement, boolean isReference)
{
  EPackage ePackage = demandPackage(namespace);
  EClass documentRootEClass = getDocumentRoot(ePackage);
  EStructuralFeature eStructuralFeature = 
    isElement ? 
      getLocalElement(documentRootEClass, namespace, name) : 
      getLocalAttribute(documentRootEClass, namespace, name);
  if (eStructuralFeature != null)
  {
    return eStructuralFeature;
  }
  else
  {
    if (isReference)
    {
      EReference eReference = EcoreFactory.eINSTANCE.createEReference();
      if (isElement)
      {
        eReference.setContainment(true);
        eReference.setResolveProxies(false);
      }
      eReference.setEType(EcorePackage.Literals.EOBJECT);
      eReference.setName(name);
      eReference.setDerived(true);
      eReference.setTransient(true);
      eReference.setVolatile(true);
      documentRootEClass.getEStructuralFeatures().add(eReference);

      setFeatureKind(eReference, isElement ? ELEMENT_FEATURE : ATTRIBUTE_FEATURE);
      setNamespace(eReference, namespace);

      // Mark the bound as unspecified so that it won't be considered many
      // but can nevertheless be recognized as being unspecified and perhaps still be treat as many.
      //
      if (isElement)
      {
        eReference.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
      }

      return eReference;
    }
    else
    {
      EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
      eAttribute.setName(name);
      eAttribute.setEType(XMLTypePackage.eINSTANCE.getAnySimpleType());
      eAttribute.setDerived(true);
      eAttribute.setTransient(true);
      eAttribute.setVolatile(true);
      documentRootEClass.getEStructuralFeatures().add(eAttribute);

      setFeatureKind(eAttribute, isElement ? ELEMENT_FEATURE : ATTRIBUTE_FEATURE);
      setNamespace(eAttribute, namespace);

      // Mark the bound as unspecified so that it won't be considered many
      // but can nevertheless be recognized as being unspecified and perhaps still be treat as many.
      //
      if (isElement)
      {
        eAttribute.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
      }

      return eAttribute;
    }
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:68,代码来源:BasicExtendedMetaData.java

示例12: eSetting

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public EStructuralFeature.Setting eSetting(final EStructuralFeature eFeature)
{
  EClass eClass = eClass();
  int index = eClass.getFeatureID(eFeature);
  int dynamicIndex = eStaticFeatureCount();
  if (index >= dynamicIndex)
  {
    return eSettingDelegate(eFeature).dynamicSetting(this, eSettings(), index - dynamicIndex);
  }
  else if (index <= -1)
  {
    EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass, eFeature);
    if (openFeature != null)
    {
      if (!FeatureMapUtil.isFeatureMap(openFeature))
      {
        openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
      }
      FeatureMap featureMap = (FeatureMap)eGet(openFeature);
      int upperBound = openFeature.getUpperBound();
      if (upperBound > 1 || upperBound == ETypedElement.UNBOUNDED_MULTIPLICITY)
      {
        return (EStructuralFeature.Setting)((FeatureMap.Internal)featureMap).get(eFeature, false);
      }
    }
    else
    {
      throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid feature");
    }
  }
  else if (eFeature.isMany())
  {
    return (EStructuralFeature.Setting)eGet(eFeature, false);
  }

  EStructuralFeature.Setting setting =
    new EStructuralFeature.Setting()
    {
      public EObject getEObject()
      {
        return BasicEObjectImpl.this;
      }

      public EStructuralFeature getEStructuralFeature()
      {
        return eFeature;
      }

      public Object get(boolean resolve)
      {
        return BasicEObjectImpl.this.eGet(eFeature, resolve);
      }

      public void set(Object newValue)
      {
        BasicEObjectImpl.this.eSet(eFeature, newValue);
      }

      public boolean isSet()
      {
        return BasicEObjectImpl.this.eIsSet(eFeature);
      }

      public void unset()
      {
        BasicEObjectImpl.this.eUnset(eFeature);
      }
    };
  return setting;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:71,代码来源:BasicEObjectImpl.java

示例13: getETypedElementId

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public static String getETypedElementId(org.eclipse.emf.ecore.ETypedElement obj){
    if(obj==null)
     return null;
 
return obj.getName();
}
 
开发者ID:SOM-Research,项目名称:emf-rest,代码行数:7,代码来源:IdentificationResolver.java

示例14: getTypeName

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
public String getTypeName(final ETypedElement te) {
	if(te != null) return te.getName();
	return "";
}
 
开发者ID:arnobl,项目名称:kompren,代码行数:5,代码来源:ModelUtils.java

示例15: caseETypedElement

import org.eclipse.emf.ecore.ETypedElement; //导入依赖的package包/类
/**
 * Returns the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
 * <!-- begin-user-doc -->
 * This implementation returns null;
 * returning a non-null result will terminate the switch.
 * <!-- end-user-doc -->
 * @param object the target of the switch.
 * @return the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
 * @generated
 */
public T caseETypedElement(ETypedElement object) {
	return null;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:EcorePerPlatformPluginSwitch.java


注:本文中的org.eclipse.emf.ecore.ETypedElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。