The Observer-Conditioned-Observable (OCO) combines digitizing and transcoding of numeric change events. During the processing of numeric events, the transcoder converts the number from one range into another while preserving the mathematical integrity of the value. Numeric controllers that generate such events can be based in floating point numbers or integer numbers. For example, the JSpinners of Swing are based in floating point numbers, but JSliders are based in integers. Thus, the dynamic range of the JSliders is typically many orders of magnitude away from the dynamic range of the spinners. Even worse, changes in a numeric model can propagate to an integer-based spinner. This leads to quantization error and back propagation of the re-quantized value. Interactive programs use multiple viewers and controllers to alter an underlying numeric model. These can update each other in an observer-observable loop that can propagate unintended and unmanaged digitization errors. The OCO design pattern breaks the loop and maintains control of the numerical values. The interception of changes is done via a modification of the equals method. If two numbers are equal (to within a user defined tolerance) propagation is suppressed. Thus, the digitizer re-samples and re-quantizes the numeric event. Another potential problem arises when multiple viewer-controllers for the same number model employ differing scales. For example, sliders can range between two integer numbers (e.g., 0...100); whereas the floating-point number that we would like to model ranges from 0.0 and 1.0. We demonstrate a procedure for translating one value into the range of another, without error or feedback. OCO also samples events in time. This band limits the events to a level deemed reasonable for the application. The veto design pattern is not new, nor, for that matter, is a numeric veto design pattern. However, a numeric veto design pattern that is sensitive to the magnitude and rate of the numeric change is new. Also new is the conversion of one numeric range into another during the model view controller construction. Thus, we have arrived at a new name for our design pattern, called the Observer-Conditioned-Observable design pattern (OCO). We apply the OCO design to the input of numbers that not only are floating point, but that have a dynamic range. The goal of our system is to allow the user to sweep large spans of dynamic range and “zoom in” to very high precision variation in areas of interest, for example bifurcation points in a dynamical system model. Our particular application involves 16 degrees of freedom for controlling the compound iteration of several hundred Java 3D linear transformations, in real-time. Other applications include scientific/mathematical simulation, Monte Carlo methods and numeric solution of systems of equations. These applications are critically dependent on initial conditions.
Read full abstract