本文整理匯總了Java中org.eclipse.emf.ecore.EGenericType類的典型用法代碼示例。如果您正苦於以下問題:Java EGenericType類的具體用法?Java EGenericType怎麽用?Java EGenericType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EGenericType類屬於org.eclipse.emf.ecore包,在下文中一共展示了EGenericType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBoundGenericType
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
public EGenericType getBoundGenericType(EGenericType genericType, EClass context) {
ETypeParameter typeParameter = genericType.getETypeParameter();
if (typeParameter != null) {
// the reference type is a type parameter
TypeBindingAcceptor typeBindingAcceptor = new TypeBindingAcceptor();
addTypeParameterBindingsRecursively(context, typeBindingAcceptor);
return typeBindingAcceptor.getBoundGenericType(typeParameter);
} else {
// the reference type is a generic type
if (genericType.getEClassifier() == null) {
throw new IllegalStateException("Either typeParameter or eRawType must be set in EGenericType "
+ genericType);
}
return genericType;
}
}
示例2: addTypeParameterBindingsRecursively
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
protected static void addTypeParameterBindingsRecursively(EClass context, TypeBindingAcceptor bindingAcceptor) {
for (EGenericType genericSuperType : context.getEGenericSuperTypes()) {
EClassifier rawSuperType = genericSuperType.getEClassifier();
EList<EGenericType> typeArguments = genericSuperType.getETypeArguments();
EList<ETypeParameter> typeParameters = rawSuperType.getETypeParameters();
if (typeArguments.size() != typeParameters.size()) {
throw new IllegalStateException(
"Number of typeArguments does not match number of typeParameters in EGenericType "
+ genericSuperType);
}
for (int i = 0; i < typeArguments.size(); ++i) {
bindingAcceptor.accept(typeParameters.get(i), typeArguments.get(i));
}
if (rawSuperType instanceof EClass) {
addTypeParameterBindingsRecursively((EClass) rawSuperType, bindingAcceptor);
}
}
}
示例3: accept
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
public void accept(ETypeParameter typeParameter, EGenericType typeArgument) {
if(bindings==null) {
bindings = new HashMap<ETypeParameter, EGenericType>();
}
ETypeParameter replacedParameter = typeArgument.getETypeParameter();
if (replacedParameter != null) {
EGenericType existingBoundType = bindings.get(replacedParameter);
if (existingBoundType != null) {
bindings.remove(replacedParameter);
bindings.put(typeParameter, existingBoundType);
return;
}
} else {
if (typeArgument.getEClassifier() == null) {
throw new IllegalStateException("Either typeParameter or eClassifier must be set in ETypeArgument "
+ typeArgument);
}
}
bindings.put(typeParameter, typeArgument);
}
示例4: applyTyped
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
@Override
protected void applyTyped(UMLReferencingElement<Element> object) {
QualifiedName qn = qualifiedNameProvider.getFullyQualifiedName(object);
if (qn == null) {
return;
}
EGenericType requiredType = object.eClass()
.getFeatureType(TextualCommonsPackage.eINSTANCE.getUMLReferencingElement_ReferencedElement());
Collection<IEObjectDescription> foundElements = Sets.newHashSet(globalScopeProvider
.queryScope(object.eResource(), true, (EClass) requiredType.getEClassifier(), Predicates.alwaysTrue())
.getAllElements());
List<EObject> matchingElements = foundElements.stream().filter(d -> qn.equals(d.getQualifiedName()))
.map(IEObjectDescription::getEObjectOrProxy).distinct().collect(Collectors.toList());
if (matchingElements.size() == 1) {
if (matchingElements.get(0) != object.getReferencedElement()) {
object.setReferencedElement((Element) matchingElements.get(0));
}
} else {
object.setReferencedElement(null);
}
}
開發者ID:Cooperate-Project,項目名稱:CooperateModelingEnvironment,代碼行數:24,代碼來源:UMLReferencingElementCalculator.java
示例5: getChoiceOfObjects
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
private List<?> getChoiceOfObjects(String parameterName) {
if (parameterName != null) {
EParameterDef def = ActivityDictionary.getInstance().getAttributeDef(parameterName);
if (def != null) {
EGenericType eGenericType = def.getEGenericType();
EClassifier classifier = eGenericType.getEClassifier();
if (classifier instanceof EEnumImpl) {
EEnumImpl enumImpl = (EEnumImpl) classifier;
return enumImpl.getELiterals();
}
LogUtil.warn("Row Highlighting only supports Enum types. Not supported for " + parameterName + " (" +classifier+").");
} else {
LogUtil.error("Invalid parameter name for Row Highligther: "+ parameterName);
}
}
return Collections.EMPTY_LIST;
}
示例6: getFeatureType
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EGenericType getFeatureType(EStructuralFeature feature)
{
int featureID = getFeatureID(feature);
if (featureID != -1)
{
if (eAllStructuralFeatureTypes == null)
{
EGenericType[] result = new EGenericType[eAllStructuralFeaturesData.length];
for (int i = 0; i < eAllStructuralFeaturesData.length; ++i)
{
EGenericType eGenericType = eAllStructuralFeaturesData[i].getEGenericType();
if (eGenericType != null)
{
result[i] = EcoreUtil.getReifiedType(this, eGenericType);
}
}
eAllStructuralFeatureTypes = result;
}
return eAllStructuralFeatureTypes[featureID];
}
else
{
return feature.getEGenericType();
}
}
示例7: setEGenericType
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
public NotificationChain setEGenericType(EGenericType newEGenericType, NotificationChain msgs)
{
if (newEGenericType != eGenericType)
{
if (eGenericType != null)
msgs = ((InternalEObject)eGenericType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EcorePackage.ETYPED_ELEMENT__EGENERIC_TYPE, null, msgs);
if (newEGenericType != null)
msgs = ((InternalEObject)newEGenericType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EcorePackage.ETYPED_ELEMENT__EGENERIC_TYPE, null, msgs);
msgs = basicSetEGenericType(newEGenericType, msgs);
}
else if (eNotificationRequired())
{
ENotificationImpl notification =
new ENotificationImpl(this, Notification.SET, EcorePackage.ETYPED_ELEMENT__EGENERIC_TYPE, newEGenericType, newEGenericType);
if (msgs == null)
{
msgs = notification;
}
else
{
msgs.add(notification);
}
}
return msgs;
}
示例8: setEUpperBound
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEUpperBound(EGenericType newEUpperBound)
{
if (newEUpperBound != eUpperBound)
{
NotificationChain msgs = null;
if (eUpperBound != null)
msgs = ((InternalEObject)eUpperBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EcorePackage.EGENERIC_TYPE__EUPPER_BOUND, null, msgs);
if (newEUpperBound != null)
msgs = ((InternalEObject)newEUpperBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EcorePackage.EGENERIC_TYPE__EUPPER_BOUND, null, msgs);
msgs = basicSetEUpperBound(newEUpperBound, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EGENERIC_TYPE__EUPPER_BOUND, newEUpperBound, newEUpperBound));
}
示例9: setELowerBound
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setELowerBound(EGenericType newELowerBound)
{
if (newELowerBound != eLowerBound)
{
NotificationChain msgs = null;
if (eLowerBound != null)
msgs = ((InternalEObject)eLowerBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EcorePackage.EGENERIC_TYPE__ELOWER_BOUND, null, msgs);
if (newELowerBound != null)
msgs = ((InternalEObject)newELowerBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EcorePackage.EGENERIC_TYPE__ELOWER_BOUND, null, msgs);
msgs = basicSetELowerBound(newELowerBound, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EGENERIC_TYPE__ELOWER_BOUND, newELowerBound, newELowerBound));
}
示例10: getErasure
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
protected EClassifier getErasure(ETypeParameter eTypeParameter)
{
if (eTypeParameter == null)
{
return null;
}
else
{
boolean needEClass = eContainer instanceof EClass || eContainer instanceof EReference;
boolean needEDataType = !needEClass && eContainer instanceof EAttribute;
for (EGenericType eBound : eTypeParameter.getEBounds())
{
EClassifier eRawType = eBound.getERawType();
if (needEClass ? eRawType instanceof EClass : needEDataType ? eRawType instanceof EDataType : eRawType!= null)
{
return eRawType;
}
}
return needEClass ? EcorePackage.Literals.EOBJECT : EcorePackage.Literals.EJAVA_OBJECT;
}
}
示例11: isCompatibleArguments
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
private static boolean isCompatibleArguments(EList<EGenericType> instanceETypeArguments, EList<EGenericType> eTypeArguments)
{
// Check any argument, if present, for compatibility.
//
int size = instanceETypeArguments.size();
if (size > 0)
{
for (int i = 0; i < size; ++i)
{
if (!isCompatibleArgument(instanceETypeArguments.get(i), eTypeArguments.get(i)))
{
return false;
}
}
}
return true;
}
示例12: isEqualArguments
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
protected static boolean isEqualArguments(EList<EGenericType> instanceETypeArguments, EList<EGenericType> eTypeArguments)
{
// Check all the arguments, if any, for equality.
//
int size = instanceETypeArguments.size();
if (size != 0)
{
for (int i = 0; i < size; ++i)
{
if (!isEqualArgument(instanceETypeArguments.get(i), eTypeArguments.get(i)))
{
return false;
}
}
}
return true;
}
示例13: eSet
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EcorePackage.EGENERIC_TYPE__EUPPER_BOUND:
setEUpperBound((EGenericType)newValue);
return;
case EcorePackage.EGENERIC_TYPE__ETYPE_ARGUMENTS:
getETypeArguments().clear();
getETypeArguments().addAll((Collection<? extends EGenericType>)newValue);
return;
case EcorePackage.EGENERIC_TYPE__ELOWER_BOUND:
setELowerBound((EGenericType)newValue);
return;
case EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER:
setETypeParameter((ETypeParameter)newValue);
return;
case EcorePackage.EGENERIC_TYPE__ECLASSIFIER:
setEClassifier((EClassifier)newValue);
return;
}
eDynamicSet(featureID, newValue);
}
示例14: eUnset
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EcorePackage.EGENERIC_TYPE__EUPPER_BOUND:
setEUpperBound((EGenericType)null);
return;
case EcorePackage.EGENERIC_TYPE__ETYPE_ARGUMENTS:
getETypeArguments().clear();
return;
case EcorePackage.EGENERIC_TYPE__ELOWER_BOUND:
setELowerBound((EGenericType)null);
return;
case EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER:
setETypeParameter((ETypeParameter)null);
return;
case EcorePackage.EGENERIC_TYPE__ECLASSIFIER:
setEClassifier((EClassifier)null);
return;
}
eDynamicUnset(featureID);
}
示例15: eSet
import org.eclipse.emf.ecore.EGenericType; //導入依賴的package包/類
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EcorePackage.ETYPE_PARAMETER__EANNOTATIONS:
getEAnnotations().clear();
getEAnnotations().addAll((Collection<? extends EAnnotation>)newValue);
return;
case EcorePackage.ETYPE_PARAMETER__NAME:
setName((String)newValue);
return;
case EcorePackage.ETYPE_PARAMETER__EBOUNDS:
getEBounds().clear();
getEBounds().addAll((Collection<? extends EGenericType>)newValue);
return;
}
eDynamicSet(featureID, newValue);
}