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 voidCreates a new VersionedReference that can be used to monitor when this object changes.doubledoubleReturns the object that is being versioned.doubledoublegetValue()longReturns the current version of the versioned object.voidsetMaximum(double max) voidsetMinimum(double min) voidsetPercent(double v) voidsetValue(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:VersionedObjectReturns the current version of the versioned object.- Specified by:
getVersionin interfaceVersionedObject<Double>
-
getObject
Description copied from interface:VersionedObjectReturns the object that is being versioned.- Specified by:
getObjectin interfaceVersionedObject<Double>
-
createReference
Description copied from interface:VersionedObjectCreates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReferencein interfaceVersionedObject<Double>
-
checkRange
protected void checkRange() -
setValue
public void setValue(double value) - Specified by:
setValuein interfaceRangedValueModel
-
getValue
public double getValue()- Specified by:
getValuein interfaceRangedValueModel
-
setPercent
public void setPercent(double v) - Specified by:
setPercentin interfaceRangedValueModel
-
getPercent
public double getPercent()- Specified by:
getPercentin interfaceRangedValueModel
-
setMaximum
public void setMaximum(double max) - Specified by:
setMaximumin interfaceRangedValueModel
-
getMaximum
public double getMaximum()- Specified by:
getMaximumin interfaceRangedValueModel
-
setMinimum
public void setMinimum(double min) - Specified by:
setMinimumin interfaceRangedValueModel
-
getMinimum
public double getMinimum()- Specified by:
getMinimumin interfaceRangedValueModel
-
toString
-