|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.decisiondeck.xmcda_oo.structure.Weights
public class Weights
A set of criteria weights (retrievable by their respective criterion). This object allows to check whether this set of weights is normalized, and to retrieve the equivalent set after normalization.
TODO remove Iterable
| Field Summary | |
|---|---|
static double |
DEFAULT_TOLERANCE
The default allowed tolerance between the sum of the weights and one when assessing whether the weights are normalized. |
| Constructor Summary | |
|---|---|
Weights()
|
|
Weights(Weights source)
|
|
| Method Summary | |
|---|---|
boolean |
approxEquals(Weights w2,
double tolerance)
|
boolean |
equals(Object obj)
|
Set<Criterion> |
getCriteria()
|
Weights |
getNormalized()
TODO do it with a view that divides by the sum! |
double |
getSum()
|
double |
getTolerance()
|
Double |
getWeight(Criterion criterion)
Returns the weight of the given criterion, or null if no weight has been associated to that
criterion. |
int |
hashCode()
|
boolean |
isNormalized()
|
Iterator<Criterion> |
iterator()
|
void |
putAll(Weights weights)
Puts all the weights contained in the given object in this object, replacing any current value if the given object contains weights for some criteria already in this object. |
Double |
putWeight(Criterion criterion,
double weight)
Associates the given weight to the given criterion. |
Double |
removeWeight(Criterion criterion)
Removes the weight associated to the given criterion, if it exists. |
void |
setTolerance(double tolerance)
|
int |
size()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final double DEFAULT_TOLERANCE
| Constructor Detail |
|---|
public Weights()
public Weights(Weights source)
| Method Detail |
|---|
public double getTolerance()
public void setTolerance(double tolerance)
public boolean equals(Object obj)
equals in class Objectpublic Weights getNormalized()
public double getSum()
public Double getWeight(Criterion criterion)
null if no weight has been associated to that
criterion.
criterion - the criterion to consider. Not null.
null).public int hashCode()
hashCode in class Objectpublic boolean isNormalized()
true if the weights sum to one plus or minus the allowed tolerance.public Iterator<Criterion> iterator()
iterator in interface Iterable<Criterion>public void putAll(Weights weights)
weights - the weights to add to this object. Not null (but may be empty).
public Double putWeight(Criterion criterion,
double weight)
criterion - the criterion to consider. Not null.weight - the weight to associate to the given criterion.
null if there was no.public Double removeWeight(Criterion criterion)
criterion - not null.
null iff there was no.public int size()
public String toString()
toString in class Objectpublic Set<Criterion> getCriteria()
public boolean approxEquals(Weights w2,
double tolerance)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||