j@318: (in-package #:amuse-charm) j@318: j@318: ;;;===================================================================== j@318: ;;; Helpful functions j@318: ;;;===================================================================== j@318: j@318: (defun find-first-onset (events) j@318: (reduce #'min events :key #'timepoint)) j@318: j@318: (defun find-last-offset (events) j@318: (reduce #'max events :key #'(lambda (event) j@318: (timepoint (cut-off event))))) j@318: j@318: (defgeneric object->db-string (o)) j@318: j@318: (defmethod object->db-string ((o charm-property-list)) j@318: (format nil "~S" (%list-slot-sequence-data o))) j@318: j@318: (defmethod object->db-string ((o event-identifier)) j@318: "This was an earlier approach, that was probably bad." j@318: "e") j@318: j@318: (defmethod object->db-string ((o constituent-identifier)) j@318: "This was an earlier approach, that was probably bad." j@318: "c") j@318: j@318: (defun recompute-constituent-timepoint (constituent) j@318: (setf (timepoint constituent) j@318: (reduce #'min constituent :key 'timepoint))) j@318: j@318: (defun recompute-constituent-duration (constituent) j@318: (setf (duration constituent) j@318: (reduce #'max constituent :key 'timepoint)))