(in-package forme_proportionnelle) (defmethod obtenir_profils (&key nom_dinstrument niveau ensemble module champ (direction "avant") emplacement (profils (profils (profil))) traitements print retourner_egalement_ensemble retourner_egalement_module retourner_egalement_champ operateur) (teste_de_niveau niveau ensemble module champ) (let (res_cru res_champ egalement) (setf res_cru (chercher_profils (obtenir_niveau nom_dinstrument niveau) direction emplacement profils)) ;(print (list 'chercher_profils (chercher_profils (obtenir_niveau nom_dinstrument niveau) direction emplacement profils))) (setf res_champ (if champ (%obtenir_champ res_cru ensemble module champ) res_cru)) (when traitements (setf res_champ (trai::traiter traitements res_champ))) (when retourner_egalement_champ (setf egalement (%obtenir_champ res_cru retourner_egalement_ensemble retourner_egalement_module retourner_egalement_champ))) (when operateur (return-from obtenir_profils (apply operateur (ut:platt res_champ)))) (when (and print champ) (graph::graph (ut:platt res_champ))) (when (and traitements (not retourner_egalement_champ)) (return-from obtenir_profils res_champ)) (when (and traitements retourner_egalement_champ) (return-from obtenir_profils (list res_champ egalement))) (when (and (not traitements) (not retourner_egalement_champ)) (return-from obtenir_profils res_champ)) (when (and (not traitements) retourner_egalement_champ) (return-from obtenir_profils (list res_champ egalement))) )) (defmethod id? ((profils profils)) (loop for x in (slot-value profils 'profils) when (id? x) when (not (check_id x)) do (return-from id? t))) #| (id? (profils (profil (critere nil "index" "index_de_note_en_cycle" 5 "t")) (profil (critere nil "index" "index_de_note_en_cycle" 5 "t")) (profil (critere nil "index" "id" '("12 3 0 - -") "t")) (profil (critere nil "index" "index_de_note_en_cycle" 5 "t")))) |# (defmethod id? ((profil profil)) (loop for x in (slot-value profil 'criteres) when (equal (slot-value x 'champ) "id") do (return t))) (defmethod check_id ((profil profil)) (loop for x in (slot-value profil 'criteres) when (not (equal (slot-value x 'champ) "id")) do (abort (format t "si vous cherchez un id vous ne pouvez pas avoir d'autres criteres...")))) #| (obtenir_profils :nom_dinstrument "elfl1" :niveau "formes_partielles" :ensemble 'proportion_segment_2 :module 'module_valeur :champ 'valeur_debut :profils (profils (profil (critere nil nil "type" "son" "t")))) (%obtenir_champ (chercher_profils (obtenir_niveau "elfl1" "formes_partielles") "avant" nil (profils (profil (critere nil nil "type" "son" "t")))) 'cadence 'module_valeur_interpolee 'valeur_debut_resultat) |# (defmethod teste_de_niveau ((niveau string) ensemble module champ) (when (not (ut::member_equal niveau '("formes_entieres" "formes_partielles" "parties" "phrases" "cycles" "notes"))) (format t "de \"obtenir_profil\", pour :ensemble ~a, :module ~a, :champ ~a. Vous vous etes trompe sur le nom du niveau... il n'y a pas de niveau : \"~a\"" ensemble module champ niveau) (abort))) ;(teste_de_niveau "note" 'hauteur 'module_valeur 'valeur_debut) (defmethod chercher_profils ((formes list) (direction string) (emplacement integer) (profils profils)) (loop for x in formes collect (chercher_profils x direction emplacement profils))) (defmethod chercher_profils ((formes list) (direction string) (emplacement null) (profils profils)) (loop for x in formes collect (chercher_profils x direction emplacement profils))) ;TEST DESSA TEST_FUNKTIONER VERKAR FUNGERA!! JAG PLATTAR UT FoR ATT KUNNA TA NTH ENDAST I EMPLACEMENT_FALLET... (defmethod chercher_profils ((formes formes) (direction string) (emplacement integer) (profils profils)) (let (res) (setf res (_chercher_profils_loco formes profils)) (if res (return-from chercher_profils res)) (setf res (nth emplacement (ut:platt (_chercher_profils_inferieur formes direction nil profils)))) (if res (return-from chercher_profils res)) (setf res (_chercher_profils_superieur formes profils)) (if res (return-from chercher_profils res)))) ;(chercher_profils (nth 7 (ut:platt (obtenir_parties "cb"))) "avant" nil (profils (profil :classe nil :type nil :index nil :articulation nil :mode_de_jeu nil :id "5 0 - - -"))) ;(inspect *) (defmethod chercher_profils ((formes formes) (direction string) (emplacement null) (profils profils)) ;(print 'KOKOKOEE) (let (res) (setf res (_chercher_profils_loco formes profils)) ;(print (list 'resresresres111 res)) (when res (return-from chercher_profils res)) (setf res (_chercher_profils_inferieur formes direction emplacement profils)) ;(print (list 'resresresres222 res)) (when res (return-from chercher_profils res)) (setf res (_chercher_profils_superieur formes profils)) ;(print (list 'resresresres333 res)) (when res (return-from chercher_profils res)))) (defmethod _chercher_profils_loco ((formes formes) (profils profils)) (when (evaluer_profils formes profils) formes)) (defmethod _chercher_profils_superieur ((formes forme_entiere) (profils profils)) (return-from _chercher_profils_superieur)) ;vore bra om detta gav samma resultat... ;verkar sa... (defmethod _chercher_profils_superieur ((formes formes) (profils profils)) (when (evaluer_profils formes profils) (return-from _chercher_profils_superieur formes)) ;jag maste kolla att objektet som fragar uppat ar forst i (when (equal (car (slot-value (slot-value formes 'niveau_superieur) 'niveau_inferieur)) formes) (_chercher_profils_superieur (slot-value formes 'niveau_superieur) profils)) ) ;DESSA TEST_FUNKTIONER VERKAR FUNGERA!! JAG PLATTAR UT FoR ATT KUNNA TA NTH ENDAST I EMPLACEMENT_FALLET... (defmethod _chercher_profils_inferieur ((formes formes) (direction string) (emplacement integer) (profils profils)) (if (evaluer_profils formes profils) formes (delete nil (loop for x in (if (equal direction "avant") (slot-value formes 'niveau_inferieur) (if (equal direction "arriere") (reverse (slot-value formes 'niveau_inferieur)))) collect (_chercher_profils_inferieur x direction emplacement profils))) )) (defmethod _chercher_profils_inferieur ((formes formes) (direction string) (emplacement null) (profils profils)) (if (evaluer_profils formes profils) formes (delete nil (loop for x in (if (equal direction "avant") (slot-value formes 'niveau_inferieur) (if (equal direction "arriere") (reverse (slot-value formes 'niveau_inferieur)))) collect (_chercher_profils_inferieur x direction emplacement profils))) )) (defmethod alla_atom? ((list list)) (let ((consp? t)) (loop for x in list do (if (consp x) (setf consp? nil))) consp?)) ;(alla_atom? '(6 4 5 (5))) :EOF