Package edu.kit.mcda.core
Class Criterion
java.lang.Object
edu.kit.mcda.core.Criterion
- All Implemented Interfaces:
Changed
,Description
,Dye
,Identifier
,Label
,Domain
,MetaInformation
- Direct Known Subclasses:
LinkedCriterion
Class to manage all the data and meta data of a criterion.
- Author:
- Tim Mueller
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlternative
(String _identifier) Add an alternative to the values list.protected void
Allow clear of descriptions for inheriting classes.protected void
Allow clear of labels for inheriting classes.boolean
containsAlternative
(String _identifier) Check if an alternative is registered in this criterion.void
Create weights from AHP and set them internally.org.jdom2.Element
Exports the criterion to the specified node.Get a list of all registered alternatives.double
getBest()
Get the best value of this criterion.Get the default description without reference to a language.getDescription
(String _language) Get the description in reference to the given language.Get all descriptions with reference to a language.getDye()
Get the dedicated color to use within the context.double
getFunctionValue
(String _identifier) Get the value of the value function of an alternative for this criterion.getGoal()
getGroup()
Get a unique identifier.getLabel()
Get the default label without reference to a language.Get the label in reference to the given language.Get all labels with reference to a language.double
Get the maximum (not necessarily best) value of this criterion.double
Get the minimum (not necessarily best) value of this criterion.double
Get the maximum of the normalised values.double
Get the minimum of the normalised values.getNormalizedValue
(String _identifier) Get a normalised value for an alternative.Get a map of the normalised values.Whether the domain is discrete or continuous.getQualitativeValue
(String _identifier) getUnit()
double
Get the value of an alternative for this criterion.Returns AHP of alternativesdouble
getValueForXML
(String _identifier) getValueFunction
(String _identifier) Get the value function of an alternative for this criterion.Get a map of the values.Get the weight function linked to this criterion.double
getWorst()
Get the worst value of this criterionboolean
Get the status of the changed flag.boolean
Check if a non default description is set for the default language.boolean
hasDescription
(String _language) Check if a non default description is set for the language in question.boolean
hasGroup()
Check if criterion belongs to a group.boolean
hasValueFunction
(String _identifier) Test if the value function of an alternative for this criterion exists.boolean
Check if a weight function is linked to this criterion.void
importFromXML
(org.jdom2.Element _masterNode) Imports the data from a specified node.boolean
boolean
Whether the domain is discrete or continuous.boolean
Returns usingValueAHPvoid
removeAlternative
(String _identifier) Remove an alternative by its identifier.void
removeValueFunction
(String _identifier) Remove a value function linked to the identifier.boolean
setBounds
(double _minimum, double _maximum) void
setChanged
(boolean _changed) Set the status of the changed flag.void
setDescription
(String _description) Set the default description.void
setDescription
(String _language, String _description) Set a description for the given language.void
Set the dedicated color to use within the context.void
setGroup
(CriterionGroup _group) void
setIdentifier
(String _identifier) Set a unique identifier.void
setInverse
(boolean _inverse) void
Set the default label.void
Set a label for this criterion.void
setNormalizationMethod
(AbstractNormalization _normalizationMethod) void
setQualitativeSet
(QualitativeSet _nominalSet) void
setQualitativeValue
(String _alternativeIdentifier, String _qualitativeIdentifier) Link a nominal value to an alternative for this criterion.void
void
setUsingValueAHP
(boolean _usingValueAHP) Sets usingValueAHP, if false, copy previous values to parameter "values"void
Link a value to an alternative for this criterion.void
setValueAHP
(AHP _valueAhp) void
setValueFunction
(String _identifier, ValueFunction _valueFunction) Link a value function to an alternative for this criterion.toString()
-
Constructor Details
-
Criterion
public Criterion()Constructor of Criterion. No parameters required. CallspreInit()
,init()
, andpostInit()
.
-
-
Method Details
-
getValue
Get the value of an alternative for this criterion.- Parameters:
_identifier
- the identifier of the alternative- Returns:
- the value of the alternative
-
setValue
Link a value to an alternative for this criterion.- Parameters:
_identifier
- the identifier of the alternative_value
- the actual value
-
getQualitativeValue
-
setQualitativeValue
Link a nominal value to an alternative for this criterion.- Parameters:
_alternativeIdentifier
- the identifier of the alternative_qualitativeIdentifier
- the key of the nominal value
-
getFunctionValue
Get the value of the value function of an alternative for this criterion.- Parameters:
_identifier
- the identifier of the alternative- Returns:
- the value of the alternative
-
getValueFunction
Get the value function of an alternative for this criterion.- Parameters:
_identifier
- the identifier of the alternative- Returns:
- the value function of the alternative
-
hasValueFunction
Test if the value function of an alternative for this criterion exists.- Parameters:
_identifier
- the identifier of the alternative- Returns:
- true if a function is defined for this alternative
-
setValueFunction
Link a value function to an alternative for this criterion.- Parameters:
_identifier
- the identifier of the alternative_valueFunction
- the actual value function
-
removeValueFunction
Remove a value function linked to the identifier.- Parameters:
_identifier
- the identifier of the alternative linked to the value function to remove
-
getValues
Get a map of the values. The map is a copy of the original.- Returns:
- a map of the values
-
getNormalizedValue
Get a normalised value for an alternative.- Parameters:
_identifier
- the alternative identifier- Returns:
- the normalised value for the alternative
-
getNormalizedValues
Get a map of the normalised values. The map is a copy of the original.- Returns:
- a map of the normalised values
-
getNormalizedMinimum
public double getNormalizedMinimum()Get the minimum of the normalised values. It is the upper bound of the range.- Returns:
- the minimum of the normalised values
-
getNormalizedMaximum
public double getNormalizedMaximum()Get the maximum of the normalised values. It is the upper bound of the range.- Returns:
- the maximum of the normalised values
-
hasGroup
public boolean hasGroup()Check if criterion belongs to a group. This is the case if the actual group of this criterion is notDefaults.GROUP
.- Returns:
- true if this criterion is member of a group
-
hasWeightFunction
public boolean hasWeightFunction()Check if a weight function is linked to this criterion. Access the group and retrieve information from it if possible.- Returns:
- true if a weight is referenced to this criterion
-
getWeightFunction
Get the weight function linked to this criterion. Access the group and retrieve information from it if possible. Return null if no group or no value function is associated.- Returns:
- the weight function of this criterion in its group
-
addAlternative
Add an alternative to the values list. As value for the alternative theDefaults.CRITERION_VALUE
is set.- Parameters:
_identifier
- the identifier of the new alternative
-
removeAlternative
Remove an alternative by its identifier.- Parameters:
_identifier
- the identifier of the alternative to remove
-
containsAlternative
Check if an alternative is registered in this criterion.- Parameters:
_identifier
- the identifier of the alternative to check for- Returns:
- true if the alternative is registered
-
getAlternatives
Get a list of all registered alternatives. The list is a copy of its original.- Returns:
- a list of the alternatives
-
getWorst
public double getWorst()Get the worst value of this criterion- Returns:
- the worst value
-
getBest
public double getBest()Get the best value of this criterion.- Returns:
- the best value
-
getMinimum
public double getMinimum()Get the minimum (not necessarily best) value of this criterion.- Specified by:
getMinimum
in interfaceDomain
- Returns:
- the minimum value for this criterion
-
getMaximum
public double getMaximum()Get the maximum (not necessarily best) value of this criterion.- Specified by:
getMaximum
in interfaceDomain
- Returns:
- the maximum value for this criterion
-
setBounds
public boolean setBounds(double _minimum, double _maximum) -
isQualitative
public boolean isQualitative()Description copied from interface:Domain
Whether the domain is discrete or continuous.- Specified by:
isQualitative
in interfaceDomain
- Returns:
- true if the domain is discrete, false otherwise
-
getQualitativeSet
Description copied from interface:Domain
Whether the domain is discrete or continuous.- Specified by:
getQualitativeSet
in interfaceDomain
- Returns:
- true if the domain is discrete, false otherwise
-
setQualitativeSet
-
isUsingValueAHP
public boolean isUsingValueAHP()Returns usingValueAHP- Returns:
- if AHP is used for alternatives
-
setUsingValueAHP
public void setUsingValueAHP(boolean _usingValueAHP) Sets usingValueAHP, if false, copy previous values to parameter "values"- Parameters:
_usingValueAHP
-
-
getValueAHP
Returns AHP of alternatives- Returns:
-
setValueAHP
- Parameters:
_valueAhp
-- Throws:
Exception
-
createValuesFromAHP
public void createValuesFromAHP()Create weights from AHP and set them internally. Adjusts the weights in a way that they optimally fit in the sliders display (between 0.0 and 10.0). -
getParents
- Returns:
-
toString
-
getGoal
-
getGroup
- Returns:
-
setGroup
- Parameters:
_group
-
-
getNormalizationMethod
- Returns:
-
setNormalizationMethod
- Parameters:
_normalizationMethod
-
-
getIdentifier
Description copied from interface:Identifier
Get a unique identifier. Most likely a UUID.- Specified by:
getIdentifier
in interfaceIdentifier
- Returns:
- the id
-
setIdentifier
Description copied from interface:Identifier
Set a unique identifier. Most likely a UUID.- Specified by:
setIdentifier
in interfaceIdentifier
- Parameters:
_identifier
- the id to set
-
getLabel
Description copied from interface:Label
Get the default label without reference to a language. -
getLabel
Description copied from interface:Label
Get the label in reference to the given language. -
getLabels
Get all labels with reference to a language. -
setLabel
Set the default label. Delegates tosetLabel(java.lang.String,java.lang.String)
usingKeys.DEFAULT
. -
setLabel
Set a label for this criterion. -
clearLabels
protected void clearLabels()Allow clear of labels for inheriting classes. -
hasDescription
public boolean hasDescription()Check if a non default description is set for the default language. Delegates tohasDescription(java.lang.String)
usingKeys.DEFAULT
.- Returns:
- true if a non default description is set
-
hasDescription
Check if a non default description is set for the language in question.- Parameters:
_language
- the language to check for- Returns:
- true if a non default description is set for the language in question
-
getDescription
Get the default description without reference to a language. Delegates togetDescription(java.lang.String)
usingKeys.DEFAULT
.- Specified by:
getDescription
in interfaceDescription
- Returns:
- the default description
-
getDescription
Get the description in reference to the given language.- Specified by:
getDescription
in interfaceDescription
- Parameters:
_language
- the language identifier- Returns:
- the localised description
-
getDescriptions
Get all descriptions with reference to a language.- Specified by:
getDescriptions
in interfaceDescription
- Returns:
- all descriptions
-
setDescription
Set the default description. Delegates tosetDescription(java.lang.String,java.lang.String)
usingKeys.DEFAULT
.- Specified by:
setDescription
in interfaceDescription
- Parameters:
_description
- the description to set
-
setDescription
Set a description for the given language.- Specified by:
setDescription
in interfaceDescription
- Parameters:
_language
- the language identifier_description
- the description for the given language
-
clearDescriptions
protected void clearDescriptions()Allow clear of descriptions for inheriting classes. -
getDye
Get the dedicated color to use within the context. -
setDye
Set the dedicated color to use within the context. -
getUnit
-
setUnit
-
isInverse
public boolean isInverse() -
setInverse
public void setInverse(boolean _inverse) -
hasChanged
public boolean hasChanged()Get the status of the changed flag.- Specified by:
hasChanged
in interfaceChanged
- Returns:
- the changed status
-
setChanged
public void setChanged(boolean _changed) Set the status of the changed flag.- Specified by:
setChanged
in interfaceChanged
- Parameters:
_changed
- the changed status to be set
-
importFromXML
public void importFromXML(org.jdom2.Element _masterNode) Imports the data from a specified node. Criterion group and normalized values are not imported. Normalized values are computed on demand.- Parameters:
_masterNode
- the node containing the criterion data
-
exportToXML
public org.jdom2.Element exportToXML()Exports the criterion to the specified node. The criterion group and the normalized values are not exported.- Returns:
- a master element containing the export
-
getValueForXML
- Parameters:
_identifier
-- Returns:
-