org.decisiondeck.jmcda.structure.sorting.assignment.credibilities
Class OrderedAssignmentsWithCredibilitiesFromRead

java.lang.Object
  extended by org.decisiondeck.jmcda.structure.sorting.assignment.credibilities.OrderedAssignmentsWithCredibilitiesFromRead
All Implemented Interfaces:
IAssignmentsWithCredibilitiesRead, IOrderedAssignmentsWithCredibilities, IOrderedAssignmentsWithCredibilitiesRead, IAssignmentsToMultipleRead, IOrderedAssignmentsToMultipleRead

public class OrderedAssignmentsWithCredibilitiesFromRead
extends Object
implements IOrderedAssignmentsWithCredibilities


Constructor Summary
OrderedAssignmentsWithCredibilitiesFromRead(IOrderedAssignmentsWithCredibilitiesRead delegate)
           
 
Method Summary
 boolean clear()
           
 boolean equals(Object obj)
           Indicates whether the given object is equal to this one.
 Set<Alternative> getAlternatives()
          Retrieves a read-only view of the assigned alternatives.
 Set<Alternative> getAlternatives(Category category)
           Retrieves a read-only view, or copy, of the alternatives that are assigned to the given category, or to a set of categories including the given category.
 NavigableSet<Category> getCategories()
           Retrieves a (possibly read-only) copy of a set containing at least all the categories to which at least one alternative is assigned.
 NavigableSet<Category> getCategories(Alternative alternative)
          Retrieves the categories to which an alternative is assigned.
 NavigableMap<Category,Double> getCredibilities(Alternative alternative)
           Retrieves a (possibly read-only) copy of the categories an alternative is assigned to together with their associated credibility degrees, ordered from the worst category to the best category the given alternative is assigned to.
 int hashCode()
           
 boolean setCategories(SortedSet<Category> categories)
           Sets the categories and the order of the categories in this object.
 boolean setCredibilities(Alternative alternative, Map<Category,Double> credibilities)
          Sets, replaces, or removes the assignment of an alternative and the associated degrees of credibility.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedAssignmentsWithCredibilitiesFromRead

public OrderedAssignmentsWithCredibilitiesFromRead(IOrderedAssignmentsWithCredibilitiesRead delegate)
Method Detail

clear

public boolean clear()
Specified by:
clear in interface IOrderedAssignmentsWithCredibilities

equals

public boolean equals(Object obj)
Description copied from interface: IOrderedAssignmentsWithCredibilitiesRead

Indicates whether the given object is equal to this one. This is true iff the given object is a IOrderedAssignmentsWithCredibilitiesRead, contains the same alternatives assigned to the same categories with the same credibilities, and contains the same set of overall categories as this object in the same order.

Specified by:
equals in interface IAssignmentsWithCredibilitiesRead
Specified by:
equals in interface IOrderedAssignmentsWithCredibilitiesRead
Specified by:
equals in interface IAssignmentsToMultipleRead
Specified by:
equals in interface IOrderedAssignmentsToMultipleRead
Overrides:
equals in class Object
Parameters:
obj - may be null.
Returns:
true iff both objects are considered equal.

getAlternatives

public Set<Alternative> getAlternatives()
Description copied from interface: IAssignmentsToMultipleRead
Retrieves a read-only view of the assigned alternatives.

Specified by:
getAlternatives in interface IAssignmentsToMultipleRead
Returns:
not null.

getAlternatives

public Set<Alternative> getAlternatives(Category category)
Description copied from interface: IAssignmentsToMultipleRead

Retrieves a read-only view, or copy, of the alternatives that are assigned to the given category, or to a set of categories including the given category.

If the given category is not in the set returned by IAssignmentsToMultipleRead.getCategories(), the returned set is empty.

Specified by:
getAlternatives in interface IAssignmentsToMultipleRead
Parameters:
category - not null.
Returns:
not null.

getCategories

