|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelper
org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelperWithVarious
org.decisiondeck.jmcda.persist.xmcda2.XMCDACriteria
public class XMCDACriteria
Methods for reading and writing criteria and related informations from and to XMCDA fragments.
| Nested Class Summary | |
|---|---|
static class |
XMCDACriteria.IsContinuousInterval
A predicate that returns true if the given interval is not null and is continuous,
thus, has no step size. |
| Field Summary | |
|---|---|
static String |
INDIFFERENCE_CONCEPT_STRING
|
static String |
PREFERENCE_CONCEPT_STRING
|
static String |
VETO_CONCEPT_STRING
|
static String |
WEIGHTS_CONCEPT_STRING
|
| Constructor Summary | |
|---|---|
XMCDACriteria()
Creates a new object which will use the default error management strategy XMCDAErrorsManager.ErrorManagement.THROW. |
|
XMCDACriteria(XMCDAErrorsManager errorsManager)
Creates a new object delegating error management to the given error manager in case of unexpected data read. |
|
| Method Summary | |
|---|---|
Set<Criterion> |
getCriteria()
Retrieves a copy of the set of criteria read after the last call to read(XCriteria), with the iteration
order reflecting the order of reading. |
Set<Criterion> |
getInactiveCriteria()
Retrieves the criteria stored in this object as inactive. |
Map<Criterion,Double> |
getIndifferenceThresholds()
Retrieves a writeable view to the criteria indifference thresholds. |
Map<Criterion,String> |
getNames()
Retrieves a writeable view to the criteria names. |
Map<Criterion,Double> |
getPreferenceThresholds()
Retrieves a writeable view to the criteria preference thresholds. |
Map<Criterion,IOrderedInterval> |
getScales()
Retrieves a writeable view to the criteria scales. |
ICriteriaWithThresholds |
getThresholds()
TODO this should be a writeable view, other methods should be removed. |
Map<Criterion,Double> |
getVetoThresholds()
Retrieves a writeable view to the criteria veto thresholds. |
boolean |
mightBeCoalitionsPerDecisionMaker(Collection<XCriteriaSet> xAllCriteriaSet)
Tests whether the given XMCDA fragment possibly contains coalitions informations per decision maker. |
Set<Criterion> |
read(XCriteria xCriteria)
Retrieves the set of criteria contained into the given XMCDA fragment, except those marked as inactive. |
Set<Criterion> |
readAll(Collection<XCriteria> xAllCriteria)
Retrieves the set of criteria contained into the given XMCDA fragments, except for the criteria marked as inactive. |
Map<DecisionMaker,ICoalitions> |
readAllCoalitions(Collection<XCriteriaSet> xAllCriteriaSet)
Retrieves the coalitions, thus the weights and the majority threshold, per decision makers, found in the given XMCDA fragments. |
Coalitions |
readCoalitions(XCriteriaSet xCriteriaSet)
Retrieves the coalitions, thus the weights and the majority threshold, found in the given XMCDA fragment. |
Weights |
readWeights(Collection<XCriteriaValues> xCriteriaValuesList)
Retrieves the weights from the XMCDA fragment among the given collection that has the MCDA concept corresponding to the WEIGHTS_CONCEPT_STRING. |
Weights |
readWeights(XCriteriaSet xCriteriaSet)
Retrieves the weights found in the given XMCDA fragment. |
Weights |
readWeights(XCriteriaValues xCriteriaValues)
Retrieves the weights found in the given XMCDA fragment. |
void |
setCriteriaOrder(Collection<Criterion> criteriaOrder)
|
void |
setDmsOrder(Collection<DecisionMaker> dmsOrder)
|
void |
setInactiveCriteria(Set<Criterion> inactiveCriteria)
Stores the given criteria in this object. |
void |
setIndifferenceThresholds(Map<Criterion,Double> indifferenceThresholds)
Sets the criteria indifference thresholds stored in this object as the given ones. |
void |
setNames(Map<Criterion,String> names)
Sets the criteria names stored in this object as the given names. |
void |
setPreferenceThresholds(Map<Criterion,Double> preferenceThresholds)
Sets the criteria preference thresholds stored in this object as the given ones. |
void |
setScales(Map<Criterion,IOrderedInterval> scales)
Sets the criteria scales stored in this object as the given ones. |
void |
setVetoThresholds(Map<Criterion,Double> vetoThresholds)
Sets the criteria veto thresholds stored in this object as the given ones. |
List<XCriteriaSet> |
write(Map<DecisionMaker,ICoalitions> allCoalitions)
Retrieves the XMCDA equivalent of the given collection of coalitions, as a collection of XCriteriaSet,
each one being associated to the corresponding decision maker in the given input. |
XCriteria |
write(Set<Criterion> source)
Retrieves an XMCDA fragment containing the given criteria, together with name, scale and preference, indifference, veto thresholds, if set in this object. |
static XCriteria |
write(Set<Criterion> source,
Map<Criterion,IOrderedInterval> scales,
ICriteriaWithThresholds thresholds)
Retrieves an XMCDA fragment containing the given criteria, together with scale and preference, indifference, veto thresholds, if defined. |
XCriteriaSet |
write(Weights source)
Retrieves the XMCDA equivalent of the given weights. |
XCriteriaSet |
writeCoalitions(ICoalitions source)
Retrieves the XMCDA equivalent of the given coalitions. |
| Methods inherited from class org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelper |
|---|
error, getStrategy, setStrategy |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String INDIFFERENCE_CONCEPT_STRING
public static final String PREFERENCE_CONCEPT_STRING
public static final String VETO_CONCEPT_STRING
public static final String WEIGHTS_CONCEPT_STRING
| Constructor Detail |
|---|
public XMCDACriteria()
XMCDAErrorsManager.ErrorManagement.THROW.
public XMCDACriteria(XMCDAErrorsManager errorsManager)
errorsManager - not null.| Method Detail |
|---|
public static XCriteria write(Set<Criterion> source,
Map<Criterion,IOrderedInterval> scales,
ICriteriaWithThresholds thresholds)
Retrieves an XMCDA fragment containing the given criteria, together with scale and preference, indifference, veto thresholds, if defined. If some scales or thresholds do not correspond to a criterion of the given source criteria, it is not taken into account. The scales and thresholds informations are not expected to be complete, some may be missing.
The scales used as values in the given scales map and corresponding to a criterion in the given set must be continuous scales, thus must have no step size. Discrete scales are not currently supported.
source - not null.scales - possibly null; may miss elements.thresholds - possibly null; may miss elements.
null.write(Set)public XCriteria write(Set<Criterion> source)
Retrieves an XMCDA fragment containing the given criteria, together with name, scale and preference, indifference, veto thresholds, if set in this object. If some name, scale or threshold set in this object do not correspond to a criterion of the given source criteria, it is not taken into account. The names, scales and thresholds informations are not expected to be complete, some may be missing.
source - not null.
null.setNames(java.util.Map) ,
setScales(java.util.Map) ,
setPreferenceThresholds(java.util.Map) ,
setIndifferenceThresholds(java.util.Map) ,
setVetoThresholds(java.util.Map) public Map<Criterion,String> getNames()
null key, no
null values, and such entries may not be added to the map.
null.public ICriteriaWithThresholds getThresholds()
null.public void setNames(Map<Criterion,String> names)
names - not null, may be empty, no null key or value.public Map<Criterion,Double> getPreferenceThresholds()
null key,
no null values, and such entries may not be added to the map.
null.public void setPreferenceThresholds(Map<Criterion,Double> preferenceThresholds)
preferenceThresholds - not null, may be empty, must contain no null key or values.public Map<Criterion,Double> getIndifferenceThresholds()
null
key, no null values, and such entries may not be added to the map.
null.public void setIndifferenceThresholds(Map<Criterion,Double> indifferenceThresholds)
indifferenceThresholds - not null, may be empty, must contain no null key or values.public Map<Criterion,Double> getVetoThresholds()
null key, no
null values, and such entries may not be added to the map.
null.public void setVetoThresholds(Map<Criterion,Double> vetoThresholds)
vetoThresholds - not null, may be empty, must contain no null key or values.
public Set<Criterion> read(XCriteria xCriteria)
throws InvalidInputException
Retrieves the set of criteria contained into the given XMCDA fragment, except those marked as inactive. The iteration order of the returned set matches the reading order.
This object keeps a copy of the informations just read: the names, the scales, the thresholds of the criteria, as well as a copy of the set of criteria itself, and a copy of the inactive criteria. Previously existing informations, that have been set or that have been read previously, are deleted before reading.
In case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy, otherwise, non conforming informations will be skipped.
xCriteria - not null.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.getCriteria(),
getNames(),
getScales(),
getPreferenceThresholds(),
getIndifferenceThresholds(),
getVetoThresholds()
public Set<Criterion> readAll(Collection<XCriteria> xAllCriteria)
throws InvalidInputException
Retrieves the set of criteria contained into the given XMCDA fragments, except for the criteria marked as inactive. The iteration order of the returned set matches the reading order.
This object keeps a copy of the informations just read: the names, the scales, the thresholds of the criteria, as well as a copy of the set of criteria itself and a separate copy of the inactive criteria. Previously existing informations, that have been set or that have been read previously, are deleted before reading.
In case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy, otherwise, non conforming informations will be skipped.
xAllCriteria - not null.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.getCriteria(),
getNames(),
getScales(),
getPreferenceThresholds(),
getIndifferenceThresholds(),
getVetoThresholds()public Set<Criterion> getCriteria()
read(XCriteria), with the iteration
order reflecting the order of reading. If no read has occurred yet, an empty set is returned.
null.
public Weights readWeights(XCriteriaValues xCriteriaValues)
throws InvalidInputException
Retrieves the weights found in the given XMCDA fragment.
In case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy, otherwise, non conforming informations will be skipped.
xCriteriaValues - not null.
null, may be empty.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public Weights readWeights(Collection<XCriteriaValues> xCriteriaValuesList)
throws InvalidInputException
Retrieves the weights from the XMCDA fragment among the given collection that has the MCDA concept corresponding
to the WEIGHTS_CONCEPT_STRING.
This method expects, among others, that there is exactly one such XMCDA fragment among the given collection. In
case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy, otherwise, non conforming informations will be skipped.
xCriteriaValuesList - not null.
null, may be empty.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public Weights readWeights(XCriteriaSet xCriteriaSet)
throws InvalidInputException
Retrieves the weights found in the given XMCDA fragment.
In case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy, otherwise, non conforming informations will be skipped.
xCriteriaSet - not null.
null, may be empty.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public Map<DecisionMaker,ICoalitions> readAllCoalitions(Collection<XCriteriaSet> xAllCriteriaSet)
throws InvalidInputException
Retrieves the coalitions, thus the weights and the majority threshold, per decision makers, found in the given XMCDA fragments. The iteration order of the returned map matches that of the given collection.
This object expects, among others, the majority thresholds to be set. In case of unexpected data, an exception is
thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy, otherwise, non conforming informations
will be skipped.
xAllCriteriaSet - not null.
null, with no null values, but possibly with empty values. If no unexpected
content have been read, the values contain at least a majority threshold.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.public boolean mightBeCoalitionsPerDecisionMaker(Collection<XCriteriaSet> xAllCriteriaSet)
Tests whether the given XMCDA fragment possibly contains coalitions informations per decision maker.
xAllCriteriaSet - not null.
true iff the given collection contains more than one element or contains exactly one element
which has its name set.
public Coalitions readCoalitions(XCriteriaSet xCriteriaSet)
throws InvalidInputException
Retrieves the coalitions, thus the weights and the majority threshold, found in the given XMCDA fragment.
This object expects, among others, the majority threshold to be set. In case of unexpected data, an exception is
thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy, otherwise, non conforming informations
will be skipped.
xCriteriaSet - not null.
null; if no unexpected content have been read, contains at least a majority threshold.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.public XCriteriaSet writeCoalitions(ICoalitions source)
source - not null.
null.public List<XCriteriaSet> write(Map<DecisionMaker,ICoalitions> allCoalitions)
XCriteriaSet,
each one being associated to the corresponding decision maker in the given input.
allCoalitions - not null, with values not null and having each a majority threshold.
null.public XCriteriaSet write(Weights source)
source - not null.
null.public void setScales(Map<Criterion,IOrderedInterval> scales)
scales - not null, may be empty, must contain only continuous scales, thus with no step size.public Map<Criterion,IOrderedInterval> getScales()
null key, no
null values, no continuous scales, and such entries may not be added to the map.
null.public void setCriteriaOrder(Collection<Criterion> criteriaOrder)
public void setDmsOrder(Collection<DecisionMaker> dmsOrder)
public Set<Criterion> getInactiveCriteria()
setInactiveCriteria(Set) occurred yet.
null.public void setInactiveCriteria(Set<Criterion> inactiveCriteria)
inactiveCriteria - not null, may be empty, no null entry.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||