changeset 261:8e5f306b7e47

add 'onset-within' generics - does Allen say anything about this?
author Jamie Forth <j.forth@gold.ac.uk>
date Mon, 28 Mar 2011 21:40:37 +0100
parents f5836b2bf334
children 2284dbc7d51a
files base/generics.lisp base/methods.lisp base/package.lisp
diffstat 3 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/base/generics.lisp	Sat Mar 19 18:51:23 2011 +0000
+++ b/base/generics.lisp	Mon Mar 28 21:40:37 2011 +0100
@@ -341,6 +341,10 @@
 (defgeneric starts (object1 object2))
 (defgeneric ends (object1 object2))
 
+;;; Does Allen cover this? Like during, except don't consider cut-off.
+(defgeneric onset-within (object1 object2))
+(defgeneric onset-within-fuzzy (object1 object2 period))
+
 ;;; and extensions thereof ...
 
 (defgeneric subinterval (object1 object2)
--- a/base/methods.lisp	Sat Mar 19 18:51:23 2011 +0000
+++ b/base/methods.lisp	Mon Mar 28 21:40:37 2011 +0100
@@ -423,6 +423,18 @@
 		 (object2 anchored-period))
   (time= (cut-off object1) (cut-off object2)))
 
+;; Does Allen cover this? Anyway, they are useful for me -JF.
+(defmethod onset-within ((object1 moment)
+			 (object2 standard-anchored-period))
+  (and (time>= object1 object2)
+       (time<= object1 (cut-off object2))))
+
+(defmethod onset-within-fuzzy ((object1 moment)
+			       (object2 standard-anchored-period)
+			       (period standard-period))
+  (and (time>= object1 (time- (onset object2) period))
+       (time<= object1 (time- (cut-off object2) period))))
+
 ;; ...and
 
 (defmethod period= ((object1 anchored-period)
--- a/base/package.lisp	Sat Mar 19 18:51:23 2011 +0000
+++ b/base/package.lisp	Mon Mar 28 21:40:37 2011 +0100
@@ -116,6 +116,8 @@
 	   #:during
 	   #:starts
 	   #:ends
+	   #:onset-within
+	   #:onset-within-fuzzy
 	   #:subinterval
 	   #:disjoint
 	   #:period=