public NavigableSet<Category> getCategories()
Description copied from interface: IAssignmentsToMultipleRead

Retrieves a (possibly read-only) copy of a set containing at least all the categories to which at least one alternative is assigned. Depending on the implementing object, the returned set may be larger than this. It may for example contain all the categories that are available in some context, even when the alternatives assignments do not cover the whole set of possibilities.

The returned set is a copy: if the assignment related to the given alternative later change, this change is not reflected to the object this method returns.

Specified by:
getCategories in interface IAssignmentsToMultipleRead
Specified by:
getCategories in interface IOrderedAssignmentsToMultipleRead
Returns:
a set, not null, empty iff no alternatives are assigned.

getCategories

public NavigableSet<Category> getCategories(Alternative alternative)
Description copied from interface: IAssignmentsToMultipleRead
Retrieves the categories to which an alternative is assigned.

Specified by:
getCategories in interface IAssignmentsToMultipleRead
Specified by:
getCategories in interface IOrderedAssignmentsToMultipleRead
Parameters:
alternative - not null.
Returns:
a read-only copy of the set of categories to which this alternative is assigned, or null iff the alternative is not assigned. The returned set is never empty. The returned set is a copy (if the assignment related to the given alternative later change, this change is not reflected to the object this method returns).

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setCategories

public boolean setCategories(SortedSet<Category> categories)
Description copied from interface: IOrderedAssignmentsWithCredibilities

Sets the categories and the order of the categories in this object.

Caution should be execised when using this method on a non empty object. The simple case is when the given categories ordering is compatible with the ordering already used. If on the countrary the given categories order is not compatible with the already given ordered assignments, the assignments will be changed to reflect the new order. The user should check whether the order is compatible before using this method if she does not want this to happen.

Specified by:
setCategories in interface IOrderedAssignmentsWithCredibilities
Parameters:
categories - null to remove the associated categories (all the orderings are lost), authorized only when no assignments are contained in this object. Must be a superset of the categories already used.
Returns:
true iff the categories changed.

getCredibilities

public NavigableMap<Category,Double> getCredibilities(Alternative alternative)
Description copied from interface: IOrderedAssignmentsWithCredibilitiesRead

Retrieves a (possibly read-only) copy of the categories an alternative is assigned to together with their associated credibility degrees, ordered from the worst category to the best category the given alternative is assigned to. That ordering relates to the preference order on the categories and not to the degrees of credibilities, i.e. it is usually not ordered by degree of credibility. The order is compatible with the ordering given by IAssignmentsToMultipleRead.getCategories().

Specified by:
getCredibilities in interface IAssignmentsWithCredibilitiesRead
Specified by:
getCredibilities in interface IOrderedAssignmentsWithCredibilitiesRead
Parameters:
alternative - not null.
Returns:
null iff the given alternative is not assigned, otherwise, a map containing at least one entry.

setCredibilities

public boolean setCredibilities(Alternative alternative,
                                Map<Category,Double> credibilities)
Description copied from interface: IOrderedAssignmentsWithCredibilities
Sets, replaces, or removes the assignment of an alternative and the associated degrees of credibility. The used ordering is the one given by IAssignmentsToMultipleRead.getCategories(). A zero value as a degree of credibility is considered as equivalent to a missing entry: it is interpreted as meaning that the given alternative is not assigned to the corresponding category.

Specified by:
setCredibilities in interface IOrderedAssignmentsWithCredibilities
Parameters:
alternative - not null.
credibilities - null or empty to assign the alternative to no category, i.e., to remove the assignment of the given alternative. The map entries may not contain a null key or value, the values must be positive or zero, the categories must be contained in IAssignmentsToMultipleRead.getCategories(). If the map contains only zeroes, it is considered empty.
Returns:
true iff the call changed the assignments, i.e., iff the assignment existed and has been removed, or existed and has changed (be it a change in some credibility degrees or a change of category), or did not exist and has been added.


Copyright © 2011. All Rights Reserved.