public final class NamedValue
extends java.lang.Object
Constructor and Description |
---|
NamedValue(java.lang.String nvName)
Creates a new NamedValue for the given name.
|
NamedValue(java.lang.String nvName,
double startingValue)
Creates a new NamedValue for the given name and double value.
|
Modifier and Type | Method and Description |
---|---|
void |
addWeight(double addedWeight)
Adds weight to a NamedValue.
|
java.lang.String |
getName()
Returns the Name of this NamedValue.
|
double |
getWeight()
Returns the weight of the NamedValue.
|
void |
removeWeight(double removedWeight)
Removes an amount of the "weight" from this NamedValue.
|
java.lang.String |
toString()
Returns a String representation of this NamedValue.
|
public NamedValue(java.lang.String nvName)
nvName
- The String to be used as the name of the NamedValue.public NamedValue(java.lang.String nvName, double startingValue)
nvName
- The String to be used as the name of the NamedValue.startingValue
- The double value of the NamedValue.public double getWeight()
public void addWeight(double addedWeight)
addedWeight
- the weight to add to this NamedValuepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public void removeWeight(double removedWeight)
removedWeight
- The amount the value of this NamedValue should be reduced by.public java.lang.String getName()