TriggerVarRel.cpp
Go to the documentation of this file.
00001 #include "TriggerVarRel.h"
00002 
00003 
00004 TriggerVarRel::TriggerVarRel(SharedPointer<IVariable> destVar, SharedPointer<IVariable> triggerVar, SharedPointer<IVariableValue> triggerValue, SharedPointer<IVariableValue> destTriggerValueValue, SharedPointer<IVariableValue> destNonTriggerValue)
00005 {
00006         this->destVar = destVar;
00007         this->triggerVar = triggerVar;
00008         this->triggerValue = triggerValue;
00009         this->destTriggerValueValue = destTriggerValueValue;
00010         this->destNonTriggerValue = destNonTriggerValue;
00011         this->addSourceVar(triggerVar);
00012         this->setDestVariable(destVar);
00013 }
00014 
00015 TriggerVarRel::~TriggerVarRel(void)
00016 {
00017 }
00018 
00019 vector<SharedPointer<RelEntry> > TriggerVarRel::getProb(map<string, SharedPointer<IVariableValue> > sourceVals)
00020 {
00021         vector<SharedPointer<RelEntry> > result;
00022 
00023     SharedPointer<RelEntry> newEntry (new RelEntry());
00024         SharedPointer<IVariableValue> srcValue = sourceVals[triggerVar->getVariableName()];
00025         //newEntry->sourceValues[triggerVar->getVariableName()] = srcValue;
00026 
00027         if(srcValue->equals(triggerValue))
00028     {
00029                 newEntry->destValues[destVar->getVariableName()] = destTriggerValueValue;
00030     }
00031     else
00032     {
00033        newEntry->destValues[destVar->getVariableName()] = destNonTriggerValue;
00034     }
00035     newEntry->prob = 1.0;
00036         result.push_back(newEntry);
00037 
00038     return result;
00039 
00040 }


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29