Source:
<code>private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = Lists.newArrayList(); List<EObject> semanticElements = Lists.newArrayList(); UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { <START> if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } <END> } if (elementsToSelectFromUIState.isEmpty()) { selectedElements = Lists.newArrayList(); } else if (hasRepresentation && !hasRepElement && !hasSemanticElement) { selectedElements = Lists.newArrayList(); } else if (hasRepElement && (hasRepresentation || hasSemanticElement)) { selectedElements = null; } else if (hasSemanticElement) { selectedElements = Lists.newArrayList(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement) { if (uiState.isInverseSelectionOrder()) { Collections.reverse(dRepElements); } if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = Lists.newArrayList(dRepElements); } } return selectedElements; }</code><technical_language>if is a style element in list: this is a DRepresentationElement, a DRepresentation a semantic element..</technical_language>

Target:
private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = Lists.newArrayList(); List<EObject> semanticElements = Lists.newArrayList(); UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } } if (elementsToSelectFromUIState.isEmpty()) { selectedElements = Lists.newArrayList(); } else if (hasRepresentation && !hasRepElement && !hasSemanticElement) { selectedElements = Lists.newArrayList(); } else if (hasRepElement && (hasRepresentation || hasSemanticElement)) { selectedElements = Lists.newArrayList(); } else if (hasSemanticElement) { selectedElements = Lists.newArrayList(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement) { if (uiState.isInverseSelectionOrder()) { Collections.reverse(dRepElements); } if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = Lists.newArrayList(dRepElements); } } return selectedElements; }