Changeset 848
- Timestamp:
- 01/19/2011 03:24:42 PM (10 years ago)
- Location:
- AgentMind/branches/FAtiMA-Modular
- Files:
-
- 2 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
AgentMind/branches/FAtiMA-Modular/FAtiMA.AdvancedMemory/src/main/java/FAtiMA/advancedMemoryComponent/AdvancedMemoryComponent.java
r833 r848 198 198 199 199 @Override 200 public void appraisal(AgentModel am, Event e, AppraisalFrame a s) {200 public void appraisal(AgentModel am, Event e, AppraisalFrame af) { 201 201 202 202 //appraisal from memory … … 215 215 if(desirability != 0) 216 216 { 217 a s.SetAppraisalVariable(AdvancedMemoryComponent.NAME, (short)3, OCCComponent.DESIRABILITY, desirability);217 af.SetAppraisalVariable(AdvancedMemoryComponent.NAME, (short)3, OCCComponent.DESIRABILITY, desirability); 218 218 } 219 219 } … … 330 330 331 331 @Override 332 public void reappraisal(AgentModel am) {333 }334 335 @Override336 332 public void inverseAppraisal(AgentModel am, AppraisalFrame af) { 337 333 } 334 335 @Override 336 public AppraisalFrame reappraisal(AgentModel am) { 337 return null; 338 } 338 339 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA.EmotionalIntelligence/src/FAtiMA/emotionalIntelligence/ActionTendencyOperatorFactory.java
r729 r848 20 20 Step s = null; 21 21 BaseEmotion em = at.GetElicitingEmotion(); 22 EmotionCondition ec = new EmotionCondition(true,new Symbol("[AGENT]"),em. GetType());22 EmotionCondition ec = new EmotionCondition(true,new Symbol("[AGENT]"),em.getType().getName()); 23 23 ec.SetIntensity(em.GetPotential()); 24 24 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.EmotionalIntelligence/src/FAtiMA/emotionalIntelligence/EmotionalEpisodeCondition.java
r805 r848 42 42 import FAtiMA.Core.memory.episodicMemory.MemoryEpisode; 43 43 import FAtiMA.Core.util.Constants; 44 import FAtiMA.Core.util.enumerables.EmotionType;45 44 import FAtiMA.Core.wellFormedNames.Name; 46 45 import FAtiMA.Core.wellFormedNames.Substitution; … … 128 127 emotion = episode.getStrongestEmotion(); 129 128 130 try { 131 if(emotion.GetType() == EmotionType.ParseType(this._emotion.toString())) 129 130 if(emotion.getType().getName().equals(this._emotion.toString())) 131 { 132 if(emotion.GetPotential() >= this._value) 132 133 { 133 if(emotion.GetPotential() >= this._value) 134 { 135 return true; 136 } 134 return true; 137 135 } 138 } catch (InvalidEmotionTypeException e) { 139 return false; 140 } 141 136 } 142 137 143 138 return false; … … 215 210 if(!_emotion.isGrounded()) 216 211 { 217 s = new Substitution(this._emotion,new Symbol( EmotionType.GetName(emotion.GetType())));212 s = new Substitution(this._emotion,new Symbol(emotion.getType().toString())); 218 213 ss.AddSubstitution(s); 219 214 bindingSets.add(ss); 220 215 } 221 else if(emotion. GetType() == EmotionType.ParseType(this._emotion.toString()))216 else if(emotion.getType().equals(this._emotion.toString())) 222 217 { 223 218 ss = new SubstitutionSet(); … … 242 237 { 243 238 244 s = new Substitution(this._emotion,new Symbol( EmotionType.GetName(emotion.GetType())));239 s = new Substitution(this._emotion,new Symbol(emotion.getType().getName())); 245 240 ss.AddSubstitution(s); 246 241 bindingSets.add(ss); 247 242 248 243 } 249 else if(emotion. GetType() == EmotionType.ParseType(this._emotion.toString()))244 else if(emotion.getType().getName().equals(this._emotion.toString())) 250 245 { 251 246 bindingSets.add(ss); -
AgentMind/branches/FAtiMA-Modular/FAtiMA.EmotionalIntelligence/src/FAtiMA/emotionalIntelligence/OCCAppraisalRules.java
r729 r848 4 4 5 5 import FAtiMA.Core.AgentModel; 6 import FAtiMA.Core.OCCAffectDerivation.DistressEmotion; 7 import FAtiMA.Core.OCCAffectDerivation.JoyEmotion; 6 8 import FAtiMA.Core.conditions.EmotionCondition; 7 9 import FAtiMA.Core.conditions.NewEventCondition; … … 10 12 import FAtiMA.Core.emotionalState.EmotionDisposition; 11 13 import FAtiMA.Core.util.enumerables.ActionEvent; 12 import FAtiMA.Core.util.enumerables.EmotionType;13 14 import FAtiMA.Core.util.enumerables.EventType; 14 15 import FAtiMA.Core.wellFormedNames.Name; … … 38 39 39 40 joyOperator = new Step(new Symbol("[AGENT]"),Name.ParseName("JoyAppraisal()"),1.0f); 40 c = new EmotionCondition(true, new Symbol("[AGENT]"), EmotionType.JOY);41 c = new EmotionCondition(true, new Symbol("[AGENT]"), JoyEmotion.getInstance().getName()); 41 42 c.SetIntensity(new Symbol("[X]")); 42 43 aux = new Effect(am, "JoyEmotion", 1.0f,c); 43 44 joyOperator.AddEffect(aux); 44 45 45 disp = am.getEmotionalState().getEmotionDisposition s()[EmotionType.JOY];46 threshold = disp. GetThreshold();46 disp = am.getEmotionalState().getEmotionDisposition(JoyEmotion.getInstance().getName()); 47 threshold = disp.getThreshold(); 47 48 48 49 params = new ArrayList<Symbol>(); … … 68 69 //distress 69 70 distressOperator = new Step(new Symbol("[AGENT]"),Name.ParseName("DistressAppraisal()"),1.0f); 70 c = new EmotionCondition(true, new Symbol("[AGENT]"), EmotionType.DISTRESS);71 c = new EmotionCondition(true, new Symbol("[AGENT]"), DistressEmotion.getInstance().getName()); 71 72 c.SetIntensity(new Symbol("[X]")); 72 73 aux = new Effect(am, "DistressEmotion", 1.0f,c); 73 74 distressOperator.AddEffect(aux); 74 75 75 disp = am.getEmotionalState().getEmotionDisposition s()[EmotionType.DISTRESS];76 threshold = disp. GetThreshold();76 disp = am.getEmotionalState().getEmotionDisposition(DistressEmotion.getInstance().getName()); 77 threshold = disp.getThreshold(); 77 78 78 79 params = new ArrayList<Symbol>(); -
AgentMind/branches/FAtiMA-Modular/FAtiMA.MotivationalSystem/src/FAtiMA/motivationalSystem/MotivationalComponent.java
r809 r848 571 571 572 572 @Override 573 public voidreappraisal(AgentModel am) {574 // TODO Auto-generated method stub573 public AppraisalFrame reappraisal(AgentModel am) { 574 return null; 575 575 } 576 576 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.SocialRelations/src/FAtiMA/socialRelations/SocialRelationsComponent.java
r809 r848 14 14 import FAtiMA.Core.IProcessEmotionComponent; 15 15 import FAtiMA.Core.Display.AgentDisplayPanel; 16 import FAtiMA.Core.OCCAffectDerivation.AdmirationEmotion; 17 import FAtiMA.Core.OCCAffectDerivation.DistressEmotion; 18 import FAtiMA.Core.OCCAffectDerivation.GloatingEmotion; 19 import FAtiMA.Core.OCCAffectDerivation.HappyForEmotion; 20 import FAtiMA.Core.OCCAffectDerivation.JoyEmotion; 16 21 import FAtiMA.Core.OCCAffectDerivation.OCCComponent; 22 import FAtiMA.Core.OCCAffectDerivation.PittyEmotion; 23 import FAtiMA.Core.OCCAffectDerivation.ReproachEmotion; 24 import FAtiMA.Core.OCCAffectDerivation.ResentmentEmotion; 17 25 import FAtiMA.Core.emotionalState.ActiveEmotion; 18 26 import FAtiMA.Core.emotionalState.AppraisalFrame; … … 22 30 import FAtiMA.Core.util.ConfigurationManager; 23 31 import FAtiMA.Core.util.Constants; 24 import FAtiMA.Core.util.enumerables.EmotionType;25 32 26 33 … … 118 125 public void emotionActivation(AgentModel am, ActiveEmotion em) { 119 126 Memory m = am.getMemory(); 120 switch(em.GetType()) 121 { 122 case EmotionType.ADMIRATION: 123 { 124 if(em.GetDirection() != null) 125 { 126 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m,em.GetIntensity()); 127 RespectRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 128 break; 129 } 130 } 131 case EmotionType.REPROACH: 132 { 133 if(em.GetDirection() != null) 134 { 135 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 136 RespectRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 137 break; 138 } 139 } 140 case EmotionType.HAPPYFOR: 141 { 142 if(em.GetDirection() != null) 143 { 144 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 145 break; 146 } 147 } 148 case EmotionType.GLOATING: 149 { 150 if(em.GetDirection() != null) 151 { 152 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 153 break; 154 } 155 } 156 case EmotionType.PITTY: 157 { 158 if(em.GetDirection() != null) 159 { 160 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 161 break; 162 } 163 } 164 case EmotionType.RESENTMENT: 165 { 166 if(em.GetDirection() != null) 167 { 168 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 169 break; 170 } 171 } 172 case EmotionType.JOY: 173 { 174 if(em.GetCause().GetTarget() != null && em.GetCause().GetTarget().equals(Constants.SELF)) 175 { 176 LikeRelation.getRelation(Constants.SELF,em.GetCause().GetSubject()).increment(m, em.GetIntensity()); 177 } 178 break; 179 } 180 case EmotionType.DISTRESS: 181 { 182 if(em.GetCause().GetTarget() != null && em.GetCause().GetTarget().equals(Constants.SELF)) 183 { 184 LikeRelation.getRelation(Constants.SELF,em.GetCause().GetSubject()).decrement(m, em.GetIntensity()); 185 } 186 break; 127 if(em.getType() == AdmirationEmotion.getInstance()) 128 { 129 if(em.GetDirection() != null) 130 { 131 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m,em.GetIntensity()); 132 RespectRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 133 } 134 } 135 else if(em.getType() == ReproachEmotion.getInstance()) 136 { 137 if(em.GetDirection() != null) 138 { 139 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 140 RespectRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 141 } 142 } 143 else if(em.getType() == HappyForEmotion.getInstance()) 144 { 145 if(em.GetDirection() != null) 146 { 147 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 148 } 149 } 150 else if(em.getType() == GloatingEmotion.getInstance()) 151 { 152 if(em.GetDirection() != null) 153 { 154 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 155 } 156 } 157 else if(em.getType() == PittyEmotion.getInstance()) 158 { 159 if(em.GetDirection() != null) 160 { 161 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).increment(m, em.GetIntensity()); 162 } 163 } 164 else if(em.getType() == ResentmentEmotion.getInstance()) 165 { 166 if(em.GetDirection() != null) 167 { 168 LikeRelation.getRelation(Constants.SELF,em.GetDirection().toString()).decrement(m, em.GetIntensity()); 169 } 170 } 171 else if(em.getType() == JoyEmotion.getInstance()) 172 { 173 if(em.GetCause().GetTarget() != null && em.GetCause().GetTarget().equals(Constants.SELF)) 174 { 175 LikeRelation.getRelation(Constants.SELF,em.GetCause().GetSubject()).increment(m, em.GetIntensity()); 176 } 177 } 178 else if(em.getType() == DistressEmotion.getInstance()) 179 { 180 if(em.GetCause().GetTarget() != null && em.GetCause().GetTarget().equals(Constants.SELF)) 181 { 182 LikeRelation.getRelation(Constants.SELF,em.GetCause().GetSubject()).decrement(m, em.GetIntensity()); 187 183 } 188 184 } … … 201 197 202 198 @Override 203 public void reappraisal(AgentModel am) { 204 // TODO Auto-generated method stub 205 199 public AppraisalFrame reappraisal(AgentModel am) { 200 return null; 206 201 } 207 202 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA.ToM/src/FAtiMA/ToM/ModelOfOther.java
r809 r848 122 122 //Agent model has to be null or the appraisal frame will generate emotions when we set the appraisal 123 123 // variables 124 af = new AppraisalFrame( null,perceivedEmotion.GetCause());124 af = new AppraisalFrame(perceivedEmotion.GetCause()); 125 125 126 126 for(IAffectDerivationComponent c : _affectDerivationComponents) … … 212 212 213 213 @Override 214 public void updateEmotions( String appraisalVariable,AppraisalFrame af) {214 public void updateEmotions(AppraisalFrame af) { 215 215 ArrayList<BaseEmotion> emotions; 216 216 ActiveEmotion activeEmotion; 217 217 218 for(IAffectDerivationComponent ac : this._affectDerivationComponents) 219 { 220 emotions = ac.affectDerivation(this, appraisalVariable, af); 221 for(BaseEmotion em : emotions) 222 { 223 activeEmotion = _es.AddEmotion(em, this); 224 if(activeEmotion != null) 218 if(af.hasChanged()) 219 { 220 for(IAffectDerivationComponent ac : this._affectDerivationComponents) 221 { 222 emotions = ac.affectDerivation(this, af); 223 for(BaseEmotion em : emotions) 225 224 { 226 for(IProcessEmotionComponent pec : this._processEmotionComponents) 225 activeEmotion = _es.AddEmotion(em, this); 226 if(activeEmotion != null) 227 227 { 228 pec.emotionActivation(this,activeEmotion); 228 for(IProcessEmotionComponent pec : this._processEmotionComponents) 229 { 230 pec.emotionActivation(this,activeEmotion); 231 } 229 232 } 230 233 } 231 234 } 232 } 235 } 233 236 } 234 237 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.ToM/src/FAtiMA/ToM/ToMComponent.java
r809 r848 141 141 ModelOfOther m = _ToM.get(s); 142 142 e3 = e2.ApplyPerspective(s); 143 otherAF = new AppraisalFrame( m,e3);143 otherAF = new AppraisalFrame(e3); 144 144 m.appraisal(e3, otherAF); 145 145 … … 253 253 254 254 @Override 255 public void reappraisal(AgentModel am) { 255 public AppraisalFrame reappraisal(AgentModel am) { 256 return null; 256 257 } 257 258 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/CulturalDimensionsComponent.java
r810 r848 326 326 327 327 @Override 328 public voidreappraisal(AgentModel am) {329 // TODO Auto-generated method stub328 public AppraisalFrame reappraisal(AgentModel am) { 329 return null; 330 330 } 331 331 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/AgentCore.java
r833 r848 33 33 import FAtiMA.Core.emotionalState.BaseEmotion; 34 34 import FAtiMA.Core.emotionalState.EmotionalState; 35 import FAtiMA.Core.emotionalState.NeutralEmotion; 35 36 import FAtiMA.Core.exceptions.ActionsParsingException; 36 37 import FAtiMA.Core.exceptions.GoalLibParsingException; … … 49 50 import FAtiMA.Core.util.VersionChecker; 50 51 import FAtiMA.Core.util.enumerables.AgentPlatform; 51 import FAtiMA.Core.util.enumerables.EmotionType;52 52 import FAtiMA.Core.util.parsers.AgentLoaderHandler; 53 53 import FAtiMA.Core.util.parsers.BinaryStringConverter; … … 88 88 protected String _displayName; 89 89 protected SpeechAct _speechAct; 90 protected short_currentEmotion;90 protected String _currentEmotion; 91 91 protected long _numberOfCycles; 92 92 protected long _totalexecutingtime=0; … … 109 109 _shutdown = false; 110 110 _numberOfCycles = 0; 111 _currentEmotion = EmotionType.NEUTRAL; //neutral emotion - no emotion111 _currentEmotion = NeutralEmotion.getInstance().getName(); //neutral emotion - no emotion 112 112 _actionsForExecution = new ArrayList<ValuedAction>(); 113 113 _perceivedEvents = new ArrayList<Event>(); … … 440 440 this._sex = (String) s.readObject(); 441 441 this._speechAct = (SpeechAct) s.readObject(); 442 this._currentEmotion = ((S hort) s.readObject()).shortValue();442 this._currentEmotion = ((String) s.readObject()); 443 443 this._displayName = (String) s.readObject(); 444 444 this._showStateWindow = ((Boolean) s.readObject()).booleanValue(); … … 634 634 float bestActionValue; 635 635 float value; 636 AppraisalFrame appraisal ;636 AppraisalFrame appraisalFrame; 637 637 638 638 long updateTime = System.currentTimeMillis(); … … 672 672 } 673 673 674 appraisal = new AppraisalFrame(this,e2);674 appraisalFrame = new AppraisalFrame(e2); 675 675 for(IAppraisalDerivationComponent c : this._appraisalComponents) 676 676 { 677 c.appraisal(this,e2, appraisal); 677 c.appraisal(this,e2, appraisalFrame); 678 updateEmotions(appraisalFrame); 678 679 } 679 680 } … … 683 684 for(IAppraisalDerivationComponent c : this._appraisalComponents) 684 685 { 685 c.reappraisal(this); 686 appraisalFrame = c.reappraisal(this); 687 updateEmotions(appraisalFrame); 686 688 } 687 689 … … 873 875 s.writeObject(_sex); 874 876 s.writeObject(_speechAct); 875 s.writeObject( new Short(_currentEmotion));877 s.writeObject(_currentEmotion); 876 878 s.writeObject(_displayName); 877 879 s.writeObject(new Boolean(_showStateWindow)); … … 962 964 //s.writeObject(_sex); 963 965 s.writeObject(_speechAct); 964 s.writeObject( new Short(_currentEmotion));966 s.writeObject(_currentEmotion); 965 967 s.writeObject(_displayName); 966 968 //s.writeObject(new Boolean(_showStateWindow)); … … 1022 1024 //this._sex = (String) s.readObject(); 1023 1025 this._speechAct = (SpeechAct) s.readObject(); 1024 this._currentEmotion = ( (Short) s.readObject()).shortValue();1026 this._currentEmotion = (String) s.readObject(); 1025 1027 this._displayName = (String) s.readObject(); 1026 1028 //this._showStateWindow = ((Boolean) s.readObject()).booleanValue(); … … 1047 1049 } 1048 1050 1049 1050 @Override 1051 public void updateEmotions(String appraisalVariable, AppraisalFrame af) { 1051 public void updateEmotions(AppraisalFrame af) { 1052 1052 1053 1053 ArrayList<BaseEmotion> emotions; 1054 1054 ActiveEmotion activeEmotion; 1055 1055 1056 for(IAffectDerivationComponent ac : this._affectDerivationComponents)1057 {1058 emotions = ac.affectDerivation(this, appraisalVariable, af);1059 for( BaseEmotion em : emotions)1060 { 1061 activeEmotion = _emotionalState.AddEmotion(em, this);1062 if(activeEmotion != null)1056 1057 if(af.hasChanged()) 1058 { 1059 for(IAffectDerivationComponent ac : this._affectDerivationComponents) 1060 { 1061 emotions = ac.affectDerivation(this, af); 1062 for(BaseEmotion em : emotions) 1063 1063 { 1064 for(IProcessEmotionComponent pec : this._processEmotionComponents) 1064 activeEmotion = _emotionalState.AddEmotion(em, this); 1065 if(activeEmotion != null) 1065 1066 { 1066 pec.emotionActivation(this,activeEmotion); 1067 for(IProcessEmotionComponent pec : this._processEmotionComponents) 1068 { 1069 pec.emotionActivation(this,activeEmotion); 1070 } 1067 1071 } 1068 1072 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/AgentModel.java
r756 r848 31 31 public boolean isSelf(); 32 32 33 public void updateEmotions( String appraisalVariable,AppraisalFrame af);33 public void updateEmotions(AppraisalFrame af); 34 34 35 35 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/Display/ActionDisplay.java
r667 r848 9 9 10 10 import FAtiMA.Core.reactiveLayer.Action; 11 import FAtiMA.Core.util.enumerables.EmotionType;12 11 13 12 public class ActionDisplay extends JPanel { … … 34 33 this.add(em1); 35 34 36 JLabel em2 = new JLabel( EmotionType.GetName(a.GetElicitingEmotion().GetType()));35 JLabel em2 = new JLabel(a.GetElicitingEmotion().getType().getName()); 37 36 em2.setMaximumSize(d1); 38 37 em2.setMinimumSize(d1); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/Display/EmotionDisplay.java
r667 r848 38 38 39 39 import FAtiMA.Core.emotionalState.ActiveEmotion; 40 import FAtiMA.Core.util.enumerables.Emotion Type;40 import FAtiMA.Core.util.enumerables.EmotionValence; 41 41 42 42 … … 52 52 public EmotionDisplay(ActiveEmotion em) { 53 53 _panel = new JPanel(); 54 _panel.setBorder(BorderFactory.createTitledBorder( EmotionType.GetName(em.GetType()) + " " + em.GetCause().toString()));54 _panel.setBorder(BorderFactory.createTitledBorder(em.getType().getName() + " " + em.GetCause().toString())); 55 55 _panel.setMaximumSize(new Dimension(300,60)); 56 56 57 57 _bar = new JProgressBar(0,100); 58 58 _bar.setStringPainted(true); 59 switch (em.GetType()) { 60 case EmotionType.FEAR: { 61 _bar.setForeground(new Color(255,0,0)); 62 break; 63 } 64 case EmotionType.HOPE: { 65 _bar.setForeground(new Color(0,255,0)); 66 break; 67 } 68 case EmotionType.DISTRESS: { 59 switch (em.getType().getValence()) { 60 case EmotionValence.NEGATIVE: { 69 61 _bar.setForeground(new Color(100,0,0)); 70 62 break; 71 63 } 72 case Emotion Type.JOY: {64 case EmotionValence.POSITIVE: { 73 65 _bar.setForeground(new Color(0,100,0)); 74 66 break; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/Display/MemoryDetailPanel.java
r667 r848 39 39 40 40 import FAtiMA.Core.memory.episodicMemory.ActionDetail; 41 import FAtiMA.Core.util.enumerables.EmotionType;42 41 43 42 … … 163 162 this.add(_parameters);*/ 164 163 165 _feeling = new JTextField( EmotionType.GetName(detail.getEmotion().GetType()) + "-"164 _feeling = new JTextField(detail.getEmotion().getType().getName() + "-" 166 165 + detail.getEmotion().GetPotential()); 167 166 _feeling.setMinimumSize(new Dimension(110,30)); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/Display/RecordDetailPanel.java
r667 r848 10 10 11 11 import FAtiMA.Core.memory.episodicMemory.ActionDetail; 12 import FAtiMA.Core.util.enumerables.EmotionType;13 12 14 13 public class RecordDetailPanel extends JPanel { … … 120 119 this.add(_parameters);*/ 121 120 122 _feeling = new JTextField( EmotionType.GetName(detail.getEmotion().GetType()) + "-"121 _feeling = new JTextField(detail.getEmotion().getType().getName() + "-" 123 122 + detail.getEmotion().GetPotential()); 124 123 _feeling.setMinimumSize(new Dimension(110,30)); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/IAffectDerivationComponent.java
r807 r848 8 8 public interface IAffectDerivationComponent extends IComponent{ 9 9 10 public ArrayList<BaseEmotion> affectDerivation(AgentModel am, String appraisalVariable,AppraisalFrame af);10 public ArrayList<BaseEmotion> affectDerivation(AgentModel am, AppraisalFrame af); 11 11 public void inverseAffectDerivation(AgentModel am, BaseEmotion em, AppraisalFrame af); 12 12 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/IAppraisalDerivationComponent.java
r806 r848 10 10 public void inverseAppraisal(AgentModel am, AppraisalFrame af); 11 11 12 public voidreappraisal(AgentModel am);12 public AppraisalFrame reappraisal(AgentModel am); 13 13 14 14 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/OCCAffectDerivation/OCCComponent.java
r808 r848 13 13 import FAtiMA.Core.emotionalState.BaseEmotion; 14 14 import FAtiMA.Core.emotionalState.EmotionDisposition; 15 import FAtiMA.Core.emotionalState.EmotionType; 15 16 import FAtiMA.Core.sensorEffector.Event; 16 import FAtiMA.Core.util.enumerables.EmotionType;17 17 import FAtiMA.Core.wellFormedNames.Name; 18 18 … … 80 80 81 81 @Override 82 public ArrayList<BaseEmotion> affectDerivation(AgentModel am, String appraisalVariable,AppraisalFrame af) {82 public ArrayList<BaseEmotion> affectDerivation(AgentModel am, AppraisalFrame af) { 83 83 84 84 ArrayList<BaseEmotion> emotions = new ArrayList<BaseEmotion>(); … … 88 88 float status; 89 89 90 float value = af.getAppraisalVariable(appraisalVariable); 91 92 if(appraisalVariable.equals(DESIRABILITY)) 93 { 94 if(value!=0) 90 if(af.containsAppraisalVariable(DESIRABILITY)) 91 { 92 float desirability = af.getAppraisalVariable(DESIRABILITY); 93 if(desirability!=0) 95 94 { 96 emotions.add(OCCAppraiseWellBeing(event, value));95 emotions.add(OCCAppraiseWellBeing(event, desirability)); 97 96 String other; 98 97 float desirabilityForOther; … … 106 105 if(desirabilityForOther != 0) 107 106 { 108 emotions.add(OCCAppraiseFortuneOfOthers(event, value, desirabilityForOther, other));107 emotions.add(OCCAppraiseFortuneOfOthers(event, desirability, desirabilityForOther, other)); 109 108 } 110 109 … … 113 112 } 114 113 } 115 else if(appraisalVariable.equals(PRAISEWORTHINESS)) 116 { 117 if(value!=0) 114 if(af.containsAppraisalVariable(PRAISEWORTHINESS)) 115 { 116 float praiseworthiness = af.getAppraisalVariable(PRAISEWORTHINESS); 117 if(praiseworthiness!=0) 118 118 { 119 emotions.add(OCCAppraisePraiseworthiness(am.getName(), event, value)); 120 } 121 } 122 else if(appraisalVariable.equals(LIKE)) 123 { 124 if(value!=0) 119 emotions.add(OCCAppraisePraiseworthiness(am.getName(), event, praiseworthiness)); 120 } 121 } 122 if(af.containsAppraisalVariable(LIKE)) 123 { 124 float like = af.getAppraisalVariable(LIKE); 125 if(like!=0) 125 126 { 126 emotions.add(OCCAppraiseAttribution(event, value)); 127 } 128 } 129 else if(appraisalVariable.equals(SUCCESSPROBABILITY)) 130 { 131 status = af.getAppraisalVariable(GOALSTATUS); 127 emotions.add(OCCAppraiseAttribution(event, like)); 128 } 129 } 130 if(af.containsAppraisalVariable(GOALCONDUCIVENESS)) 131 { 132 132 float goalConduciveness = af.getAppraisalVariable(GOALCONDUCIVENESS); 133 if(goalConduciveness != 0) 134 { 135 if(status == GOALUNCONFIRMED) 136 { 137 emotions.add(AppraiseGoalSuccessProbability(am, event, goalConduciveness, value)); 138 } 139 } 140 } 141 else if(appraisalVariable.equals(FAILUREPROBABILITY)) 142 { 143 status = af.getAppraisalVariable(GOALSTATUS); 144 float goalConduciveness = af.getAppraisalVariable(GOALCONDUCIVENESS); 145 if(goalConduciveness != 0) 146 { 147 if(status == GOALUNCONFIRMED) 148 { 149 emotions.add(AppraiseGoalFailureProbability(am, event, goalConduciveness, value)); 150 } 151 } 152 } 153 else if(appraisalVariable.equals(GOALCONDUCIVENESS)) 154 { 155 if(value!=0) 133 if(goalConduciveness!=0) 156 134 { 157 135 status = af.getAppraisalVariable(GOALSTATUS); … … 161 139 if(prob != 0) 162 140 { 163 emotions.add(AppraiseGoalSuccessProbability(am, event, value, prob));141 emotions.add(AppraiseGoalSuccessProbability(am, event, goalConduciveness, prob)); 164 142 } 165 143 … … 167 145 if(prob != 0) 168 146 { 169 emotions.add(AppraiseGoalFailureProbability(am, event, value, prob));147 emotions.add(AppraiseGoalFailureProbability(am, event, goalConduciveness, prob)); 170 148 } 171 149 } … … 198 176 } 199 177 } 200 else if(appraisalVariable.startsWith(DESFOROTHER))201 {202 if(value!=0)203 {204 String other = appraisalVariable.substring(DESFOROTHER.length());205 float desirability = af.getAppraisalVariable(DESIRABILITY);206 207 emotions.add(OCCAppraiseFortuneOfOthers(event, desirability, value, other));208 }209 }210 178 } 211 179 … … 218 186 { 219 187 //ignoring mood for now 220 EmotionDisposition disposition = am.getEmotionalState().getEmotionDispositions()[em.GetType()];221 222 int threshold = disposition.GetThreshold();188 189 EmotionDisposition emotionDisposition = am.getEmotionalState().getEmotionDisposition(em.getType().getName()); 190 int threshold = emotionDisposition.getThreshold(); 223 191 float potentialValue = em.GetPotential() + threshold; 224 192 225 if(em. GetType() == EmotionType.LOVE)193 if(em.getType() == LoveEmotion.getInstance()) 226 194 { 227 195 af.SetAppraisalVariable("", (short)1, LIKE, potentialValue * 1.43f); 228 196 } 229 else if(em. GetType() == EmotionType.HATE)197 else if(em.getType() == HateEmotion.getInstance()) 230 198 { 231 199 af.SetAppraisalVariable("", (short)1, LIKE, -potentialValue * 1.43f); 232 200 } 233 else if(em. GetType() == EmotionType.JOY)201 else if(em.getType() == JoyEmotion.getInstance()) 234 202 { 235 203 af.SetAppraisalVariable("", (short)1, DESIRABILITY, potentialValue); 236 204 } 237 else if(em. GetType() == EmotionType.DISTRESS)205 else if(em.getType() == DistressEmotion.getInstance()) 238 206 { 239 207 af.SetAppraisalVariable("", (short)1, DESIRABILITY, -potentialValue); 240 208 } 241 else if(em. GetType() == EmotionType.PRIDE || em.GetType() == EmotionType.ADMIRATION)209 else if(em.getType() == PrideEmotion.getInstance() || em.getType() == AdmirationEmotion.getInstance()) 242 210 { 243 211 af.SetAppraisalVariable("", (short)1, PRAISEWORTHINESS, potentialValue); 244 212 } 245 else if(em. GetType() == EmotionType.SHAME || em.GetType() == EmotionType.REPROACH)213 else if(em.getType() == ShameEmotion.getInstance() || em.getType() == ReproachEmotion.getInstance()) 246 214 { 247 215 af.SetAppraisalVariable("", (short)1, PRAISEWORTHINESS, -potentialValue); 248 216 } 249 else if(em. GetType() == EmotionType.GLOATING)217 else if(em.getType() == GloatingEmotion.getInstance()) 250 218 { 251 219 af.SetAppraisalVariable("", (short)1, DESIRABILITY, potentialValue); 252 220 //vector.setAppraisalVariable(AppraisalStructure.DESIRABILITY_FOR_OTHER, -potentialValue); 253 221 } 254 else if(em. GetType() == EmotionType.HAPPYFOR)222 else if(em.getType() == HappyForEmotion.getInstance()) 255 223 { 256 224 af.SetAppraisalVariable("", (short)1, DESIRABILITY, potentialValue); 257 225 //vector.setAppraisalVariable(AppraisalStructure.DESIRABILITY_FOR_OTHER, potentialValue); 258 226 } 259 else if(em. GetType() == EmotionType.PITTY)227 else if(em.getType() == PittyEmotion.getInstance()) 260 228 { 261 229 af.SetAppraisalVariable("", (short)1, DESIRABILITY, -potentialValue); 262 230 //vector.setAppraisalVariable(AppraisalStructure.DESIRABILITY_FOR_OTHER, -potentialValue); 263 231 } 264 else if(em. GetType() == EmotionType.RESENTMENT)232 else if(em.getType() == ResentmentEmotion.getInstance()) 265 233 { 266 234 af.SetAppraisalVariable("", (short)1, DESIRABILITY, -potentialValue); 267 235 //vector.setAppraisalVariable(AppraisalStructure.DESIRABILITY_FOR_OTHER, potentialValue); 268 236 } 269 else if(em.GetType() ==EmotionType.GRATIFICATION || em.GetType() == EmotionType.GRATITUDE)237 /*else if(em.getType() == GratificationEmotioEmotionType.GRATIFICATION || em.GetType() == EmotionType.GRATITUDE) 270 238 { 271 239 af.SetAppraisalVariable("", (short)1, DESIRABILITY, potentialValue); … … 276 244 af.SetAppraisalVariable("", (short)1, DESIRABILITY, -potentialValue); 277 245 af.SetAppraisalVariable("", (short)1, PRAISEWORTHINESS, -potentialValue); 278 } 246 }*/ 279 247 } 280 248 … … 282 250 { 283 251 BaseEmotion em; 284 ArrayList<String> appraisalVariables = new ArrayList<String>();285 appraisalVariables.add(LIKE);286 252 287 253 if(like >= 0) { 288 em = new BaseEmotion( EmotionType.LOVE, like*0.7f, appraisalVariables, event, Name.ParseName(event.GetTarget()));254 em = new BaseEmotion(LoveEmotion.getInstance(), like*0.7f, event, Name.ParseName(event.GetTarget())); 289 255 } 290 256 else { 291 em = new BaseEmotion( EmotionType.HATE, -like*0.7f, appraisalVariables, event, Name.ParseName(event.GetTarget()));257 em = new BaseEmotion(HateEmotion.getInstance(), -like*0.7f, event, Name.ParseName(event.GetTarget())); 292 258 } 293 259 … … 297 263 private static BaseEmotion OCCAppraiseWellBeing(Event event, float desirability) { 298 264 BaseEmotion em; 299 ArrayList<String> appraisalVariables = new ArrayList<String>();300 appraisalVariables.add(DESIRABILITY);301 265 302 266 if(desirability >= 0) { 303 em = new BaseEmotion( EmotionType.JOY, desirability, appraisalVariables, event, null);267 em = new BaseEmotion(JoyEmotion.getInstance(), desirability, event); 304 268 } 305 269 else { 306 em = new BaseEmotion( EmotionType.DISTRESS, -desirability, appraisalVariables, event, null);270 em = new BaseEmotion(DistressEmotion.getInstance(), -desirability, event); 307 271 } 308 272 return em; … … 311 275 private static BaseEmotion OCCAppraisePraiseworthiness(String appraisingAgent, Event event, float praiseworthiness) { 312 276 BaseEmotion em; 313 ArrayList<String> appraisalVariables = new ArrayList<String>();314 appraisalVariables.add(PRAISEWORTHINESS);315 277 316 278 if(praiseworthiness >= 0) { 317 279 if(event.GetSubject().equals(appraisingAgent)) { 318 em = new BaseEmotion( EmotionType.PRIDE, praiseworthiness, appraisalVariables, event, Name.ParseName("SELF"));280 em = new BaseEmotion(PrideEmotion.getInstance(), praiseworthiness, event, Name.ParseName("SELF")); 319 281 } 320 282 else { 321 em = new BaseEmotion( EmotionType.ADMIRATION, praiseworthiness, appraisalVariables, event, Name.ParseName(event.GetSubject()));283 em = new BaseEmotion(AdmirationEmotion.getInstance(), praiseworthiness, event, Name.ParseName(event.GetSubject())); 322 284 } 323 285 } 324 286 else { 325 287 if(event.GetSubject().equals(appraisingAgent)) { 326 em = new BaseEmotion( EmotionType.SHAME, -praiseworthiness, appraisalVariables, event, Name.ParseName("SELF"));288 em = new BaseEmotion(ShameEmotion.getInstance(), -praiseworthiness, event, Name.ParseName("SELF")); 327 289 } 328 290 else { 329 em = new BaseEmotion( EmotionType.REPROACH, -praiseworthiness, appraisalVariables, event, Name.ParseName(event.GetSubject()));291 em = new BaseEmotion(ReproachEmotion.getInstance(), -praiseworthiness, event, Name.ParseName(event.GetSubject())); 330 292 } 331 293 } … … 366 328 float potential; 367 329 potential = prob * goalConduciveness; 368 ArrayList<String> appraisalVariables = new ArrayList<String>(); 369 appraisalVariables.add(GOALCONDUCIVENESS); 370 appraisalVariables.add(FAILUREPROBABILITY); 371 372 BaseEmotion em = new BaseEmotion(EmotionType.FEAR, potential, appraisalVariables, e, null); 330 331 BaseEmotion em = new BaseEmotion(FearEmotion.getInstance(), potential, e); 373 332 374 333 return em; … … 385 344 float potential; 386 345 potential = prob * goalConduciveness; 387 ArrayList<String> appraisalVariables = new ArrayList<String>(); 388 appraisalVariables.add(GOALCONDUCIVENESS); 389 appraisalVariables.add(SUCCESSPROBABILITY); 390 391 BaseEmotion em = new BaseEmotion(EmotionType.HOPE, potential, appraisalVariables, e, null); 346 347 BaseEmotion em = new BaseEmotion(HopeEmotion.getInstance(), potential, e); 392 348 393 349 return em; … … 401 357 */ 402 358 public static BaseEmotion AppraiseGoalFailure(AgentModel am, ActiveEmotion hopeEmotion, ActiveEmotion fearEmotion, float conduciveness, Event e) { 403 return AppraiseGoalEnd( EmotionType.DISAPPOINTMENT,EmotionType.FEARSCONFIRMED,hopeEmotion,fearEmotion,conduciveness,e);359 return AppraiseGoalEnd(DisappointmentEmotion.getInstance(),FearsConfirmedEmotion.getInstance(),hopeEmotion,fearEmotion,conduciveness,e); 404 360 } 405 361 … … 414 370 */ 415 371 public static BaseEmotion AppraiseGoalSuccess(AgentModel am, ActiveEmotion hopeEmotion, ActiveEmotion fearEmotion, float conduciveness, Event e) { 416 return AppraiseGoalEnd( EmotionType.SATISFACTION,EmotionType.RELIEF,hopeEmotion,fearEmotion,conduciveness,e);372 return AppraiseGoalEnd(SatisfactionEmotion.getInstance(),ReliefEmotion.getInstance(),hopeEmotion,fearEmotion,conduciveness,e); 417 373 } 418 374 … … 422 378 BaseEmotion em; 423 379 float potential; 424 ArrayList<String> appraisalVariables = new ArrayList<String>();425 appraisalVariables.add(DESIRABILITY);426 appraisalVariables.add(DESFOROTHER + target);427 428 380 429 381 potential = (Math.abs(desirabilityForOther) + Math.abs(desirability)) / 2.0f; … … 431 383 if(desirability >= 0) { 432 384 if(desirabilityForOther >= 0) { 433 em = new BaseEmotion( EmotionType.HAPPYFOR, potential, appraisalVariables, event, Name.ParseName(target));385 em = new BaseEmotion(HappyForEmotion.getInstance(), potential, event, Name.ParseName(target)); 434 386 } 435 387 else { 436 em = new BaseEmotion( EmotionType.GLOATING, potential, appraisalVariables, event, Name.ParseName(target));388 em = new BaseEmotion(GloatingEmotion.getInstance(), potential, event, Name.ParseName(target)); 437 389 } 438 390 } 439 391 else { 440 392 if(desirabilityForOther >= 0) { 441 em = new BaseEmotion( EmotionType.RESENTMENT, potential, appraisalVariables, event, Name.ParseName(target));393 em = new BaseEmotion(ResentmentEmotion.getInstance(), potential, event, Name.ParseName(target)); 442 394 } 443 395 else { 444 em = new BaseEmotion( EmotionType.PITTY, potential, appraisalVariables, event, Name.ParseName(target));445 } 446 } 447 448 return em; 449 } 450 451 private static BaseEmotion AppraiseGoalEnd( short hopefullOutcome, shortfearfullOutcome,396 em = new BaseEmotion(PittyEmotion.getInstance(), potential, event, Name.ParseName(target)); 397 } 398 } 399 400 return em; 401 } 402 403 private static BaseEmotion AppraiseGoalEnd(EmotionType hopefullOutcome, EmotionType fearfullOutcome, 452 404 ActiveEmotion hopeEmotion, ActiveEmotion fearEmotion, float goalConduciveness, Event e) { 453 405 454 shortfinalEmotion;406 EmotionType finalEmotion; 455 407 float potential = 0; 456 457 ArrayList<String> appraisalVariables = new ArrayList<String>();458 appraisalVariables.add(GOALCONDUCIVENESS);459 appraisalVariables.add(GOALSTATUS);460 408 461 409 if(hopeEmotion != null) { … … 478 426 potential = (potential + 2* goalConduciveness) / 3; 479 427 480 return new BaseEmotion(finalEmotion, potential, appraisalVariables, e, null);428 return new BaseEmotion(finalEmotion, potential, e); 481 429 } 482 430 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/conditions/EmotionCondition.java
r667 r848 42 42 import FAtiMA.Core.memory.semanticMemory.KnowledgeBase; 43 43 import FAtiMA.Core.util.Constants; 44 import FAtiMA.Core.util.enumerables.EmotionType;45 44 import FAtiMA.Core.wellFormedNames.Name; 46 45 import FAtiMA.Core.wellFormedNames.Substitution; … … 56 55 private static final long serialVersionUID = 1L; 57 56 58 protected short_emotionType;57 protected String _emotionType; 59 58 protected Symbol _intensity; 60 59 protected Symbol _direction; … … 84 83 if(aux != null) 85 84 { 86 ec = new EmotionCondition(active,new Symbol(aux), EmotionType.ParseType(emotionType));85 ec = new EmotionCondition(active,new Symbol(aux),emotionType); 87 86 } 88 87 else 89 88 { 90 ec = new EmotionCondition(active, 91 EmotionType.ParseType(emotionType)); 89 ec = new EmotionCondition(active,emotionType); 92 90 } 93 91 … … 119 117 } 120 118 121 public EmotionCondition(boolean active, shortemotion)119 public EmotionCondition(boolean active, String emotion) 122 120 { 123 121 this._positive = active; … … 130 128 } 131 129 132 public EmotionCondition(boolean active, Symbol ToM, shortemotion)130 public EmotionCondition(boolean active, Symbol ToM, String emotion) 133 131 { 134 132 this._positive = active; … … 159 157 private void UpdateName() 160 158 { 161 String aux = EmotionType.GetName(this._emotionType)+ "(";159 String aux = this._emotionType + "("; 162 160 163 161 if(this._direction != null) … … 233 231 { 234 232 aem = (ActiveEmotion) it.next(); 235 if(aem. GetType() == this._emotionType)233 if(aem.getType().getName().equals(this._emotionType)) 236 234 { 237 235 if(this._intensity.isGrounded()) -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/conditions/EmotionalEpisodeCondition.java
r667 r848 40 40 import FAtiMA.Core.memory.episodicMemory.MemoryEpisode; 41 41 import FAtiMA.Core.util.Constants; 42 import FAtiMA.Core.util.enumerables.EmotionType;43 42 import FAtiMA.Core.wellFormedNames.Name; 44 43 import FAtiMA.Core.wellFormedNames.Substitution; … … 126 125 emotion = episode.getStrongestEmotion(); 127 126 128 try { 129 if(emotion.GetType() == EmotionType.ParseType(this._emotion.toString())) 127 128 if(emotion.getType().getName().equals(this._emotion.toString())) 129 { 130 if(emotion.GetPotential() >= this._value) 130 131 { 131 if(emotion.GetPotential() >= this._value) 132 { 133 return true; 134 } 132 return true; 135 133 } 136 } catch (InvalidEmotionTypeException e) { 137 return false; 138 } 139 134 } 140 135 141 136 return false; … … 180 175 if(!_emotion.isGrounded()) 181 176 { 182 s = new Substitution(this._emotion,new Symbol( EmotionType.GetName(emotion.GetType())));177 s = new Substitution(this._emotion,new Symbol(emotion.getType().getName())); 183 178 ss.AddSubstitution(s); 184 179 bindingSets.add(ss); 185 180 } 186 else if(emotion. GetType() == EmotionType.ParseType(this._emotion.toString()))181 else if(emotion.getType().getName().equals(this._emotion.toString())); 187 182 { 188 183 ss = new SubstitutionSet(); … … 207 202 { 208 203 209 s = new Substitution(this._emotion,new Symbol( EmotionType.GetName(emotion.GetType())));204 s = new Substitution(this._emotion,new Symbol(emotion.getType().getName())); 210 205 ss.AddSubstitution(s); 211 206 bindingSets.add(ss); 212 207 213 208 } 214 else if(emotion. GetType() == EmotionType.ParseType(this._emotion.toString()))209 else if(emotion.getType().getName().equals(this._emotion.toString())) 215 210 { 216 211 bindingSets.add(ss); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/deliberativeLayer/DeliberativeProcess.java
r806 r848 1273 1273 1274 1274 @Override 1275 public void reappraisal(AgentModel am) { 1275 public AppraisalFrame reappraisal(AgentModel am) { 1276 return null; 1276 1277 } 1277 1278 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/deliberativeLayer/EmotionalPlanner.java
r801 r848 490 490 failureImportance = intention.getGoal().GetImportanceOfFailure(am); 491 491 492 AppraisalFrame auxFrame = new AppraisalFrame( am,tGoal.GetActivationEvent());492 AppraisalFrame auxFrame = new AppraisalFrame(tGoal.GetActivationEvent()); 493 493 auxFrame.SetAppraisalVariable(DeliberativeProcess.NAME, (short)6, OCCComponent.FAILUREPROBABILITY, prob); 494 494 auxFrame.SetAppraisalVariable(DeliberativeProcess.NAME, (short)6, OCCComponent.GOALCONDUCIVENESS, -tGoal.GetImportanceOfFailure(am)); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/deliberativeLayer/Intention.java
r801 r848 90 90 _hopeEmotionID = null; 91 91 _strongCommitment = false; 92 _appraisalFrame = new AppraisalFrame( am,g.GetActivationEvent());92 _appraisalFrame = new AppraisalFrame(g.GetActivationEvent()); 93 93 _appraisalFrame.SetAppraisalVariable(DeliberativeProcess.NAME, (short) 7, OCCComponent.GOALSTATUS, OCCComponent.GOALUNCONFIRMED); 94 94 } … … 399 399 am.getMemory().getEpisodicMemory().StoreAction(am.getMemory(), e); 400 400 401 AppraisalFrame af = new AppraisalFrame( am,e);401 AppraisalFrame af = new AppraisalFrame(e); 402 402 af.SetAppraisalVariable(DeliberativeProcess.NAME,(short)8,OCCComponent.GOALSTATUS, OCCComponent.GOALDISCONFIRMED); 403 403 af.SetAppraisalVariable(DeliberativeProcess.NAME, (short)8,OCCComponent.GOALCONDUCIVENESS, am.getDeliberativeLayer().getUtilityStrategy().getUtility(am, _goal)); … … 435 435 Event e = _goal.GetSuccessEvent(); 436 436 am.getMemory().getEpisodicMemory().StoreAction(am.getMemory(), e); 437 AppraisalFrame af = new AppraisalFrame( am,e);437 AppraisalFrame af = new AppraisalFrame(e); 438 438 af.SetAppraisalVariable(DeliberativeProcess.NAME,(short)8,OCCComponent.GOALSTATUS, OCCComponent.GOALCONFIRMED); 439 439 af.SetAppraisalVariable(DeliberativeProcess.NAME, (short)8,OCCComponent.GOALCONDUCIVENESS, am.getDeliberativeLayer().getUtilityStrategy().getUtility(am, _goal)); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/ActiveEmotion.java
r667 r848 36 36 37 37 import FAtiMA.Core.AgentSimulationTime; 38 import FAtiMA.Core.util.enumerables.EmotionType;39 38 40 39 /** … … 145 144 */ 146 145 public String toXml() { 147 return "<Emotion t0=\"" + _t0 + "\" type=\"" + EmotionType.GetName(_type) +148 "\" valence=\"" + _ valence+146 return "<Emotion t0=\"" + _t0 + "\" type=\"" + _type.getName() + 147 "\" valence=\"" + _type.getValence() + 149 148 "\" cause=\"" + _cause + "\" direction=\"" + _direction 150 149 + "\" intensity=\"" + _intensity + "\" />"; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/AppraisalFrame.java
r808 r848 32 32 import java.util.HashMap; 33 33 34 import FAtiMA.Core.AgentModel;35 34 import FAtiMA.Core.sensorEffector.Event; 36 35 … … 38 37 39 38 39 /** 40 * 41 */ 42 private static final long serialVersionUID = 1L; 43 44 private static final short DEFAULTCOMPONENTWEIGHT = 5; 45 40 46 private class Pair 41 47 { … … 62 68 63 69 private Event _event; 64 private AgentModel _am;65 70 private HashMap<String,AppraisalVariable> _appraisal; 66 71 … … 69 74 private boolean _empty; 70 75 71 public AppraisalFrame( AgentModel am,Event e)76 public AppraisalFrame(Event e) 72 77 { 73 78 _event = e; 74 _changed = true;79 _changed = false; 75 80 _empty = true; 76 _am = am;77 81 _appraisal = new HashMap<String,AppraisalVariable>(); 78 82 } … … 83 87 } 84 88 85 public void SetAppraisalVariable(String component, short weight, String appraisalVariable, float value) 89 public void SetAppraisalVariable(String componentName, String appraisalVariableName, float value) 90 { 91 SetAppraisalVariable(componentName, DEFAULTCOMPONENTWEIGHT, appraisalVariableName, value); 92 } 93 94 public void SetAppraisalVariable(String componentName, short componentWeight, String appraisalVariableName, float value) 86 95 { 87 96 AppraisalVariable av; 88 97 89 if(_appraisal.containsKey(appraisalVariable ))98 if(_appraisal.containsKey(appraisalVariableName)) 90 99 { 91 av = _appraisal.get(appraisalVariable );100 av = _appraisal.get(appraisalVariableName); 92 101 } 93 102 else 94 103 { 95 av = new AppraisalVariable(appraisalVariable );96 _appraisal.put(appraisalVariable , av);104 av = new AppraisalVariable(appraisalVariableName); 105 _appraisal.put(appraisalVariableName, av); 97 106 } 98 107 99 108 //replacing or setting up a new value? 100 if(av._values.containsKey(component ))109 if(av._values.containsKey(componentName)) 101 110 { 102 111 //replacing an existing value 103 Pair p = av._values.get(component );112 Pair p = av._values.get(componentName); 104 113 if(p._value != value) 105 114 { … … 107 116 p._value = value; 108 117 _changed = true; 109 if(_am != null) 110 { 111 _am.updateEmotions(appraisalVariable, this); 112 } 118 113 119 //nothing else needs to be done in this case 114 120 } … … 117 123 { 118 124 //setting up a new value 119 Pair p = new Pair( weight, value);120 av._weight += weight;125 Pair p = new Pair(componentWeight, value); 126 av._weight += componentWeight; 121 127 122 av._values.put(component ,p);128 av._values.put(componentName,p); 123 129 _empty = false; 124 if(_am != null) 125 { 126 _am.updateEmotions(appraisalVariable, this); 127 } 130 128 131 _changed = true; 129 132 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/BaseEmotion.java
r808 r848 34 34 35 35 import java.io.Serializable; 36 import java.util.ArrayList;37 36 38 37 import FAtiMA.Core.sensorEffector.Event; 39 import FAtiMA.Core.util.enumerables.EmotionType;40 import FAtiMA.Core.util.enumerables.EmotionValence;41 38 import FAtiMA.Core.wellFormedNames.Name; 42 39 … … 57 54 protected Name _direction; 58 55 protected float _potential; 59 protected ArrayList<String> _appraisalVariables;60 56 61 protected final short _type; 62 protected final byte _valence; 57 protected final EmotionType _type; 63 58 64 59 /** … … 71 66 * this parameter specifies the target 72 67 */ 73 public BaseEmotion( short type, float potential, ArrayList<String> appraisalVariables, Event cause, Name direction) {68 public BaseEmotion(EmotionType type, float potential, Event cause, Name direction) { 74 69 _type = type; 75 70 _potential = potential; 76 71 _cause = cause; 77 72 _direction = direction; 78 _appraisalVariables = appraisalVariables; 79 80 if(type == EmotionType.JOY || 81 type == EmotionType.LOVE || 82 type == EmotionType.HOPE || 83 type == EmotionType.SATISFACTION || 84 type == EmotionType.RELIEF || 85 type == EmotionType.GLOATING || 86 type == EmotionType.HAPPYFOR || 87 type == EmotionType.ADMIRATION || 88 type == EmotionType.PRIDE || 89 type == EmotionType.GRATIFICATION || 90 type == EmotionType.GRATITUDE || 91 type == EmotionType.EXPECTED_REWARD || 92 type == EmotionType.STRONGER_REWARD || 93 type == EmotionType.WEAKER_REWARD || 94 type == EmotionType.UNEXPECTED_REWARD 95 ) 96 { 97 _valence = EmotionValence.POSITIVE; 98 } 99 else 100 { 101 _valence = EmotionValence.NEGATIVE; 102 } 73 } 74 75 public BaseEmotion(EmotionType type, float potential, Event cause) { 76 this(type,potential,cause,null); 103 77 } 104 78 … … 112 86 _cause = em._cause; 113 87 _direction = em._direction; 114 _valence = em._valence;115 _appraisalVariables = em._appraisalVariables;116 88 } 117 89 … … 132 104 } 133 105 134 public ArrayList<String> GetAppraisalVariables()135 {136 return _appraisalVariables;137 }138 106 139 107 /** … … 143 111 public String GetHashKey() { 144 112 String aux = _cause.toString()+_cause.GetTime(); 145 for(String s : _ appraisalVariables)113 for(String s : _type.getAppraisalVariables()) 146 114 { 147 115 aux += "-" + s; 116 } 117 if(_direction!=null) 118 { 119 aux += _direction; 148 120 } 149 121 return aux; … … 163 135 * @see EmotionType enumerable for the set of possible emotion types 164 136 */ 165 public short GetType() {137 public EmotionType getType() { 166 138 return _type; 167 139 } … … 172 144 * @see EmotionValence enumerable 173 145 */ 174 public byte GetValence() {175 return _ valence;146 public byte getValence() { 147 return _type.getValence(); 176 148 } 177 149 … … 204 176 */ 205 177 public String toString() { 206 return EmotionType.GetName(_type) + ": " + _cause + " " + _direction;178 return _type.getName() + ": " + _cause + " " + _direction; 207 179 } 208 180 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/EmotionDisposition.java
r667 r848 48 48 private static final long serialVersionUID = 1L; 49 49 50 private String _emotion; 50 51 private int _decay; 51 private short _emotionType;52 52 private int _threshold; 53 53 … … 55 55 * Creates a new EmotionDisposition 56 56 * 57 * @param emotionType - a short value representing the type of the Emotion (ex: Fear, Hope, etc)58 57 * @param threshold - the threshold for the emotion 59 58 * @param decay - the decay rate for the emotion 60 59 * 61 * @see the enumerable EmotionType to see the possible types of Emotion62 60 */ 63 public EmotionDisposition( short emotionType, int threshold, int decay) {64 _emotion Type = emotionType;61 public EmotionDisposition(String emotion, int threshold, int decay) { 62 _emotion = emotion; 65 63 _threshold = threshold; 66 64 _decay = decay; … … 71 69 * @return the decay rate 72 70 */ 73 public int GetDecay() {71 public int getDecay() { 74 72 return _decay; 75 }76 77 /**78 * Gets the emotion's type79 * @return a short representing the emotion type (enumerable)80 * @see the enumerable EmotionType81 */82 public short GetEmotionType() {83 return _emotionType;84 73 } 85 74 … … 88 77 * @return the threshold 89 78 */ 90 public int GetThreshold() {79 public int getThreshold() { 91 80 return _threshold; 81 } 82 83 public String getEmotion() 84 { 85 return _emotion; 92 86 } 93 87 … … 97 91 */ 98 92 public String toString() { 99 return "Emotion: " + _emotion Type+ " Threshold: " + _threshold + " Decay: " + _decay;93 return "Emotion: " + _emotion + " Threshold: " + _threshold + " Decay: " + _decay; 100 94 } 101 95 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/EmotionalState.java
r808 r848 58 58 59 59 import java.io.Serializable; 60 import java.util.ArrayList;61 60 import java.util.Collection; 62 61 import java.util.Hashtable; … … 67 66 import FAtiMA.Core.AgentSimulationTime; 68 67 import FAtiMA.Core.sensorEffector.Event; 69 import FAtiMA.Core.util.enumerables.EmotionType;70 68 import FAtiMA.Core.util.enumerables.EmotionValence; 71 69 … … 85 83 private static final long serialVersionUID = 1L; 86 84 87 88 protected EmotionDisposition[] _emotionDispositions;85 private static final EmotionDisposition DEFAULT_EMOTION_DISPOSITION = new EmotionDisposition("default",0,5); 86 89 87 protected Hashtable<String, ActiveEmotion> _emotionPool; 88 protected Hashtable<String, EmotionDisposition> _emotionDispositions; 90 89 91 90 protected long _lastTime; … … 96 95 */ 97 96 public EmotionalState() { 98 _emotionDispositions = new EmotionDisposition[30];99 97 _emotionPool = new Hashtable<String, ActiveEmotion>(); 98 _emotionDispositions = new Hashtable<String,EmotionDisposition>(); 99 100 100 _mood = new Mood(); 101 101 _lastTime = AgentSimulationTime.GetInstance().Time(); … … 106 106 107 107 //positive emotion 108 if (potEm. _valence== EmotionValence.POSITIVE) {108 if (potEm.getValence() == EmotionValence.POSITIVE) { 109 109 //if good mood(positive), will favor a positive emotion 110 110 //if bad mood(negative), will make it harder … … 139 139 int decay; 140 140 ActiveEmotion auxEmotion; 141 EmotionDisposition disposition;142 141 boolean reappraisal = false; 143 142 … … 145 144 146 145 potential = DeterminePotential(potEm); 147 148 disposition = _emotionDispositions[potEm._type]; 149 threshold = disposition.GetThreshold(); 150 decay = disposition.GetDecay(); 146 147 EmotionDisposition disposition = getEmotionDisposition(potEm.getType().getName()); 148 149 threshold = disposition.getThreshold(); 150 decay = disposition.getDecay(); 151 151 152 152 auxEmotion = null; … … 169 169 auxEmotion, 170 170 auxEmotion.GetCause()); 171 this.GenerateCompoundEmotions(potEm, am);171 //this.GenerateCompoundEmotions(potEm, am); 172 172 } 173 173 … … 194 194 int decay; 195 195 ActiveEmotion auxEmotion; 196 EmotionDisposition disposition;197 196 198 197 potential = DeterminePotential(potEm); 199 198 200 disposition = _emotionDispositions[potEm._type]; 201 threshold = disposition.GetThreshold(); 202 decay = disposition.GetDecay(); 199 EmotionDisposition emotionDisposition = getEmotionDisposition(potEm.getType().getName()); 200 201 threshold = emotionDisposition.getThreshold(); 202 decay = emotionDisposition.getDecay(); 203 203 204 204 auxEmotion = null; … … 211 211 } 212 212 213 214 /**215 * Adds an EmotionDisposition (threshold + decay) to a particular emotion type216 * @param emotionDis - the EmotionDisposition to add217 * @see EmotionDisposition218 */219 public void AddEmotionDisposition(EmotionDisposition emotionDis) {220 _emotionDispositions[emotionDis.GetEmotionType()] = emotionDis;221 }222 223 224 public EmotionDisposition[] getEmotionDispositions()225 {226 return _emotionDispositions;227 }228 213 229 214 … … 396 381 } 397 382 398 private void GenerateCompoundEmotions(BaseEmotion potEm, AgentModel am) {383 /*private void GenerateCompoundEmotions(BaseEmotion potEm, AgentModel am) { 399 384 ActiveEmotion emotion; 400 385 short n1; … … 466 451 AddEmotion(i2.next(), am); 467 452 } 468 } 453 }*/ 454 455 public void AddEmotionDisposition(EmotionDisposition emotionDisposition) 456 { 457 _emotionDispositions.put(emotionDisposition.getEmotion(), emotionDisposition); 458 } 459 460 461 public Collection<EmotionDisposition> getEmotionDispositions() 462 { 463 return _emotionDispositions.values(); 464 } 465 466 public EmotionDisposition getEmotionDisposition(String emotionName) 467 { 468 if(_emotionDispositions.containsKey(emotionName)) 469 { 470 return _emotionDispositions.get(emotionName); 471 } 472 else return DEFAULT_EMOTION_DISPOSITION; 473 } 474 469 475 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/Mood.java
r667 r848 110 110 float newMood; 111 111 112 if(em. GetValence() == EmotionValence.POSITIVE) {112 if(em.getValence() == EmotionValence.POSITIVE) { 113 113 newMood = _intensity + (em.GetIntensity() * EmotionalPameters.EmotionInfluenceOnMood); 114 114 //mood is limited between -10 and 10 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/ActionDetail.java
r782 r848 46 46 import FAtiMA.Core.emotionalState.ActiveEmotion; 47 47 import FAtiMA.Core.emotionalState.BaseEmotion; 48 import FAtiMA.Core.emotionalState.NeutralEmotion; 48 49 import FAtiMA.Core.memory.Memory; 49 50 import FAtiMA.Core.memory.semanticMemory.KnowledgeSlot; … … 51 52 import FAtiMA.Core.sensorEffector.Parameter; 52 53 import FAtiMA.Core.util.enumerables.ActionEvent; 53 import FAtiMA.Core.util.enumerables.EmotionType;54 54 import FAtiMA.Core.util.enumerables.EmotionValence; 55 55 import FAtiMA.Core.util.enumerables.EventType; 56 56 import FAtiMA.Core.util.enumerables.GoalEvent; 57 import FAtiMA.Core.wellFormedNames.Name;58 57 import FAtiMA.Core.wellFormedNames.Substitution; 59 58 … … 127 126 } 128 127 129 this._emotion = new BaseEmotion( EmotionType.NEUTRAL,0,new ArrayList<String>(),e,null);128 this._emotion = new BaseEmotion(NeutralEmotion.getInstance(),0,e); 130 129 } 131 130 … … 348 347 if(em.GetIntensity() > this._emotion.GetPotential()) 349 348 { 350 this._emotion = new BaseEmotion(em. GetType(),em.GetIntensity(),em.GetAppraisalVariables(), em.GetCause(),em.GetDirection());351 if(this._emotion. GetValence() == EmotionValence.POSITIVE)349 this._emotion = new BaseEmotion(em.getType(),em.GetIntensity(), em.GetCause(),em.GetDirection()); 350 if(this._emotion.getType().getValence() == EmotionValence.POSITIVE) 352 351 { 353 352 this._desirability = (float) Math.floor(em.GetPotential()); … … 583 582 String action = "<Event>"; 584 583 action += "<EventID>" + this.getID() + "</EventID>"; 585 action += "<Emotion>" + EmotionType.GetName(this.getEmotion().GetType()) + " " + this.getEmotion().GetPotential() + "</Emotion>";584 action += "<Emotion>" + this.getEmotion().getType().getName() + " " + this.getEmotion().GetPotential() + "</Emotion>"; 586 585 action += "<Subject>" + this.getSubject() + "</Subject>"; 587 586 action += "<Intention>" + this.getIntention() + "</Intention>"; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/EpisodicMemory.java
r782 r848 7 7 import FAtiMA.Core.deliberativeLayer.goals.Goal; 8 8 import FAtiMA.Core.emotionalState.ActiveEmotion; 9 import FAtiMA.Core.emotionalState.NeutralEmotion; 9 10 import FAtiMA.Core.memory.Memory; 10 11 import FAtiMA.Core.sensorEffector.Event; … … 12 13 import FAtiMA.Core.util.Constants; 13 14 import FAtiMA.Core.util.enumerables.ActionEvent; 14 import FAtiMA.Core.util.enumerables.EmotionType;15 15 import FAtiMA.Core.util.enumerables.EventType; 16 16 import FAtiMA.Core.util.enumerables.GoalEvent; … … 286 286 detail.getStatus().equals(GoalEvent.GetName(GoalEvent.SUCCESS)) || 287 287 detail.getStatus().equals(GoalEvent.GetName(GoalEvent.FAILURE)))) || 288 (detail.getAction() != null && (detail.getEmotion(). GetType()) != EmotionType.NEUTRAL))288 (detail.getAction() != null && (detail.getEmotion().getType()) != NeutralEmotion.getInstance())) 289 289 { 290 290 _am.StoreAction(detail); … … 313 313 detail.getStatus().equals(GoalEvent.GetName(GoalEvent.SUCCESS)) || 314 314 detail.getStatus().equals(GoalEvent.GetName(GoalEvent.FAILURE)))) || 315 (detail.getAction() != null && (detail.getEmotion(). GetType()) != EmotionType.NEUTRAL))315 (detail.getAction() != null && (detail.getEmotion().getType()) != NeutralEmotion.getInstance())) 316 316 { 317 317 _am.StoreAction(detail); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/MemoryEpisode.java
r782 r848 327 327 action = (ActionDetail) auxList.get(i); 328 328 secondStrongestEmotion = action.getEmotion(); 329 if(secondStrongestEmotion. GetType() != strongestEmotion.GetType())329 if(secondStrongestEmotion.getType() != strongestEmotion.getType()) 330 330 { 331 331 break; … … 361 361 362 362 if(strongestEmotion != null && 363 action.getEmotion(). GetType() == strongestEmotion.GetType() &&363 action.getEmotion().getType() == strongestEmotion.getType() && 364 364 action.getEmotion().GetPotential() == strongestEmotion.GetPotential()) 365 365 { … … 417 417 if(em.GetPotential() > 0) 418 418 { 419 if(em. GetValence() == EmotionValence.POSITIVE)419 if(em.getType().getValence() == EmotionValence.POSITIVE) 420 420 { 421 421 value += em.GetPotential(); … … 457 457 if(em.GetPotential() > 0) 458 458 { 459 if(em. GetValence() == EmotionValence.POSITIVE)459 if(em.getType().getValence() == EmotionValence.POSITIVE) 460 460 { 461 461 error = em.GetPotential() - avg; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/SummaryGenerator.java
r667 r848 38 38 import FAtiMA.Core.sensorEffector.SpeechAct; 39 39 import FAtiMA.Core.util.Constants; 40 import FAtiMA.Core.util.enumerables.EmotionType;41 40 import FAtiMA.Core.wellFormedNames.Name; 42 41 … … 169 168 } 170 169 171 EMSummary += ">"+ EmotionType.GetName(em.GetType()) + "</Emotion>";170 EMSummary += ">"+em.getType().getName() + "</Emotion>"; 172 171 173 172 return EMSummary; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/semanticMemory/KnowledgeBase.java
r833 r848 289 289 } 290 290 291 291 292 public ArrayList<SubstitutionSet> GetPossibleBindings(Name name) { 292 293 ArrayList<SubstitutionSet> bindingSets = null; … … 314 315 } 315 316 else return null; 317 } 318 319 public KnowledgeSlot getMainSlot() 320 { 321 return _kB; 316 322 } 317 323 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/reactiveLayer/Action.java
r801 r848 153 153 newPotential = 0; 154 154 } 155 _elicitingEmotion = new BaseEmotion(_elicitingEmotion. GetType(),155 _elicitingEmotion = new BaseEmotion(_elicitingEmotion.getType(), 156 156 newPotential, 157 new ArrayList<String>(),158 157 _elicitingEmotion.GetCause(), 159 158 _elicitingEmotion.GetDirection()); … … 176 175 newPotential = 10; 177 176 } 178 _elicitingEmotion = new BaseEmotion(_elicitingEmotion. GetType(),177 _elicitingEmotion = new BaseEmotion(_elicitingEmotion.getType(), 179 178 newPotential, 180 new ArrayList<String>(),181 179 _elicitingEmotion.GetCause(), 182 180 _elicitingEmotion.GetDirection()); … … 209 207 { 210 208 em = (ActiveEmotion) it.next(); 211 if(em. GetType() == _elicitingEmotion.GetType() &&209 if(em.getType() == _elicitingEmotion.getType() && 212 210 em.GetIntensity() >= _elicitingEmotion.GetPotential()) 213 211 { -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/reactiveLayer/ReactiveProcess.java
r806 r848 161 161 */ 162 162 @Override 163 public void appraisal(AgentModel ag, Event event, AppraisalFrame a s) {164 Reaction selfEvaluation; 163 public void appraisal(AgentModel ag, Event event, AppraisalFrame af) { 164 Reaction selfEvaluation; 165 165 166 166 … … 171 171 if(selfEvaluation._desirability != null) 172 172 { 173 a s.SetAppraisalVariable(NAME, (short)5, OCCComponent.DESIRABILITY, selfEvaluation._desirability.intValue());173 af.SetAppraisalVariable(NAME, OCCComponent.DESIRABILITY, selfEvaluation._desirability.intValue()); 174 174 } 175 175 if(selfEvaluation._desirabilityForOther != null && selfEvaluation._other != null) 176 176 { 177 a s.SetAppraisalVariable(NAME, (short)5,OCCComponent.DESFOROTHER + selfEvaluation._other, selfEvaluation._desirabilityForOther.intValue());177 af.SetAppraisalVariable(NAME, OCCComponent.DESFOROTHER + selfEvaluation._other, selfEvaluation._desirabilityForOther.intValue()); 178 178 } 179 179 if(selfEvaluation._praiseworthiness != null) 180 180 { 181 a s.SetAppraisalVariable(NAME, (short)5, OCCComponent.PRAISEWORTHINESS, selfEvaluation._praiseworthiness.intValue());181 af.SetAppraisalVariable(NAME, OCCComponent.PRAISEWORTHINESS, selfEvaluation._praiseworthiness); 182 182 } 183 183 if(selfEvaluation._like != null) 184 184 { 185 a s.SetAppraisalVariable(NAME, (short)5, OCCComponent.LIKE, selfEvaluation._like.intValue());185 af.SetAppraisalVariable(NAME, OCCComponent.LIKE, selfEvaluation._like.intValue()); 186 186 } 187 187 } … … 270 270 271 271 @Override 272 public voidreappraisal(AgentModel am) {273 return ;272 public AppraisalFrame reappraisal(AgentModel am) { 273 return null; 274 274 } 275 275 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/parsers/AgentLoaderHandler.java
r756 r848 50 50 package FAtiMA.Core.util.parsers; 51 51 52 import java.util.ArrayList;53 54 52 import org.xml.sax.Attributes; 55 53 … … 64 62 import FAtiMA.Core.emotionalState.BaseEmotion; 65 63 import FAtiMA.Core.emotionalState.EmotionDisposition; 64 import FAtiMA.Core.emotionalState.EmotionType; 66 65 import FAtiMA.Core.emotionalState.EmotionalState; 67 66 import FAtiMA.Core.exceptions.InvalidEmotionTypeException; … … 72 71 import FAtiMA.Core.sensorEffector.Event; 73 72 import FAtiMA.Core.util.Constants; 74 import FAtiMA.Core.util.enumerables.EmotionType;75 73 import FAtiMA.Core.wellFormedNames.Name; 76 74 import FAtiMA.Core.wellFormedNames.Substitution; … … 117 115 public void ElicitingEmotion(Attributes attributes) throws InvalidEmotionTypeException { 118 116 String emotionName; 119 short type;120 117 Integer minIntensity; 118 121 119 122 120 emotionName = attributes.getValue("type"); 123 type = EmotionType.ParseType(emotionName);121 EmotionType type = new EmotionType(emotionName,null,(byte)0); 124 122 125 123 minIntensity = new Integer(attributes.getValue("minIntensity")); 126 _elicitingEmotion = new BaseEmotion(type,minIntensity.intValue(),n ew ArrayList<String>(),null,null);124 _elicitingEmotion = new BaseEmotion(type,minIntensity.intValue(),null); 127 125 _action.SetElicitingEmotion(_elicitingEmotion); 128 126 _reactiveLayer.getActionTendencies().AddAction(_action); … … 153 151 public void EmotionalThreshold(Attributes attributes) throws InvalidEmotionTypeException { 154 152 String emotionName; 155 short type; 156 153 157 154 emotionName = attributes.getValue("emotion"); 158 type = EmotionType.ParseType(emotionName);159 _emotionalState.AddEmotionDisposition(new EmotionDisposition( type,155 156 _emotionalState.AddEmotionDisposition(new EmotionDisposition(emotionName, 160 157 new Integer(attributes.getValue("threshold")).intValue(), 161 158 new Integer(attributes.getValue("decay")).intValue())); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/parsers/MemoryLoaderHandler.java
r833 r848 34 34 import org.xml.sax.Attributes; 35 35 36 import FAtiMA.Core.deliberativeLayer.goals.ActivePursuitGoal;37 import FAtiMA.Core.deliberativeLayer.goals.Goal;38 36 import FAtiMA.Core.emotionalState.BaseEmotion; 37 import FAtiMA.Core.emotionalState.EmotionType; 39 38 import FAtiMA.Core.memory.Memory; 40 39 import FAtiMA.Core.memory.episodicMemory.ActionDetail; 41 40 import FAtiMA.Core.memory.episodicMemory.AutobiographicalMemory; 42 import FAtiMA.Core.memory.episodicMemory.EpisodicMemory;43 41 import FAtiMA.Core.memory.episodicMemory.MemoryEpisode; 44 42 import FAtiMA.Core.memory.episodicMemory.ShortTermEpisodicMemory; 45 43 import FAtiMA.Core.memory.episodicMemory.Time; 46 44 import FAtiMA.Core.memory.semanticMemory.KnowledgeBase; 47 import FAtiMA.Core.memory.semanticMemory.KnowledgeSlot;48 45 import FAtiMA.Core.memory.semanticMemory.WorkingMemory; 49 import FAtiMA.Core.util.Constants;50 import FAtiMA.Core.util.enumerables.EventType;51 import FAtiMA.Core.wellFormedNames.Name;52 import FAtiMA.Core.wellFormedNames.Substitution;53 import FAtiMA.Core.wellFormedNames.Symbol;54 46 import FAtiMA.Core.sensorEffector.Event; 55 47 import FAtiMA.Core.sensorEffector.Parameter; 48 import FAtiMA.Core.wellFormedNames.Name; 56 49 57 50 public class MemoryLoaderHandler extends ReflectXMLHandler { … … 181 174 182 175 public void Emotion(Attributes attributes) { 183 Short type = Short.valueOf(attributes.getValue("type")); 176 String type = attributes.getValue("type"); 177 byte valence = Byte.parseByte(attributes.getValue("valence")); 184 178 Name direction = Name.ParseName(attributes.getValue("direction")); 185 String a ppraisalVariables= attributes.getValue("appraisalVariables");186 ArrayList<String> appraisalVariable = extractItems(appraisalVariables);179 String aux = attributes.getValue("appraisalVariables"); 180 String[] appraisalVariables = (String[]) extractItems(aux).toArray(); 187 181 float potential = Float.parseFloat(attributes.getValue("potential")); 188 182 189 _currentEmotion = new BaseEmotion( type, potential, appraisalVariable, null, direction);183 _currentEmotion = new BaseEmotion(new EmotionType(type,appraisalVariables,valence), potential, null, direction); 190 184 _currentAD.setEmotion(_currentEmotion); 191 185 -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/writers/MemoryWriter.java
r833 r848 32 32 import java.io.FileWriter; 33 33 import java.io.IOException; 34 import java.io.OutputStreamWriter;35 34 import java.io.Serializable; 36 import java.io.UnsupportedEncodingException;37 35 import java.io.Writer; 38 import java.util.ArrayList;39 import java.util.Iterator;40 import java.util.ListIterator;41 36 42 37 import org.znerd.xmlenc.LineBreak; 43 38 import org.znerd.xmlenc.XMLOutputter; 44 39 45 import FAtiMA.Core.emotionalState.BaseEmotion;46 40 import FAtiMA.Core.memory.Memory; 47 41 import FAtiMA.Core.memory.episodicMemory.ActionDetail; 48 42 import FAtiMA.Core.memory.episodicMemory.MemoryEpisode; 49 import FAtiMA.Core.memory.episodicMemory.Time;50 43 import FAtiMA.Core.memory.semanticMemory.KnowledgeSlot; 51 import FAtiMA.Core.sensorEffector.Event;52 44 import FAtiMA.Core.sensorEffector.Parameter; 53 import FAtiMA.Core.util.enumerables.EmotionType;54 45 import FAtiMA.Core.util.enumerables.EventType; 55 import FAtiMA.Core.wellFormedNames.Name;56 46 57 47 … … 210 200 { 211 201 _outputter.startTag("Emotion"); 212 _outputter.attribute("type", Short.toString(ad.getEmotion().GetType())); 202 _outputter.attribute("type", ad.getEmotion().getType().getName()); 203 _outputter.attribute("valence", Byte.toString(ad.getEmotion().getType().getValence())); 213 204 if(ad.getEmotion().GetDirection() != null) 214 205 _outputter.attribute("direction", ad.getEmotion().GetDirection().toString()); 215 if(ad.getEmotion(). GetAppraisalVariables() != null)216 _outputter.attribute("appraisalVariables", ad.getEmotion(). GetAppraisalVariables().toString()); //ArrayList206 if(ad.getEmotion().getType().getAppraisalVariables() != null) 207 _outputter.attribute("appraisalVariables", ad.getEmotion().getType().getAppraisalVariables().toString()); //ArrayList 217 208 _outputter.attribute("potential", Float.toString(ad.getEmotion().GetPotential())); 218 209
Note: See TracChangeset
for help on using the changeset viewer.