de.retest.ui.review.ActionChangeSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of retest-model Show documentation
Show all versions of retest-model Show documentation
The domain model for both retest and recheck.
package de.retest.ui.review;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import de.retest.ui.descriptors.Element;
import de.retest.ui.descriptors.IdentifyingAttributes;
public class ActionChangeSet {
private final String description;
public ActionChangeSet() {
this( null );
}
public ActionChangeSet( final String description ) {
this.description = description;
}
private final AttributeChanges identAttributeChanges = new AttributeChanges();
public AttributeChanges getIdentAttributeChanges() {
return identAttributeChanges;
}
private final AttributeChanges attributeChanges = new AttributeChanges();
public AttributeChanges getAttributesChanges() {
return attributeChanges;
}
private final Set insertChanges = new HashSet();
public boolean containsInsertChange( final Element element ) {
return insertChanges.contains( element );
}
public void addInsertChange( final Element element ) {
insertChanges.add( element );
}
public void removeInsertChange( final Element element ) {
insertChanges.remove( element );
}
public Set getInsertedChanges() {
return Collections.unmodifiableSet( insertChanges );
}
private final Set deletedChanges = new HashSet();
public boolean containsDeletedChange( final IdentifyingAttributes identifyingAttributes ) {
return deletedChanges.contains( identifyingAttributes );
}
public void addDeletedChange( final IdentifyingAttributes identifyingAttributes ) {
deletedChanges.add( identifyingAttributes );
}
public void removeDeletedChange( final IdentifyingAttributes identifyingAttributes ) {
deletedChanges.remove( identifyingAttributes );
}
public Set getDeletedChanges() {
return Collections.unmodifiableSet( deletedChanges );
}
public boolean isEmpty() {
return identAttributeChanges.isEmpty() && attributeChanges.isEmpty() && insertChanges.isEmpty()
&& deletedChanges.isEmpty();
}
private int size() {
return identAttributeChanges.size() + attributeChanges.size() + insertChanges.size() + deletedChanges.size();
}
@Override
public String toString() {
return "ActionChangeSet [" + size() + " changes]";
}
public String getDescription() {
return description;
}
}