forked from kraison/vivace-graph-v2
/
btree.lisp
96 lines (74 loc) · 3.02 KB
/
btree.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
;;; -*- mode: common-lisp; common-lisp-style: modern; coding: utf-8; -*-
(in-package :vivace-graph-v2)
(defmethod b-tree-impl::|KEY>| (x y)
(b-tree-impl::key< y x))
(defmethod b-tree-impl::|KEY>=| (x y)
(or
(b-tree-impl::key= x y)
(b-tree-impl::key< y x)))
(defmethod b-tree-impl::key< ((x puri:uri) y)
(b-tree-impl::key< (princ-to-string x) y))
(defmethod b-tree-impl::key< (x (y puri:uri))
(b-tree-impl::key< x (princ-to-string y)))
(defmethod b-tree-impl::key= ((x puri:uri) y)
(b-tree-impl::key= (puri::uri-string x) y))
(defmethod b-tree-impl::key= (x (y puri:uri))
(b-tree-impl::key= x (puri::uri-string y)))
(defmethod b-tree-impl::key< ((x symbol) y)
;; (string< (symbol-name x) y)
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x symbol) (y number))
;;(string< (symbol-name x) (write-to-string y))
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x number) (y symbol))
;; (string< (write-to-string x) (symbol-name y))
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x number) (y string))
;; (string< (write-to-string x) y)
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x string) (y symbol))
;; (string< x (symbol-name y))
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x string) (y number))
;;(string< x (write-to-string y))
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x timestamp) (y timestamp))
;; (timestamp< x y)
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x number) (y timestamp))
;; (< (timestamp-to-universal x) y)
(vg-less-than x y))
(defmethod b-tree-impl::key< ((x timestamp) (y number))
;;(< x (timestamp-to-universal y))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x uuid:uuid) (y uuid:uuid))
;; (string< (uuid:print-bytes nil x) (uuid:print-bytes nil y)))
(defmethod b-tree-impl::key< ((x unicly:unique-universal-identifier)
(y unicly:unique-universal-identifier))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x string) (y uuid:uuid))
;; (string< x (uuid:print-bytes nil y)))
(defmethod b-tree-impl::key< ((x string) (y unicly:unique-universal-identifier))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x number) (y uuid:uuid))
;; (string< (write-to-string x) (uuid:print-bytes nil y))
(defmethod b-tree-impl::key< ((x number) (y unicly:unique-universal-identifier))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x uuid:uuid) (y string))
;; (string< (uuid:print-bytes nil x) y))
(defmethod b-tree-impl::key< ((x unicly:unique-universal-identifier) (y string))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x uuid:uuid) (y symbol))
;; (string< (uuid:print-bytes nil x) (symbol-name y)))
(defmethod b-tree-impl::key< ((x unicly:unique-universal-identifier) (y symbol))
(vg-less-than x y))
;; :WAS
;; (defmethod b-tree-impl::key< ((x uuid:uuid) (y number))
;; (string< (uuid:print-bytes nil x) (write-to-string y)))
(defmethod b-tree-impl::key< ((x unicly:unique-universal-identifier) (y number))
(vg-less-than x y))