org.decisiondeck.jmcda.structure.sorting.assignment
Interface IAssignmentsRead

All Superinterfaces:
IAssignmentsToMultipleRead
All Known Subinterfaces:
IAssignments, IOrderedAssignments, IOrderedAssignmentsRead
All Known Implementing Classes:
Assignments, AssignmentsFiltering, OrderedAssignments, OrderedAssignmentsFiltering, OrderedAssignmentsForwarder, OrderedAssignmentsFromRead

public interface IAssignmentsRead
extends IAssignmentsToMultipleRead

A read interface for a set of assignments where one assignment is a mapping of an alternative to exactly one category.

A set of such assignments can also be considered as a degenerate case of a set of assignments to multiple categories, where each alternative is assigned to exactly one category (which is a legal assignment to ''multiple'' categories), hence the inheritance relation. Objects implementing this interface however may only implement the degenerate case of the multiple categories case: it is impossible to satisfy both the contract for this interface (ensuring that every alternative is assigned to exactly one category) and the general case of the multiple categories interface (allowing an alternative to be assigned to more than one category). Having the inheritance relation permits to use objects implementing the single category case (this interface) for algorithms dealing with multiple categories assignments.

An assignments object equals an other one iff they contain the same alternatives assigned to the same categories and the same set of overall categories. The last condition is not redundant as the set of categories may be a superset of the set of categories to which alternatives are assigned. This definition is compatible with the definition of the assignments to multiple categories object.

TODO could also define a method that provides a simple map Map and define the multiple case to extend Map>?


Method Summary
 Set<Category> getCategories(Alternative alternative)
          Retrieves, if it exists, the category to which an alternative is assigned as a singleton set.
 Category getCategory(Alternative alternative)
           
 
Methods inherited from interface org.decisiondeck.jmcda.structure.sorting.assignment.IAssignmentsToMultipleRead
equals, getAlternatives, getAlternatives, getCategories
 

Method Detail

getCategory

Category getCategory(Alternative alternative)
Parameters:
alternative - not null.
Returns:
the category to which this alternative is assigned, or null iff this alternative is not assigned.

getCategories

Set<Category> getCategories(Alternative alternative)
Retrieves, if it exists, the category to which an alternative is assigned as a singleton set. This method provides compatibility with the IAssignmentsToMultipleRead interface. The method getCategory(Alternative) is functionally equivalent and should be preferred over this one as it is clearer.

Specified by:
getCategories in interface IAssignmentsToMultipleRead
Parameters:
alternative - not null.
Returns:
a set containing exactly one element, namely the category to which the given alternative is assigned, or null iff the alternative is not assigned.


Copyright © 2011. All Rights Reserved.