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

Robert Strandh rstrandh at common-lisp.net
Sun Nov 27 23:44:02 UTC 2005


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

Modified Files:
	flexichain-package.lisp flexichain.asd flexirank.lisp 
Log Message:
Added two more functions (flexi-next and flexi-prev) to flexirank.

Date: Mon Nov 28 00:44:00 2005
Author: rstrandh

Index: gsharp/Flexichain/flexichain-package.lisp
diff -u gsharp/Flexichain/flexichain-package.lisp:1.4 gsharp/Flexichain/flexichain-package.lisp:1.5
--- gsharp/Flexichain/flexichain-package.lisp:1.4	Wed Nov 16 04:06:59 2005
+++ gsharp/Flexichain/flexichain-package.lisp	Mon Nov 28 00:43:50 2005
@@ -37,5 +37,6 @@
 	   #:move> #:move<
 	   #:insert #:insert-sequence
 	   #:element< #:element> #:delete< #:delete>
-	   #:flexirank-mixin #:element-rank-mixin #:rank))
+	   #:flexirank-mixin #:element-rank-mixin #:rank
+	   #:flexi-next #:flexi-prev))
 


Index: gsharp/Flexichain/flexichain.asd
diff -u gsharp/Flexichain/flexichain.asd:1.4 gsharp/Flexichain/flexichain.asd:1.5
--- gsharp/Flexichain/flexichain.asd:1.4	Wed Nov 16 04:06:59 2005
+++ gsharp/Flexichain/flexichain.asd	Mon Nov 28 00:43:50 2005
@@ -27,11 +27,11 @@
 ;; The tester is not included, for it depends on clim.  The stupid
 ;; implementation has also been left out, since it seems mostly useful
 ;; for testing.
-(defsystem flexichain
+(defsystem :flexichain
   :name "flexichain"
   :components ((:file "flexichain-package")
                (:file "utilities" :depends-on ("flexichain-package"))
-               (:file "flexichain" :depends-on ("utilities"))
+               (:file "flexichain" :depends-on ("utilities" "flexichain-package"))
                (:file "flexicursor" :depends-on ("flexichain"))
                (:file "flexirank" :depends-on ("flexichain"))))
 


Index: gsharp/Flexichain/flexirank.lisp
diff -u gsharp/Flexichain/flexirank.lisp:1.1 gsharp/Flexichain/flexirank.lisp:1.2
--- gsharp/Flexichain/flexirank.lisp:1.1	Wed Nov 16 04:06:59 2005
+++ gsharp/Flexichain/flexirank.lisp	Mon Nov 28 00:43:50 2005
@@ -28,6 +28,8 @@
 ;;; generic function rank.
 
 (defgeneric rank (element))
+(defgeneric flexi-next (element))
+(defgeneric flexi-prev (element))
 
 (defclass element-rank-mixin ()
   ((index :accessor index)
@@ -35,6 +37,17 @@
 
 (defmethod rank ((element element-rank-mixin))
   (index-position (chain element) (index element)))
+
+(defmethod flexi-next ((element element-rank-mixin))
+  (let ((new-rank (1+ (rank element)))
+	(chain (chain element)))
+    (assert (< new-rank (nb-elements chain)))
+    (element* chain new-rank)))
+
+(defmethod flexi-prev ((element element-rank-mixin))
+  (let ((new-rank (1- (rank element))))
+    (assert (not (minusp new-rank)))
+    (element* (chain element) new-rank)))
 
 ;;; this class must be mixed into a flexichain that contains ranked elements
 (defclass flexirank-mixin () ())




More information about the Gsharp-cvs mailing list