ToDto() public méthode

public ToDto ( AM am ) : EmotionDTO
am AutobiographicMemory.AM
Résultat EmotionalAppraisal.DTOs.EmotionDTO
Exemple #1
0
        public EmotionDTO AddActiveEmotion(EmotionDTO emotion, AM am)
        {
            var activeEmotion = new ActiveEmotion(emotion, am, 1, 1);

            if (emotionPool.ContainsKey(calculateHashString(activeEmotion)))
            {
                throw new ArgumentException("This given emotion is already related to given cause", nameof(emotion));
            }

            emotionPool.Add(calculateHashString(activeEmotion), activeEmotion);
            activeEmotion.GetCause(am).LinkEmotion(activeEmotion.EmotionType);
            return(activeEmotion.ToDto(am));
        }
            public EmotionDTO AddActiveEmotion(EmotionDTO emotion)
            {
                EmotionDisposition disposition = GetEmotionDisposition(emotion.Type);
                var    activeEmotion           = new ActiveEmotion(emotion, disposition.Threshold, disposition.Decay);
                string hash = calculateHashString(activeEmotion, m_parent.m_am);

                if (emotionPool.ContainsKey(hash))
                {
                    throw new Exception("Emotion already exists");
                }

                emotionPool.Add(hash, activeEmotion);
                activeEmotion.GetCause(m_parent.m_am).LinkEmotion(activeEmotion.EmotionType);

                return(activeEmotion.ToDto(m_parent.m_am));
            }
            public EmotionDTO AddActiveEmotion(EmotionDTO emotion)
            {
                EmotionDisposition disposition = GetEmotionDisposition(emotion.Type);
                var activeEmotion = new ActiveEmotion(emotion, disposition.Threshold, disposition.Decay);
                string hash = calculateHashString(activeEmotion, m_parent.m_am);

                if (emotionPool.ContainsKey(hash))
                {
                    throw new ArgumentException("This given emotion is already related to given cause",nameof(emotion));
                }

                emotionPool.Add(hash, activeEmotion);
                activeEmotion.GetCause(m_parent.m_am).LinkEmotion(activeEmotion.EmotionType);

                return activeEmotion.ToDto(m_parent.m_am);
            }