com.bbn.bue.common.evaluation.Alignment Maven / Gradle / Ivy
package com.bbn.bue.common.evaluation;
import com.google.common.annotations.Beta;
import java.util.Collection;
import java.util.Set;
/**
* Represents a 'pairing up' of two groups of objects of the same type, the {@code key} set and the
* {@code test} set. Alignments are intended to be
* immutable, so it is always safe to case an {@code Alignment} to {@code Alignment} for any
* super-type of {@code T}.
*
* The objects being aligned must have hash codes and equality methods compatible with use in sets
* and maps.
*
* @param The type of objects in the left set. Covariant.
* @param The type of objects in the right set. Covariant.
*/
@Beta
public interface Alignment {
/**
* Those items in the left set which were not paired with anything in the right.
*/
Set leftUnaligned();
/**
* Those items in the right set which were not paired with anything in the right.
*/
Set rightUnaligned();
/**
* Those items in the left set which were paired with something in the right.
*/
Set leftAligned();
/**
* Those items in the right set which were paired with something in the right.
*/
Set rightAligned();
/**
* Get all items in the left set, if any, which align to the provided right set item. If x is in
* {@code alignedToRightItem(y)}, then y is in {@code alignedToRightItem(x)}.
*/
Collection alignedToRightItem(Object rightItem);
/**
* Get all items in the right set, if any, which align to the provided left set item. If x is in
* {@code alignedToRightItem(y)}, then y is in {@code alignedToRightItem(x)}.
*/
Collection alignedToLeftItem(Object leftItem);
Set allLeftItems();
Set allRightItems();
}