|
|||||||||
| Home >> All >> org >> maloi >> evolvo >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.maloi.evolvo.gui
Class DoubleBoundedRangeModel

java.lang.Objectjavax.swing.DefaultBoundedRangeModel
org.maloi.evolvo.gui.DoubleBoundedRangeModel
- All Implemented Interfaces:
- javax.swing.BoundedRangeModel, java.io.Serializable
- class DoubleBoundedRangeModel
- extends javax.swing.DefaultBoundedRangeModel
This class is an extension to DefaultBoundedRangeModel which allows the range to be over double-sized floating point numbers. In order to maintain the standard interface of BoundedRangeModel, this class stores numbers only to a desired precision. When one of the methods defined by the BoundedRangeModel interface are called, they return their expected value multiplied by 10^precision. There are also accessor methods to set and retrieve the actual floating point numbers. I chose to extend DefaultBoundedRangeModel rather than implementing BoundedRangeModel to avoid rewriting code for the event handlers. No need to reinvent the wheel...
| Field Summary | |
private double |
dblExtent
The actual extent. |
private double |
dblMaximum
The actual upper boundary. |
private double |
dblMinimum
The actual lower boundary. |
private int |
multiplier
The multiplier used to convert between our actual (double) space and the integer space. |
private int |
precision
Number of decimal places to keep precision to. |
| Fields inherited from class javax.swing.DefaultBoundedRangeModel |
changeEvent, listenerList |
| Constructor Summary | |
DoubleBoundedRangeModel()
Default constructor. |
|
DoubleBoundedRangeModel(double v,
double e,
double minimum,
double maximum)
Constructor that takes all parameters except precision, which defaults to 10 decimal places. |
|
DoubleBoundedRangeModel(double v,
double e,
double minimum,
double maximum,
int precision)
Constructor for which all values have been provided by the user. |
|
| Method Summary | |
private void |
doSetRangeProps(double v,
double e,
double minimum,
double maximum,
int p)
Changes the Set Range Properties. |
double |
getDoubleValue()
Returns the currently stored value as a double. |
int |
getMultiplier()
Returns the multiplier. |
int |
getPrecision()
|
void |
setDoubleValue(double v)
Sets the value from a double. |
void |
setPrecision(int p)
|
void |
setRangeProperties(double v,
double e,
double minimum,
double maximum,
int precision,
boolean newValueIsAdjusting)
Changes the Set Range Properties, and fires events to alert listeners of the change. |
java.lang.String |
toString()
Creates a human readable String describing the range model. |
| Methods inherited from class javax.swing.DefaultBoundedRangeModel |
addChangeListener, fireStateChanged, getChangeListeners, getExtent, getListeners, getMaximum, getMinimum, getValue, getValueIsAdjusting, removeChangeListener, setExtent, setMaximum, setMinimum, setRangeProperties, setValue, setValueIsAdjusting |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
dblMinimum
private double dblMinimum
- The actual lower boundary.
dblMaximum
private double dblMaximum
- The actual upper boundary.
dblExtent
private double dblExtent
- The actual extent.
multiplier
private int multiplier
- The multiplier used to convert between our actual (double) space and the integer space.
precision
private int precision
- Number of decimal places to keep precision to.
| Constructor Detail |
DoubleBoundedRangeModel
public DoubleBoundedRangeModel()
- Default constructor. Initializes the model with a min of 0,
max of 1, value and extent of 0, and a precision of 10
decimal points.
DoubleBoundedRangeModel
public DoubleBoundedRangeModel(double v,
double e,
double minimum,
double maximum)
- Constructor that takes all parameters except precision, which defaults to 10 decimal places.
DoubleBoundedRangeModel
public DoubleBoundedRangeModel(double v,
double e,
double minimum,
double maximum,
int precision)
- Constructor for which all values have been provided by the user.
| Method Detail |
doSetRangeProps
private void doSetRangeProps(double v,
double e,
double minimum,
double maximum,
int p)
- Changes the Set Range Properties. This involves ensuring that all ranges are valid,
and that maximum >= minimum, minimum <= maximum, and minimum <= value <= (maximum - extent)
setRangeProperties
public void setRangeProperties(double v,
double e,
double minimum,
double maximum,
int precision,
boolean newValueIsAdjusting)
- Changes the Set Range Properties, and fires events to alert listeners of the change.
toString
public java.lang.String toString()
- Creates a human readable String describing the range model.
getDoubleValue
public double getDoubleValue()
- Returns the currently stored value as a double.
setDoubleValue
public void setDoubleValue(double v)
- Sets the value from a double.
getMultiplier
public int getMultiplier()
- Returns the multiplier.
setPrecision
public void setPrecision(int p)
getPrecision
public int getPrecision()
|
|||||||||
| Home >> All >> org >> maloi >> evolvo >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC