From: Drew Crampsie Date: Thu, 7 Jul 2005 02:45:19 +0000 (-0700) Subject: added a clear-class-attributes method, and added it to set-default-attributes so... X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/commitdiff_plain/46cea8c8b169e593c5ce68dfcfcbb68b7c637444?ds=sidebyside added a clear-class-attributes method, and added it to set-default-attributes so that setting the default clears the existing first darcs-hash:20050707024519-5417e-8cd585f6177ec1100b368850edb71c2886f2bd32.gz --- diff --git a/src/mewa/mewa.lisp b/src/mewa/mewa.lisp index 54ab29d..70cce96 100644 --- a/src/mewa/mewa.lisp +++ b/src/mewa/mewa.lisp @@ -65,6 +65,9 @@ attributes is an alist keyed on the attribute nreeame." (defmethod find-class-attributes ((model symbol)) (find-or-create-attributes model)) +(defmethod clear-class-attributes ((model t)) + (setf (cdr (find-class-attributes model)) nil)) + (defmethod add-attribute ((model t) name def) (let ((map (find-class-attributes model))) (setf (cdr map) (acons name def (cdr map))))) @@ -113,6 +116,7 @@ attributes is an alist keyed on the attribute nreeame." (meta-model:list-has-many model)))) (defmethod set-default-attributes ((model t)) + (clear-class-attributes model) (mapcar #'(lambda (x) (setf (find-attribute model (car x)) (cdr x))) (default-attributes model)))