Package games.stendhal.client.gui
Class LinearScalingModel
java.lang.Object
games.stendhal.client.gui.AbstractScalingModel
games.stendhal.client.gui.LinearScalingModel
- All Implemented Interfaces:
ScalingModel
A
ScalingModel
that implements a linearly displayed value with a
known maximum. The representation will have value 0 at value 0, and the
maximum representation when the value is the specified maximum.-
Constructor Summary
ConstructorDescriptionCreate a LinearScalingModel with maximum value of 1.0, and maximum representation 1.LinearScalingModel(double maxValue, int maxRepresentation)
Create a LinearScalingModel. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getValue()
Get the internal value.void
setMaxRepresentation(int max)
Set the maximum representation value.void
setMaxValue(double maxValue)
Set the maximum value for the model, ie.void
setValue(double value)
Set the internal value.Methods inherited from class games.stendhal.client.gui.AbstractScalingModel
addChangeListener, fireChanged, getRepresentation, setRepresentation
-
Constructor Details
-
LinearScalingModel
public LinearScalingModel()Create a LinearScalingModel with maximum value of 1.0, and maximum representation 1. -
LinearScalingModel
public LinearScalingModel(double maxValue, int maxRepresentation)Create a LinearScalingModel.- Parameters:
maxValue
- maximum value of the variablemaxRepresentation
- the maximum of the presentation of the value
-
-
Method Details
-
setValue
public void setValue(double value)Description copied from interface:ScalingModel
Set the internal value.- Parameters:
value
- new value
-
getValue
public double getValue()Get the internal value.- Returns:
- value
-
setMaxRepresentation
public void setMaxRepresentation(int max)Description copied from interface:ScalingModel
Set the maximum representation value.- Parameters:
max
- new maximum
-
setMaxValue
public void setMaxValue(double maxValue)Set the maximum value for the model, ie. the value that corresponds to the maximum representation.- Parameters:
maxValue
- new maximum value
-