Package com.simsilica.lemur
Class DefaultRangedValueModel
java.lang.Object
com.simsilica.lemur.DefaultRangedValueModel
- All Implemented Interfaces:
VersionedObject<Double>
,RangedValueModel
A default implementation of the RangedValueModel interface
that keeps a value and a version, incrementing the version
whenever the value changes. Values are kept between the
configured min and max.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates a new VersionedReference that can be used to monitor when this object changes.double
double
Returns the object that is being versioned.double
double
getValue()
long
Returns the current version of the versioned object.void
setMaximum
(double max) void
setMinimum
(double min) void
setPercent
(double v) void
setValue
(double value) toString()
-
Constructor Details
-
DefaultRangedValueModel
public DefaultRangedValueModel() -
DefaultRangedValueModel
public DefaultRangedValueModel(double min, double max, double value)
-
-
Method Details
-
getVersion
public long getVersion()Description copied from interface:VersionedObject
Returns the current version of the versioned object.- Specified by:
getVersion
in interfaceVersionedObject<Double>
-
getObject
Description copied from interface:VersionedObject
Returns the object that is being versioned.- Specified by:
getObject
in interfaceVersionedObject<Double>
-
createReference
Description copied from interface:VersionedObject
Creates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReference
in interfaceVersionedObject<Double>
-
checkRange
protected void checkRange() -
setValue
public void setValue(double value) - Specified by:
setValue
in interfaceRangedValueModel
-
getValue
public double getValue()- Specified by:
getValue
in interfaceRangedValueModel
-
setPercent
public void setPercent(double v) - Specified by:
setPercent
in interfaceRangedValueModel
-
getPercent
public double getPercent()- Specified by:
getPercent
in interfaceRangedValueModel
-
setMaximum
public void setMaximum(double max) - Specified by:
setMaximum
in interfaceRangedValueModel
-
getMaximum
public double getMaximum()- Specified by:
getMaximum
in interfaceRangedValueModel
-
setMinimum
public void setMinimum(double min) - Specified by:
setMinimum
in interfaceRangedValueModel
-
getMinimum
public double getMinimum()- Specified by:
getMinimum
in interfaceRangedValueModel
-
toString
-