Update of /project/rjain-utils/cvsroot/formulate/src In directory cl-net:/tmp/cvs-serv9061/src
Modified Files: formulate.lisp Log Message: minor renaming and cleanups
--- /project/rjain-utils/cvsroot/formulate/src/formulate.lisp 2009/11/05 21:27:45 1.3 +++ /project/rjain-utils/cvsroot/formulate/src/formulate.lisp 2009/11/11 08:52:10 1.4 @@ -3,16 +3,16 @@ (deftype list-of (elt-type) 'list)
+;;; +;;; *** GENERAL DEFINITIONS *** +;;; + (defvar *formulating* '() "The FORMULATOR, if any, that is being evaluated.")
(define-condition set-formulated-location (cell-error) ())
-(defgeneric formulator-value (formulator - &optional unbound-condition cell-name)) - - (defmethod formulator-value :around (formulator &optional unbound-condition cell-name) (when *formulating* @@ -21,7 +21,9 @@ (call-next-method) (error unbound-condition :name cell-name)))
-(defgeneric formulator-value-changed (sink source new-value old-value)) +;;; +;;; *** SIMPLE FORMULATOR SOURCE +;;;
(defclass simple-formulator-source () ((dependents :initform '() @@ -51,9 +53,13 @@ (formulator-value formulator))) (result (setf (slot-value formulator 'value) new-value))) (dolist (dependent (formulator-dependents formulator)) - (formulator-source-value-changed dependent formulator new-value old-value)) + (formulator-value-changed dependent formulator new-value old-value)) result))
+;;; +;;; FORMULA FORMULATOR SINK +;;; + (defclass formula-formulator-sink () ((formula :initarg formula :accessor formulator-formula) @@ -71,6 +77,10 @@ (defmethod formulator-value-validp ((formulator formula-formulator-sink)) (slot-boundp formulator 'formula))
+;;; +;;; *** LAZY FORMULATOR SINK +;;; + (defclass lazy-formula-formulator-sink (formula-formulator-sink) ((source :initarg source :initform (make-instance 'simple-formulator-source) @@ -103,6 +113,6 @@ (defmethod note-formula-dependency (source sink) (pushnew sink (formulator-dependents source)))
-(defmethod formulator-source-value-changed +(defmethod formulator-value-changed ((sink lazy-formula-formulator-sink) source new-value old-value) (formulator-invalidate sink))