A constrained float is a float/string data type.
It is a floating point value assosciated with a string representation. This class is to be used primarily in text input where we may want to represent or input a numerical value differently.
Constraints may be added to the float string to prevent accepting floats with certain properties. A constriant is a boolean function, and if any constraint fails on assignment the value will not be assigned.
Constraints are only applied when the float is converted from a string, or constrainedSet() is called. All other operations on the ConstrainedFloat are currently unsafe.
Public Member Functions |
|
| __init__ () | |
| __float__ () | |
| __str__ () | |
| isConstraintSatisfied () | |
| setNumDecimalPlaces () | |
| getNumDecimalPlaces () | |
| set () | |
| Convert any type into the ConstrainedFloat
type. |
|
| ConstrainedFloat.ConstrainedFloat.__init__ | ( | ) |
| ConstrainedFloat.ConstrainedFloat.__float__ | ( | ) |
| ConstrainedFloat.ConstrainedFloat.__str__ | ( | ) |
| ConstrainedFloat.ConstrainedFloat.isConstraintSatisfied | ( | ) |
| ConstrainedFloat.ConstrainedFloat.setNumDecimalPlaces | ( | ) |
| ConstrainedFloat.ConstrainedFloat.getNumDecimalPlaces | ( | ) |
| ConstrainedFloat.ConstrainedFloat.set | ( | ) |
Convert any type into the ConstrainedFloat type.
Use this instead of = or constraints will not be taken into account during assignment.