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