[gsharp-cvs] CVS update: gsharp/Flexichain/flexirank.lisp

Robert Strandh rstrandh at common-lisp.net
Mon Nov 28 00:25:59 UTC 2005


Update of /project/gsharp/cvsroot/gsharp/Flexichain
In directory common-lisp.net:/tmp/cvs-serv2937

Modified Files:
	flexirank.lisp 
Log Message:
Fixed a bug in the flexirank code.  Or, rather, compensated for 
a quirk in flexichain.lisp that calls move-elements on sentinels.
The best way would be to avoid this quirk, but I am not willing to
modify the basic flexichain code right now. 

Date: Mon Nov 28 01:25:59 2005
Author: rstrandh

Index: gsharp/Flexichain/flexirank.lisp
diff -u gsharp/Flexichain/flexirank.lisp:1.2 gsharp/Flexichain/flexirank.lisp:1.3
--- gsharp/Flexichain/flexirank.lisp:1.2	Mon Nov 28 00:43:50 2005
+++ gsharp/Flexichain/flexirank.lisp	Mon Nov 28 01:25:59 2005
@@ -52,10 +52,12 @@
 ;;; this class must be mixed into a flexichain that contains ranked elements
 (defclass flexirank-mixin () ())
 
-(defmethod move-elements :after ((chain flexirank-mixin) to from start1 start2 end2)
+(defmethod move-elements :before ((chain flexirank-mixin) to from start1 start2 end2)
   (loop for old from start2 below end2
 	for new from start1
-	do (setf (index (aref from old)) new)))
+	do (let ((element (aref from old)))
+	     (when (typep element 'element-rank-mixin)
+	       (setf (index element) new)))))
 
 (defmethod insert* :after ((chain flexirank-mixin) position (object element-rank-mixin))
   (setf (index object) (position-index chain position)




More information about the Gsharp-cvs mailing list