|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.decisiondeck.jmcda.structure.sorting.assignment.utils.AssignmentsUtils
public class AssignmentsUtils
| Constructor Summary | |
|---|---|
AssignmentsUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
addToCategories(IOrderedAssignmentsToMultiple assignments,
Alternative alternative,
Category category)
|
static void |
assertEqual(IOrderedAssignmentsToMultipleRead assignments1,
IOrderedAssignmentsToMultipleRead assignments2,
String name1,
String name2)
|
static void |
assertEqual(Map<DecisionMaker,? extends IOrderedAssignmentsRead> assignments1,
Map<DecisionMaker,? extends IOrderedAssignmentsRead> assignments2,
String name1,
String name2)
|
static void |
assertRestriction(IOrderedAssignmentsToMultipleRead assignments,
IOrderedAssignmentsToMultipleRead restriction)
|
static void |
completeAssignments(Set<Alternative> alternatives,
IOrderedAssignmentsToMultiple assignments)
|
static void |
copyAssignmentsToMultipleToOrderedTarget(IAssignmentsToMultipleRead source,
IOrderedAssignmentsToMultiple target)
Copies the given source assignments into the target. |
static void |
copyAssignmentsToMultipleToTargetSingle(IAssignmentsToMultipleRead source,
IAssignments target)
The source must have each alternative assigned to only one category. |
static void |
copyAssignmentsToOrderedTarget(IAssignmentsRead source,
IOrderedAssignments target)
Copies the given source assignments into the target. |
static void |
copyAssignmentsWithCredibilitiesToOrderedTarget(IAssignmentsWithCredibilitiesRead source,
IOrderedAssignmentsWithCredibilities target)
Copies the given source assignments into the target. |
static boolean |
copyOrderedAssignmentsToMultipleToTarget(IOrderedAssignmentsToMultipleRead source,
IOrderedAssignmentsToMultiple target)
Overrides the target by replacing every information it contains with the information in the given source. |
static void |
copyOrderedAssignmentsToMultipleToTargetSingle(IOrderedAssignmentsToMultipleRead source,
IOrderedAssignments target)
The source must have each alternative assigned to only one category. |
static boolean |
copyOrderedAssignmentsToTarget(IOrderedAssignmentsRead source,
IOrderedAssignments target)
Overrides the target by replacing every information it contains with the information in the given source. |
static boolean |
copyOrderedAssignmentsWithCredibilitiesToTarget(IOrderedAssignmentsWithCredibilitiesRead source,
IOrderedAssignmentsWithCredibilities target)
Overrides the target by replacing every information it contains with the information in the given source. |
static void |
copyOrderedAssignmentsWithCredibilitiesToTargetSingle(IOrderedAssignmentsWithCredibilitiesRead source,
IOrderedAssignments target)
The source must have each alternative assigned to only one category. |
static void |
ensuresSingle(IAssignmentsToMultipleRead assignments)
|
static void |
ensuresSingle(IAssignmentsWithCredibilitiesRead assignments)
|
static void |
ensuresToIntervals(IOrderedAssignmentsToMultiple assignments,
NavigableSet<Category> categories)
Ensures that every assigned alternative contained in the given data are assigned to an interval over the given ordered set of categories, or equivalently, that each alternative is assigned to a subset of the given categories which has no “hole”. |
static boolean |
equivalentOrderedToMultiple(IOrderedAssignmentsToMultipleRead ordered1,
IOrderedAssignmentsToMultipleRead ordered2)
|
static boolean |
equivalentOrderedWithCredibilities(IOrderedAssignmentsWithCredibilitiesRead ordered1,
IOrderedAssignmentsWithCredibilitiesRead ordered2)
|
static boolean |
equivalentToMultiple(IAssignmentsToMultipleRead assignments1,
IAssignmentsToMultipleRead assignments2)
|
static boolean |
equivalentWithCredibilities(IAssignmentsWithCredibilitiesRead assignments1,
IAssignmentsWithCredibilitiesRead assignments2)
|
static Set<Category> |
getAllCategoriesAssignedTo(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments,
Alternative alternative)
|
static NavigableMap<Category,Double> |
getCredibilitiesOrEmpty(IOrderedAssignmentsWithCredibilitiesRead assignments,
Alternative alternative)
If the given alternative is not assigned, returns a new empty map with comparator set to the comparator of the categories in the given assignments. |
static NavigableMap<Category,Double> |
getCredibilitiesWithZeroes(IOrderedAssignmentsWithCredibilitiesRead assignments,
Alternative alternative)
Retrieves the credibilities of assignments of the given alternative to all categories contained in the given assignments. |
static NavigableSet<Double> |
getCredibilityLevels(IAssignmentsWithCredibilitiesRead assignments)
|
static IOrderedAssignmentsToMultipleRead |
getEdgesView(IOrderedAssignmentsToMultipleRead delegate)
|
static Equivalence<IOrderedAssignmentsToMultipleRead> |
getEquivalenceRelationOrderedToMultiple()
|
static Equivalence<IOrderedAssignmentsWithCredibilitiesRead> |
getEquivalenceRelationOrderedWithCredibilities()
|
static Equivalence<IAssignmentsToMultipleRead> |
getEquivalenceRelationToMultiple()
|
static Equivalence<IAssignmentsWithCredibilitiesRead> |
getEquivalenceRelationWithCredibilities()
|
static IOrderedAssignments |
getFakeWritable(IOrderedAssignmentsRead delegateRead)
|
static IOrderedAssignmentsToMultiple |
getFakeWritableToMultiple(IOrderedAssignmentsToMultipleRead delegateRead)
|
static IOrderedAssignmentsWithCredibilities |
getFakeWriteableWithCredibilities(IOrderedAssignmentsWithCredibilitiesRead delegateRead)
|
static Map<Alternative,Set<Category>> |
getMapView(IAssignmentsToMultipleRead assignments)
|
static Map<Alternative,Map<Category,Double>> |
getMapViewOfCredibilities(IAssignmentsWithCredibilitiesRead assignments)
|
static IOrderedAssignmentsWithCredibilitiesRead |
getOrderedAssignmentsWithCredibilitiesView(IOrderedAssignmentsToMultipleRead assignments,
double credibilityValue)
|
static IOrderedAssignmentsRead |
getReadView(IOrderedAssignments delegate)
|
static IOrderedAssignmentsToMultipleRead |
getReadView(IOrderedAssignmentsToMultiple delegate)
|
static String |
getShortDescription(IAssignmentsWithCredibilitiesRead assignments)
Retrieves a description of all data contained in the given assignments object in a packed, debug, form. |
static int |
getSize(IOrderedAssignmentsToMultipleRead assignments)
|
static IOrderedAssignmentsToMultiple |
getUnion(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments,
NavigableSet<Category> categories,
Set<Alternative> alternatives)
Returns a new object containing every alternative assigned in at least one of the given assignments objects, and for each alternative, containing as an assignment the union of all categories to which the alternative is assigned across the given assignment objects. |
static Set<Alternative> |
getUnionAssignedAlternatives(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments)
Retrieves a read-only view of all the alternatives assigned in the given assignments objects at the time this method is invoked. |
static boolean |
removeCategory(IOrderedAssignments assignments,
Category toRemove)
Removes all assignments to the given category if there is any, and removes the category from the set of categories bound to the given assignments if it exists. |
static boolean |
removeCategory(IOrderedAssignmentsToMultiple assignments,
Category toRemove)
Removes all assignments to the given category if there is any, and removes the category from the set of categories bound to the given assignments if it exists. |
static boolean |
removeCategory(IOrderedAssignmentsWithCredibilities assignments,
Category toRemove)
Removes all assignments to the given category if there is any, and removes the category from the set of categories bound to the given assignments if it exists. |
static void |
renameCategory(IOrderedAssignments assignments,
Category oldCategory,
Category newCategory)
Replaces all assignments to the given old category with assignments to the given new category, and replaces the old category with the new one in the set of categories bound to the given assignments object. |
static void |
renameCategory(IOrderedAssignmentsToMultiple assignments,
Category oldCategory,
Category newCategory)
|
static void |
renameCategory(IOrderedAssignmentsWithCredibilities assignments,
Category oldCategory,
Category newCategory)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AssignmentsUtils()
| Method Detail |
|---|
public static void assertRestriction(IOrderedAssignmentsToMultipleRead assignments,
IOrderedAssignmentsToMultipleRead restriction)
throws IllegalStateException
IllegalStateExceptionpublic static Set<Alternative> getUnionAssignedAlternatives(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments)
allAssignments - not null.
null.
public static IOrderedAssignmentsWithCredibilitiesRead getOrderedAssignmentsWithCredibilitiesView(IOrderedAssignmentsToMultipleRead assignments,
double credibilityValue)
public static boolean copyOrderedAssignmentsToMultipleToTarget(IOrderedAssignmentsToMultipleRead source,
IOrderedAssignmentsToMultiple target)
source - not null.target - not null.
true iff the call to this method changed the contents of the given target, or equivalently,
false iff the given target was equal to the given source.
public static boolean equivalentOrderedWithCredibilities(IOrderedAssignmentsWithCredibilitiesRead ordered1,
IOrderedAssignmentsWithCredibilitiesRead ordered2)
public static void ensuresSingle(IAssignmentsToMultipleRead assignments)
throws InvalidInputException
InvalidInputException
public static void renameCategory(IOrderedAssignments assignments,
Category oldCategory,
Category newCategory)
assignments - not null.oldCategory - not null, must exist in the set of categories of the given assignments.newCategory - not null, must not exist in the set of categories of the given assignments.
public static boolean removeCategory(IOrderedAssignments assignments,
Category toRemove)
assignments - not null.toRemove - not null.
true iff the call to this method changed the state of the given assignments, or
equivalently, true iff the given category was contained in the given assignments.
public static void renameCategory(IOrderedAssignmentsToMultiple assignments,
Category oldCategory,
Category newCategory)
public static boolean removeCategory(IOrderedAssignmentsToMultiple assignments,
Category toRemove)
assignments - not null.toRemove - not null.
true iff the call to this method changed the state of the given assignments, or
equivalently, true iff the given category was contained in the given assignments.
public static boolean copyOrderedAssignmentsToTarget(IOrderedAssignmentsRead source,
IOrderedAssignments target)
source - not null.target - not null.
true iff the call to this method changed the contents of the given target, or equivalently,
false iff the given target was equal to the given source.
public static void copyOrderedAssignmentsToMultipleToTargetSingle(IOrderedAssignmentsToMultipleRead source,
IOrderedAssignments target)
throws InvalidInputException
The source must have each alternative assigned to only one category.
Overrides the target by replacing every information it contains with the information in the given source.
source - not null.target - not null.
InvalidInputException - if the source contains at least one alternative assigned to more than one category.public static Equivalence<IAssignmentsWithCredibilitiesRead> getEquivalenceRelationWithCredibilities()
public static String getShortDescription(IAssignmentsWithCredibilitiesRead assignments)
Object.toString() method.
assignments - not null.
null.public static Equivalence<IAssignmentsToMultipleRead> getEquivalenceRelationToMultiple()
public static boolean equivalentWithCredibilities(IAssignmentsWithCredibilitiesRead assignments1,
IAssignmentsWithCredibilitiesRead assignments2)
public static NavigableMap<Category,Double> getCredibilitiesWithZeroes(IOrderedAssignmentsWithCredibilitiesRead assignments,
Alternative alternative)
assignments - not null.alternative - not null.
null. The set of categories are the same as the set of categories in the given
assignments. All values are positive or zero. The returned map is a copy.
public static NavigableMap<Category,Double> getCredibilitiesOrEmpty(IOrderedAssignmentsWithCredibilitiesRead assignments,
Alternative alternative)
assignments - not null.alternative - not null.
null, a possibly read-only copy.
public static void renameCategory(IOrderedAssignmentsWithCredibilities assignments,
Category oldCategory,
Category newCategory)
public static boolean removeCategory(IOrderedAssignmentsWithCredibilities assignments,
Category toRemove)
assignments - not null.toRemove - not null.
true iff the call to this method changed the state of the given assignments, or
equivalently, true iff the given category was contained in the given assignments.
public static void ensuresToIntervals(IOrderedAssignmentsToMultiple assignments,
NavigableSet<Category> categories)
throws InvalidInputException
assignments - not null.categories - not null.
InvalidInputException - if some alternatives are assigned to some categories that do not form an interval over the given set
of categories.
public static void completeAssignments(Set<Alternative> alternatives,
IOrderedAssignmentsToMultiple assignments)
public static IOrderedAssignmentsToMultiple getUnion(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments,
NavigableSet<Category> categories,
Set<Alternative> alternatives)
allAssignments - not null.categories - not null, must be a superset of all categories used in the assignments objects.alternatives - if not null, the set must be included in the set of all alternatives assigned in at least
one of the given assignments. Those alternatives are the ones assigned in the returned union. The
iteration order of the returned union matches that of the given set.
null.public static Map<Alternative,Set<Category>> getMapView(IAssignmentsToMultipleRead assignments)
public static Map<Alternative,Map<Category,Double>> getMapViewOfCredibilities(IAssignmentsWithCredibilitiesRead assignments)
public static void ensuresSingle(IAssignmentsWithCredibilitiesRead assignments)
throws InvalidInputException
InvalidInputException
public static void copyOrderedAssignmentsWithCredibilitiesToTargetSingle(IOrderedAssignmentsWithCredibilitiesRead source,
IOrderedAssignments target)
throws InvalidInputException
The source must have each alternative assigned to only one category.
Overrides the target by replacing every information it contains with the information in the given source.
source - not null.target - not null.
InvalidInputException - if the source contains at least one alternative assigned to more than one category.public static Equivalence<IOrderedAssignmentsToMultipleRead> getEquivalenceRelationOrderedToMultiple()
public static boolean equivalentOrderedToMultiple(IOrderedAssignmentsToMultipleRead ordered1,
IOrderedAssignmentsToMultipleRead ordered2)
public static Equivalence<IOrderedAssignmentsWithCredibilitiesRead> getEquivalenceRelationOrderedWithCredibilities()
public static boolean equivalentToMultiple(IAssignmentsToMultipleRead assignments1,
IAssignmentsToMultipleRead assignments2)
public static void copyAssignmentsToMultipleToTargetSingle(IAssignmentsToMultipleRead source,
IAssignments target)
throws InvalidInputException
The source must have each alternative assigned to only one category.
Overrides the target by replacing every information it contains with the information in the given source.
source - not null.target - not null.
InvalidInputException - if the source contains at least one alternative assigned to more than one category.
public static void copyAssignmentsWithCredibilitiesToOrderedTarget(IAssignmentsWithCredibilitiesRead source,
IOrderedAssignmentsWithCredibilities target)
throws InvalidInputException
Copies the given source assignments into the target. The target must have a set of categories that contain all the given source assignments. The target existing assignments for alternatives not assigned in the source assignments are kept and not changed by this method. The target existing assignments for alternatives that also exist in the source are erased and replaced by the copy of the source assignments.
If the target set of categories is not a superset of the set of categories used in the source, an exception is thrown, and the given target is left unchanged.
source - not null.target - not null.
InvalidInputException - iff at least one alternative is assigned in source to a category not contained in the categories
associated to the given target.
public static Set<Category> getAllCategoriesAssignedTo(Iterable<? extends IOrderedAssignmentsToMultipleRead> allAssignments,
Alternative alternative)
public static IOrderedAssignments getFakeWritable(IOrderedAssignmentsRead delegateRead)
public static IOrderedAssignmentsWithCredibilities getFakeWriteableWithCredibilities(IOrderedAssignmentsWithCredibilitiesRead delegateRead)
public static void copyAssignmentsToOrderedTarget(IAssignmentsRead source,
IOrderedAssignments target)
throws InvalidInputException
Copies the given source assignments into the target. The target must have a set of categories that contain all the given source assignments. The target existing assignments for alternatives not assigned in the source assignments are kept and not changed by this method. The target existing assignments for alternatives that also exist in the source are erased and replaced by the copy of the source assignments.
If the target set of categories is not a superset of the set of categories used in the source, an exception is thrown, and the given target is left unchanged.
source - not null.target - not null.
InvalidInputException - iff at least one alternative is assigned in source to a category not contained in the categories
associated to the given target.
public static void copyAssignmentsToMultipleToOrderedTarget(IAssignmentsToMultipleRead source,
IOrderedAssignmentsToMultiple target)
throws InvalidInputException
Copies the given source assignments into the target. The target must have a set of categories that contain all the given source assignments. The target existing assignments for alternatives not assigned in the source assignments are kept and not changed by this method. The target existing assignments for alternatives that also exist in the source are erased and replaced by the copy of the source assignments.
If the target set of categories is not a superset of the set of categories used in the source, an exception is thrown, and the given target is left unchanged.
source - not null.target - not null.
InvalidInputException - iff at least one alternative is assigned in source to a category not contained in the categories
associated to the given target.public static IOrderedAssignmentsToMultiple getFakeWritableToMultiple(IOrderedAssignmentsToMultipleRead delegateRead)
public static IOrderedAssignmentsRead getReadView(IOrderedAssignments delegate)
public static IOrderedAssignmentsToMultipleRead getReadView(IOrderedAssignmentsToMultiple delegate)
public static IOrderedAssignmentsToMultipleRead getEdgesView(IOrderedAssignmentsToMultipleRead delegate)
public static void assertEqual(IOrderedAssignmentsToMultipleRead assignments1,
IOrderedAssignmentsToMultipleRead assignments2,
String name1,
String name2)
throws IllegalStateException
IllegalStateExceptionpublic static int getSize(IOrderedAssignmentsToMultipleRead assignments)
public static boolean addToCategories(IOrderedAssignmentsToMultiple assignments,
Alternative alternative,
Category category)
public static void assertEqual(Map<DecisionMaker,? extends IOrderedAssignmentsRead> assignments1,
Map<DecisionMaker,? extends IOrderedAssignmentsRead> assignments2,
String name1,
String name2)
public static NavigableSet<Double> getCredibilityLevels(IAssignmentsWithCredibilitiesRead assignments)
public static boolean copyOrderedAssignmentsWithCredibilitiesToTarget(IOrderedAssignmentsWithCredibilitiesRead source,
IOrderedAssignmentsWithCredibilities target)
source - not null.target - not null.
true iff the call to this method changed the contents of the given target, or equivalently,
false iff the given target was equal to the given source.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||