public static EClassifier getCompatibleType(EClassifier typeA, EClassifier typeB) { EClassifier result = getCompatibleType(typeA, typeB, null); if (result != null) return result; if (typeA instanceof EClass && typeB instanceof EClass) return EcorePackage.Literals.EOBJECT; return null; }
protected EClassifier getCompatibleType(EClassifier a, EClassifier b, EObject context) { if (a == null) return b; if (b == null) return a; return EcoreUtil2.getCompatibleType(a, b, context); }
private EClassifierInfo getCompatibleType(EClassifierInfo infoA, EClassifierInfo infoB) { if (infoA.equals(infoB)) return infoA; if (infoA.getEClassifier() instanceof EDataType || infoB.getEClassifier() instanceof EDataType) throw new IllegalArgumentException( "Simple Datatypes (lexer rules or keywords) do not have a common supertype (" + infoA + ", " + infoB + ")"); EClassifier compatibleType = EcoreUtil2.getCompatibleType(infoA.getEClassifier(), infoB.getEClassifier(), grammar); return getInfoOrNull(compatibleType); }
return t2; } else { final EClass compatibleType = (EClass) EcoreUtil2.getCompatibleType(t1, t2, null); return compatibleType == null ? erroneous : compatibleType;
EStructuralFeature existing = allFeatures.get(declared.getName()); if (existing != null) { EClassifier compatibleType = EcoreUtil2.getCompatibleType(declared.getEType(), existing.getEType(), grammar); if (compatibleType != null) { iter.remove();
EClass _xblockexpression = null; final EClassifier type = EcoreUtil2.getCompatibleType(key, current, null); EClass _xifexpression = null; if ((type instanceof EClass)) {
public void collectAbstractElements(Grammar grammar, EStructuralFeature feature, IFollowElementAcceptor followElementAcceptor) { for (Grammar superGrammar : grammar.getUsedGrammars()) { collectAbstractElements(superGrammar, feature, followElementAcceptor); } EClass declarator = feature.getEContainingClass(); for (ParserRule rule : GrammarUtil.allParserRules(grammar)) { for (Assignment assignment : GrammarUtil.containedAssignments(rule)) { if (assignment.getFeature().equals(feature.getName())) { EClassifier classifier = GrammarUtil.findCurrentType(assignment); EClassifier compType = EcoreUtil2.getCompatibleType(declarator, classifier); if (compType == declarator) { followElementAcceptor.accept(assignment); } } } } }
public boolean isFeatureSemanticallyEqualTo(EStructuralFeature f1, EStructuralFeature f2) { boolean result = isFeatureSemanticallyEqualApartFromType(f1, f2); if (f1 instanceof EReference && f2 instanceof EReference) { EClass f1Type = (EClass) f1.getEType(); EClass f2Type = (EClass) f2.getEType(); result &= f1Type.isSuperTypeOf(f2Type); result &= ((EReference) f1).isContainment() == ((EReference) f2).isContainment(); result &= ((EReference) f1).isContainer() == ((EReference) f2).isContainer(); } else { result &= f1.getEType().equals(EcoreUtil2.getCompatibleType(f1.getEType(), f2.getEType())); } return result; }
grammarElement); EClassifier compatibleType = EcoreUtil2.getCompatibleType(existingFeature.getEType(), newFeature.getEType(), grammarElement); if (compatibleType == null) throw new TransformationException(TransformationErrorCode.NoCompatibleFeatureTypeAvailable,