/** * Removes from selected permission the link to pobject * * @return <code>true</code> if such pobject was removed from permission */ @SuppressWarnings("unchecked") public static boolean removePObject(final Permission permission, final PObject pObject) { final List<EStructuralFeature> structuralFeatures = permission.getEStructuralFeatures(); for (final EStructuralFeature feature : structuralFeatures) { final String name = feature.getName(); if (name.equals(IPermissionConstant.OBJECT) && EcoreUtil.equals(feature.getEType(), pObject)) { return structuralFeatures.remove(feature); } } return false; }
private static void removeSuperTypeModelReference(FunctionblockModel fbm) { Iterator<ModelReference> iter = fbm.getReferences().iterator(); while (iter.hasNext()) { ModelReference reference = iter.next(); ModelReference superTypeReference = ModelIdFactory.newInstance(fbm.getSuperType()).asModelReference(); if (EcoreUtil.equals(superTypeReference, reference)) { iter.remove(); } } }
private static void removeSuperTypeModelReference(Entity entity) { Iterator<ModelReference> iter = entity.getReferences().iterator(); while (iter.hasNext()) { ModelReference reference = iter.next(); ModelReference superTypeReference = ModelIdFactory.newInstance(entity.getSuperType()).asModelReference(); if (EcoreUtil.equals(superTypeReference, reference)) { iter.remove(); } } }
JvmTypeReference overridingType = context.getLowerBound(overridingConstraint.getTypeReference()); JvmTypeReference overriddenType = context.getLowerBound(overriddenConstraint.getTypeReference()); if (EcoreUtil.equals(overridingType, overriddenType)) { matches = true; iter.remove();
protected boolean isContentValidationNeeded(Collection<AbstractElement> ass) { if (ass == null || ass.size() < 2) return false; Iterator<AbstractElement> it = ass.iterator(); AbstractElement first = it.next(); CrossReference firstRef = GrammarUtil.containingCrossReference(first); while (it.hasNext()) { AbstractElement next = it.next(); if (next instanceof Action) return true; if (!EcoreUtil.equals(first, next)) return true; if (firstRef != null) { CrossReference nextRef = GrammarUtil.containingCrossReference(next); if (nextRef != null && nextRef.getType().getClassifier() != firstRef.getType().getClassifier()) return true; } } return false; } }
continue; if (EcoreUtil.equals((EObject)existingEObject, (EObject)element)) { found = true; // skip break;
continue; if (EcoreUtil.equals((EObject)existingEObject, (EObject)element)) { found = true; // skip break;
protected boolean isSameArgumentTypes(JvmOperation overriding, JvmOperation overridden, final ITypeArgumentContext context) { for (int i = 0; i < overriding.getParameters().size(); i++) { JvmFormalParameter overridingParam = overriding.getParameters().get(i); JvmFormalParameter overriddenParam = overridden.getParameters().get(i); JvmTypeReference overridingType = context.getLowerBound(overridingParam.getParameterType()); JvmTypeReference overriddenType = context.getLowerBound(overriddenParam.getParameterType()); if (!EcoreUtil.equals(overridingType, overriddenType)) { boolean result = new DeepChecker(context).visit(overridingType, overriddenType); if (!result) return result; } } return true; }
public boolean isContentValidationNeeded() { if (contentValidationNeeded != null) return contentValidationNeeded; contentValidationNeeded = false; if (assignments.length >= 2) { IConstraintElement first = assignments[0]; if (first.getType() == ConstraintElementType.ASSIGNED_ACTION_CALL) contentValidationNeeded = true; else for (int i = 1; i < assignments.length; i++) { IConstraintElement a = assignments[i]; if (a.getType() == ConstraintElementType.ASSIGNED_ACTION_CALL || first.getCrossReferenceType() != a.getCrossReferenceType() || !EcoreUtil.equals(first.getGrammarElement(), a.getGrammarElement())) { contentValidationNeeded = true; break; } } } return contentValidationNeeded; }
EObject orig = EcoreUtil.copy(obj); ((GenModel) obj).reconcile(); if (!EcoreUtil.equals(orig, obj)) { Predicate<EStructuralFeature> ignoreContainer = new Predicate<EStructuralFeature>() { @Override
/** * Finds the mapped element by a stereotype for a given information model * @param informationModel * @param stereoType * @return mapped element */ public IMapped<InformationModel> getMappedElement(final InformationModel informationModel, final String stereoType) { for (MappingRule rule : mappingRules) { for (Source ruleSource : rule.getSources()) { if (ruleSource instanceof InfomodelSource && EcoreUtil.equals(((InfomodelSource) ruleSource).getModel(), informationModel) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<InformationModel>(informationModel, (StereoTypeTarget) rule.getTarget()); } } } return new NullMapped<InformationModel>(informationModel); }
/** * Finds the mapped element by a stereotype for a given enumeration literal * @param enumLiteral * @param stereoType * @return mapped element */ public IMapped<EnumLiteral> getMappedElement(final EnumLiteral enumLiteral, final String stereoType) { for (MappingRule rule : mappingRules) { for (Source ruleSource : rule.getSources()) { if (ruleSource instanceof EnumPropertySource && EcoreUtil.equals(((EnumPropertySource) ruleSource).getProperty(), enumLiteral) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<EnumLiteral>(enumLiteral, (StereoTypeTarget) rule.getTarget()); } } } return new NullMapped<EnumLiteral>(enumLiteral); }
/** * Finds the mapped element by a stereotype for a given property * @param property * @param stereoType * @return mapped element */ public IMapped<Property> getMappedElement(final Property property, final String stereoType) { for (MappingRule rule : mappingRules) { for (Source ruleSource : rule.getSources()) { if (ruleSource instanceof ConfigurationSource && EcoreUtil.equals(((ConfigurationSource) ruleSource).getProperty(), property) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<Property>(property, (StereoTypeTarget) rule.getTarget()); } else if (ruleSource instanceof StatusSource && EcoreUtil.equals(((StatusSource) ruleSource).getProperty(), property) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<Property>(property, (StereoTypeTarget) rule.getTarget()); } else if (ruleSource instanceof FaultSource && EcoreUtil.equals(((FaultSource) ruleSource).getProperty(), property) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<Property>(property, (StereoTypeTarget) rule.getTarget()); } else if (ruleSource instanceof EntityPropertySource && EcoreUtil.equals(((EntityPropertySource) ruleSource).getProperty(), property) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<Property>(property, (StereoTypeTarget) rule.getTarget()); } } } return new NullMapped<Property>(property); }
/** * Finds the mapped element by a stereotype for a given operation * @param operation * @param stereoType * @return mapped element */ public IMapped<Operation> getMappedElement(final Operation operation, final String stereoType) { for (MappingRule rule : mappingRules) { for (Source ruleSource : rule.getSources()) { if (ruleSource instanceof OperationSource && EcoreUtil.equals(((OperationSource) ruleSource).getOperation(), operation) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<Operation>(operation, (StereoTypeTarget) rule.getTarget()); } } } return new NullMapped<Operation>(operation); }
/** * Finds the mapped element by a stereotype for a given functionblock model * @param functionblockModel * @param stereoType * @return mapped element */ public IMapped<FunctionblockModel> getMappedElement(final FunctionblockModel functionblockModel, final String stereoType) { for (MappingRule rule : mappingRules) { for (Source ruleSource : rule.getSources()) { if (ruleSource instanceof FunctionBlockSource && EcoreUtil.equals(((FunctionBlockSource) ruleSource).getModel(), functionblockModel) && matchesStereoType(stereoType, (StereoTypeTarget) rule.getTarget())) { return new DefaultMapped<FunctionblockModel>(functionblockModel, (StereoTypeTarget) rule.getTarget()); } } } return new NullMapped<FunctionblockModel>(functionblockModel); }
isRef = globalFeature != null && EcoreUtil.equals(globalFeature.getEGenericType(), eStructuralFeature.getEGenericType());
isRef = globalFeature != null && EcoreUtil.equals(globalFeature.getEGenericType(), eStructuralFeature.getEGenericType());
isRef = globalFeature != null && EcoreUtil.equals(globalFeature.getEGenericType(), eStructuralFeature.getEGenericType());
isRef = globalFeature != null && EcoreUtil.equals(globalFeature.getEGenericType(), eStructuralFeature.getEGenericType());