Esempio n. 1
0
 public static Emotion clone(Emotion original) {
   Map<BasicEmotion, Double> _newcomponents =
       new HashMap<BasicEmotion, Double>(original._components);
   EmotionTheory _newtheory = original._theory;
   Emotion newemotion = new Emotion(_newtheory);
   newemotion.setComponents(_newcomponents);
   return newemotion;
 }
Esempio n. 2
0
 /**
  * assuming that the argument is an emotion consisting of only one basic emotion, returns the
  * object's value for that particular basic emotion
  */
 public Double project(Emotion pureemotion) {
   Map targetcomponents = pureemotion.getComponents();
   // assert that emotions are both from matching theory
   assert (this._theory == pureemotion._theory);
   assert (targetcomponents.size() == 1.0);
   Set keys = targetcomponents.keySet();
   Iterator itr = keys.iterator();
   Double result = 0.0;
   BasicEmotion targetcomponent = (BasicEmotion) itr.next();
   result = _components.get(targetcomponent);
   if (result == null) {
     result = 0.0;
   }
   ;
   return result;
 }
Esempio n. 3
0
 public static Emotion add(Emotion e1, Emotion e2) {
   BasicEmotion[] basic_emotion_list = listEmotions(e1.getTheory());
   Emotion newemotion = new Emotion(e1.getTheory());
   // Object _newcomps = _components.clone();
   for (BasicEmotion basic : basic_emotion_list) {
     double val1 = e1.getComponentValue(basic);
     double val2 = e2.getComponentValue(basic);
     newemotion.putComponentValue(basic, val1 + val2);
   }
   return newemotion;
 }