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

java.lang.Object
  extended by org.decisiondeck.jmcda.structure.sorting.assignment.credibilities.AssignmentsWithCredibilities
All Implemented Interfaces:
IAssignmentsWithCredibilities, IAssignmentsWithCredibilitiesRead, IAssignmentsToMultipleRead

public class AssignmentsWithCredibilities
extends Object
implements IAssignmentsWithCredibilities


Constructor Summary
AssignmentsWithCredibilities()
           
AssignmentsWithCredibilities(IAssignmentsWithCredibilitiesRead source)
          Copy-constructor by value.
 
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.
 Set<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.
 Set<Category> getCategories(Alternative alternative)
          Retrieves the categories to which an alternative is assigned.
 Map<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.
 int hashCode()
           
 boolean setCategories(Set<Category> categories)
           
 boolean setCredibilities(Alternative alternative, Map<Category,Double> credibilities)
          Sets, replaces, or removes the assignment of an alternative and the associated degrees of credibility.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssignmentsWithCredibilities

public AssignmentsWithCredibilities()

AssignmentsWithCredibilities

public AssignmentsWithCredibilities(IAssignmentsWithCredibilitiesRead source)
Copy-constructor by value. No reference is kept to the given object.

Parameters:
source - not null.
Method Detail

getCategories

public Set<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
Returns:
a set, not null, empty iff no alternatives are assigned.

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.

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.

setCategories

public boolean setCategories(Set<Category> categories)

clear

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

getCredibilities

public Map<Category,Double> getCredibilities(Alternative alternative)
Description copied from interface: IAssignmentsWithCredibilitiesRead
Retrieves a (possibly read-only) copy of the categories an alternative is assigned to together with their associated credibility degrees. The returned map is a copy (if the assignment related to the given alternative later change, this change is not reflected to the object this method returns) and contain no null keys or values and only values greater than zero.

Specified by:
getCredibilities in interface IAssignmentsWithCredibilitiesRead
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: IAssignmentsWithCredibilities
Sets, replaces, or removes the assignment of an alternative and the associated degrees of credibility. 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 IAssignmentsWithCredibilities
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. 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.

equals

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

Indicates whether the given object is equal to this one.

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getCategories

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

Specified by:
getCategories in interface IAssignmentsToMultipleRead
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).


Copyright © 2011. All Rights Reserved.