comparison base/generics.lisp @ 118:d574d015f5af

More documentation darcs-hash:20070727112332-f76cc-397a752c91dc5168910e87fd072a75e272875946.gz
author David Lewis <d.lewis@gold.ac.uk>
date Fri, 27 Jul 2007 12:23:32 +0100
parents 034ef8412ddb
children 4198b52e612b
comparison
equal deleted inserted replaced
117:0190c6ad759e 118:d574d015f5af
179 (:documentation "Addition for time designators")) 179 (:documentation "Addition for time designators"))
180 (defgeneric time- (object1 object2) 180 (defgeneric time- (object1 object2)
181 (:documentation "Subtraction for time designators")) 181 (:documentation "Subtraction for time designators"))
182 182
183 (defgeneric time> (object1 object2) 183 (defgeneric time> (object1 object2)
184 (:documentation "> operator for time designators")) 184 (:documentation "> operator for moment designators"))
185 (defgeneric time< (object1 object2) 185 (defgeneric time< (object1 object2)
186 (:documentation "< operator for time designators") 186 (:documentation "< operator for moment designators")
187 (:method (o1 o2) (time> o2 o1))) 187 (:method (o1 o2) (time> o2 o1)))
188 (defgeneric time= (object1 object2) 188 (defgeneric time= (object1 object2)
189 (:documentation "= operator for time designators")) 189 (:documentation "= operator for moment designators"))
190 (defgeneric time>= (object1 object2) 190 (defgeneric time>= (object1 object2)
191 (:documentation ">= operator for time designators") 191 (:documentation ">= operator for moment designators")
192 (:method (o1 o2) (or (time> o1 o2) (time= o1 o2)))) 192 (:method (o1 o2) (or (time> o1 o2) (time= o1 o2))))
193 (defgeneric time<= (object1 object2) 193 (defgeneric time<= (object1 object2)
194 (:documentation "<= operator for time designators") 194 (:documentation "<= operator for moment designators")
195 (:method (o1 o2) (or (time< o1 o2) (time= o1 o2)))) 195 (:method (o1 o2) (or (time< o1 o2) (time= o1 o2))))
196 (defgeneric time/= (object1 object2) 196 (defgeneric time/= (object1 object2)
197 (:documentation "not = operator for time designators") 197 (:documentation "not = operator for moment designators")
198 (:method (o1 o2) (not (time= o1 o2)))) 198 (:method (o1 o2) (not (time= o1 o2))))
199 199
200 ;;; Duration protocol 200 ;;; Duration protocol
201 201
202 (defgeneric duration> (object1 object2)) 202 (defgeneric duration> (object1 object2)
203 (:documentation "> operator for period designators"))
203 (defgeneric duration< (object1 object2) 204 (defgeneric duration< (object1 object2)
205 (:documentation "< operator for period designators")
204 (:method (o1 o2) (duration> o2 o1))) 206 (:method (o1 o2) (duration> o2 o1)))
205 (defgeneric duration= (object1 object2)) 207 (defgeneric duration= (object1 object2)
208 (:documentation "= operator for period designators"))
206 (defgeneric duration>= (object1 object2) 209 (defgeneric duration>= (object1 object2)
210 (:documentation ">= operator for period designators")
207 (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2)))) 211 (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2))))
208 (defgeneric duration<= (object1 object2) 212 (defgeneric duration<= (object1 object2)
213 (:documentation "<= operator for period designators")
209 (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2)))) 214 (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2))))
210 (defgeneric duration/= (object1 object2) 215 (defgeneric duration/= (object1 object2)
216 (:documentation "not = operator for period designators")
211 (:method (o1 o2) (not (duration= o1 o2)))) 217 (:method (o1 o2) (not (duration= o1 o2))))
212 218
213 ;; for linear scaling: 219 ;; for linear scaling:
214 (defgeneric duration* (object1 object2)) 220 (defgeneric duration* (object1 object2)
215 (defgeneric duration/ (object1 number)) 221 (:documentation "Multiplication operator for period
222 designators. Intuitively, this makes sense, but it may cause us
223 trouble with some implementations in the future."))
224 (defgeneric duration/ (object1 number)
225 (:documentation "Division operator for period designators. This
226 may turn out not to mean much. Division is probably useful, but
227 we may need to define what we mean with care."))
216 228
217 ;;; Pitch protocol 229 ;;; Pitch protocol
218 230
219 ;; pitch+: <pitch> <pitch> -> ERROR 231 ;; pitch+: <pitch> <pitch> -> ERROR
220 ;; <pitch> <interval> -> <pitch> 232 ;; <pitch> <interval> -> <pitch>