org.decisiondeck.jmcda.structure.sorting.assignment
Interface IOrderedAssignments
- All Superinterfaces:
- IAssignmentsRead, IAssignmentsToMultipleRead, IOrderedAssignmentsRead, IOrderedAssignmentsToMultipleRead, IOrderedAssignmentsWriteable
- All Known Implementing Classes:
- OrderedAssignments, OrderedAssignmentsForwarder, OrderedAssignmentsFromRead
public interface IOrderedAssignments
- extends IOrderedAssignmentsRead, IOrderedAssignmentsWriteable
Equivalent to IAssignments to use when the categories the alternatives are assigned to are provided with a
total ordering, thus can be sorted from worst to best without ex-æquo.
Contrary to IAssignments however, this object mandates that when setting an assignment of an
alternative to some category, these categories be pre-defined. This can be done using the
IOrderedAssignmentsWriteable.setCategories(SortedSet) method and is necessary for this object to know the ordering on the categories, to
know how to interpret the assignments in terms of ordered categories and ensure that the method
IAssignmentsToMultipleRead.getCategories() returns a superset of the used categories. This interface does not extend
IAssignments because of this restriction it has on the categories to which an alternative may be assigned,
which must be predefined. The other interface does not have such a requirement.
An ordered assignments object equals an other one iff they contain the same alternatives assigned to the same
categories and contain the same set of overall categories in the same order. This definition is compatible with the
definition of equality over ordered assignments to multiple categories objects.
setCategory
boolean setCategory(Alternative alternative,
Category category)
- Sets, replaces, or removes the assignment of an alternative. The given category position in the ordering must
have been defined.
- Parameters:
alternative - not null.category - null or empty to assign the alternative to no category, i.e., to remove the assignment of
the given alternative. Otherwise, must be contained in the categories returned by
IAssignmentsToMultipleRead.getCategories().
- Returns:
true iff the call changed the assignments, i.e. true if the given alternative was assigned
and the assignment has been removed, or was assigned to a different category, or was not assigned and has
been.
Copyright © 2011. All Rights Reserved.