public class DefaultJoggleModel extends Object implements JoggleModel
JoggleModel
interface.Constructor and Description |
---|
DefaultJoggleModel()
Creates a new
DefaultJoggleModel with an initial
value of 0.0, a transmissionRatio of
1.0 and no maximum and no minimum. |
DefaultJoggleModel(double value)
Creates a new
DefaultJoggleModel with a transmissionRatio of
1.0 and no maximum and no minimum. |
DefaultJoggleModel(double value,
double transmissionRatio)
Creates a new DefaultJoggleModel with the specified value and
transmission ratio and no maximum and no minimum.
|
DefaultJoggleModel(double value,
double transmissionRatio,
double min,
double max)
Creates a new DefaultJoggleModel with the specified value,
transmission ratio, minimum and maximum.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener l) |
protected void |
fireStateChanged() |
double |
getMaximum()
Return the upper limit of the represented value sequence.
|
double |
getMinimum()
Return the lower limit of the represented value sequence.
|
double |
getTransmissionRatio()
Return the ratio the
rotationAngle
of a Joggle must be multiplied with to get the value in
this model. |
double |
getValue()
Returns the current value held in this model.
|
void |
removeChangeListener(ChangeListener l) |
void |
setMaximum(double newMax)
Sets the maximum to newMax and fits the minimum respectively the
value to newMax if they are larger than newMax.
|
void |
setMinimum(double newMin)
Sets the minimum to newMin and fits the maximum respectively the
value to newMin if they are less than newMin.
|
void |
setTransmissionRatio(double newRatio)
Sets the ratio the
rotationAngle
of a Joggle must be multiplied with to get the value in
this model. |
void |
setValue(double newVal)
Sets value to newVal but only if newVal is between the current
minimum and maximum.
|
public DefaultJoggleModel()
DefaultJoggleModel
with an initial
value of 0.0, a transmissionRatio of
1.0 and no maximum and no minimum.public DefaultJoggleModel(double value)
DefaultJoggleModel
with a transmissionRatio of
1.0 and no maximum and no minimum.value
- the initial value for this modelpublic DefaultJoggleModel(double value, double transmissionRatio)
value
- the initial value for this modeltransmissionRatio
- factor between the physical
rotationAngle
of a Joggle
and the value in this model.public DefaultJoggleModel(double value, double transmissionRatio, double min, double max)
value
- the initial value for this modeltransmissionRatio
- factor between the physical
rotationAngle
of a Joggle
and the value in this model.min
- a lower limit this model's value is not able to exceed;
use Double.NEGATIVE_INFINITY
for no limitationmax
- an upper limit this model's value is not able to exceed;
use Double.POSITIVE_INFINITY
for no limitationpublic void addChangeListener(ChangeListener l)
addChangeListener
in interface JoggleModel
protected void fireStateChanged()
public double getMaximum()
JoggleModel
getMaximum
in interface JoggleModel
public double getMinimum()
JoggleModel
getMinimum
in interface JoggleModel
public double getTransmissionRatio()
rotationAngle
of a Joggle
must be multiplied with to get the value in
this model.getTransmissionRatio
in interface JoggleModel
rotationAngle
of a Joggle
must be multiplied with to get the value in
this model.public double getValue()
rotationAngle
of a Joggle. To get the rotationAngle of a Joggle you have to
divide this value by the transmissionRatio.getValue
in interface JoggleModel
getTransmissionRatio()
public void removeChangeListener(ChangeListener l)
removeChangeListener
in interface JoggleModel
public void setMaximum(double newMax)
setMaximum
in interface JoggleModel
newMax
- a new upper limit.public void setMinimum(double newMin)
setMinimum
in interface JoggleModel
newMin
- a new lower limit.public void setTransmissionRatio(double newRatio)
rotationAngle
of a Joggle
must be multiplied with to get the value in
this model.newRatio
- factor between the physical
rotationAngle
of a Joggle
and the value in this model.public void setValue(double newVal)
setValue
in interface JoggleModel
newVal
- the value to be set.