dynrules

Rule.cpp

00001 /*
00002  * dynrules - Python dynamic rules engine
00003  *
00004  * Authors: Marcus von Appen
00005  *
00006  * This file is distributed under the Public Domain.
00007  */
00008 
00009 #include <iostream>
00010 #include "Rule.h"
00011 
00012 namespace dynrules
00013 {
00014 Rule::Rule () :
00015     _id(0),
00016     _weight(0.f),
00017     _used(false),
00018     _code("")
00019 {
00020 }
00021 
00022 Rule::Rule (int id) :
00023     _id(id),
00024     _weight(0.f),
00025     _used(false),
00026     _code("")
00027 {
00028 }
00029 
00030 Rule::Rule (int id, std::string code) :
00031     _id(id),
00032     _weight(0.f),
00033     _used(false),
00034     _code(code)
00035 {
00036 }
00037 
00038 Rule::Rule (int id, double weight) :
00039     _id(id),
00040     _weight(weight),
00041     _used(false),
00042     _code("")
00043 {
00044 }
00045 
00046 Rule::Rule (int id, std::string code, double weight) :
00047     _id(id),
00048     _weight(weight),
00049     _used(false),
00050     _code(code)
00051 {
00052 }
00053 
00054 Rule::~Rule ()
00055 {
00056 }
00057 
00058 double Rule::getWeight () const
00059 {
00060     return this->_weight;
00061 }
00062 
00063 void Rule::setWeight (double weight)
00064 {
00065     this->_weight = weight;
00066 }
00067     
00068 bool Rule::getUsed () const
00069 {
00070     return this->_used;
00071 }
00072 
00073 void Rule::setUsed (bool used)
00074 {
00075     this->_used = used;
00076 }
00077 
00078 int Rule::getId () const
00079 {
00080     return _id;
00081 }
00082 
00083 void Rule::setId (int id)
00084 {
00085     this->_id = id;
00086 }
00087 
00088 std::string Rule::getCode () const
00089 {
00090     return this->_code;
00091 }
00092 
00093 void Rule::setCode (const std::string& code)
00094 {
00095     this->_code = code;
00096 }
00097 
00098 bool Rule::operator ==(const Rule& rule)
00099 {
00100     return _id == rule._id;
00101 }
00102 
00103 bool operator ==(const Rule& a, const Rule& b)
00104 {
00105     return a.getId() == b.getId();
00106 }
00107 
00108 } // namespace
 All Classes Functions Variables