Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement methods for iteration #317

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,9 @@
package de.retest.recheck.ui.review;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import de.retest.recheck.ui.descriptors.Element;
Expand Down Expand Up @@ -33,6 +35,13 @@ public AttributeChanges getAttributesChanges() {
return attributeChanges;
}

public List<AttributeChanges> getAllAttributeChanges() {
final List<AttributeChanges> allAttributeChanges = new ArrayList<>();
ivonx marked this conversation as resolved.
Show resolved Hide resolved
allAttributeChanges.add( attributeChanges );
allAttributeChanges.add( identAttributeChanges );
return allAttributeChanges;
}

private final Set<Element> insertChanges = new HashSet<>();

public boolean containsInsertChange( final Element element ) {
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/de/retest/recheck/ui/review/ReviewResult.java
Expand Up @@ -2,6 +2,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import de.retest.recheck.ui.diff.AttributeDifference;

public class ReviewResult {

Expand Down Expand Up @@ -31,6 +34,21 @@ public List<SuiteChangeSet> getSuiteChangeSets() {
return nonEmpyChangeSets;
}

public List<ActionChangeSet> getAllActionChangeSets() {
return getSuiteChangeSets().stream() //
.flatMap( suiteChangeSet -> suiteChangeSet.getTestChangeSets().stream() ) //
.flatMap( testChangeSet -> testChangeSet.getAllActionChangeSets().stream() ) //
.collect( Collectors.toList() );
}

public List<AttributeDifference> getAttributeDifferences() {
ivonx marked this conversation as resolved.
Show resolved Hide resolved
return getAllActionChangeSets().stream()
.flatMap( actionChangeSet -> actionChangeSet.getAllAttributeChanges().stream()
.flatMap( attributeChanges -> attributeChanges.getChanges().values().parallelStream()
ivonx marked this conversation as resolved.
Show resolved Hide resolved
.flatMap( attributeDifferences -> attributeDifferences.stream() ) ) )
.collect( Collectors.toList() );
}

@Override
public String toString() {
return "ReviewResult [suiteChangeSets=" + suiteChangeSets.size() + "]";
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/de/retest/recheck/ui/review/TestChangeSet.java
Expand Up @@ -62,6 +62,13 @@ public ActionChangeSet getActionChangeSet( final int index ) {
}
}

public List<ActionChangeSet> getAllActionChangeSets() {
final List<ActionChangeSet> all = new ArrayList<>();
all.add( initialStateChangeSet );
all.addAll( actionChangeSets );
return all;
}

public boolean isEmpty() {
return initialStateChangeSet.isEmpty() && isEmpty( actionChangeSets );
}
Expand Down