view implementations/geerdes/classes.lisp @ 288:d1e5bbcc5ea4

Rationalise base and geerdes classes, constructors and methods. Ignore-this: d9d4d88566a6d110844d91d4c70513cd Towards a more standardised interface. Some of these changes (generalised constructors and reader functions) are necessary for amuse-database-admin functionality and some other CHARM-like things. darcs-hash:20090716154406-16a00-8a9b4fb1fc1f5ba75af66a1bbd87e1bb68e02493.gz
author j.forth <j.forth@gold.ac.uk>
date Thu, 16 Jul 2009 16:44:06 +0100
parents 4a03a1478c02
children 7afb8cfdcdcf
line wrap: on
line source
(cl:in-package #:amuse-geerdes)

(defclass property-list-mixin ()
  ((properties :initarg :properties
	       :accessor properties
	       :initform 'nil)))

(defclass geerdes-object (property-list-mixin) ())

(defclass geerdes-identifier (geerdes-object) ())

(defclass geerdes-composition-identifier (composition-identifier
					  geerdes-object) ())

(defclass geerdes-identifier-cat-id (geerdes-composition-identifier)
  ((cat-id :initarg :cat-id
	   :initform 'nil)))

(defclass geerdes-identifier-file-id (geerdes-composition-identifier)
  ((file-id :initarg :file-id
	    :initform 'nil))
  (:documentation "Define geerdes-file-id as composition-id."))

(defclass geerdes-event-identifier (event-identifier
				    geerdes-identifier)
  ((event-id :initarg :event-id
	     :reader event-id)))

(defclass geerdes-composition (midi-composition geerdes-object)
  ((db-entry :initarg :db-entry
	     :initform nil
	     :accessor %db-entry)
   (bar-numbers :initform nil
		:accessor %bar-numbers)
   (monody :initform nil
	   :accessor %monody)
   (caches :initform nil
	   :accessor %caches)
   (midi-constituents :initarg :constituents
		      :accessor %midi-constituents)
   (midi-events :initarg :midi-events
		:accessor %midi-events)
   (db-cat-id :initarg :cat-id
	      :accessor %db-cat-id)
   (db-file-id :initarg :file-id
	       :accessor %db-file-id))
  (:documentation "MIDI composition with extra slots for Geerdes
  database entries and ids. Because this implementation is for a
  particular need, caching of information is also handled within
  the object, so Geerdes compositions are faster for bar lookups,
  monody-finding and so on. They also make use of interval trees
  for time calculations, which make them faster for window-based
  queries (but slower to import as a result)."))

(defclass geerdes-monody (monody geerdes-composition)
  ;; FIXME: necessary slots? Do we even use them?
  ((inter-onset-intervals :initarg :i-o-i
			  :initform nil
			  :accessor %i-o-i)
   (inter-onset-interval-mode :initarg :ioi-mode
			      :initform 0
			      :accessor %ioi-mode)))

(defclass geerdes-event (geerdes-object) ()
  (:documentation "Base class for geerdes events."))

(defclass geerdes-pitched-event (midi-pitched-event geerdes-event)
  ((identifier :initarg :identifier
	       :reader identifier))
  (:documentation "Only adds a database identifier to
  midi-pitched-event"))

(defclass geerdes-percussive-event (midi-percussive-event
				    geerdes-event)
  ((identifier :initarg :identifier
	       :reader identifier))
  (:documentation "Only adds a database identifier to
  midi-percussive-event"))