dynrules
 All Classes Functions Variables
Rule.cpp
1 /*
2  * dynrules - Python dynamic rules engine
3  *
4  * Authors: Marcus von Appen
5  *
6  * This file is distributed under the Public Domain.
7  */
8 
9 #include <iostream>
10 #include "Rule.h"
11 
12 namespace dynrules
13 {
15  _id(0),
16  _weight(0.f),
17  _used(false),
18  _code("")
19 {
20 }
21 
22 Rule::Rule (int id) :
23  _id(id),
24  _weight(0.f),
25  _used(false),
26  _code("")
27 {
28 }
29 
30 Rule::Rule (int id, std::string code) :
31  _id(id),
32  _weight(0.f),
33  _used(false),
34  _code(code)
35 {
36 }
37 
38 Rule::Rule (int id, double weight) :
39  _id(id),
40  _weight(weight),
41  _used(false),
42  _code("")
43 {
44 }
45 
46 Rule::Rule (int id, std::string code, double weight) :
47  _id(id),
48  _weight(weight),
49  _used(false),
50  _code(code)
51 {
52 }
53 
55 {
56 }
57 
58 double Rule::getWeight () const
59 {
60  return this->_weight;
61 }
62 
63 void Rule::setWeight (double weight)
64 {
65  this->_weight = weight;
66 }
67 
68 bool Rule::getUsed () const
69 {
70  return this->_used;
71 }
72 
73 void Rule::setUsed (bool used)
74 {
75  this->_used = used;
76 }
77 
78 int Rule::getId () const
79 {
80  return _id;
81 }
82 
83 void Rule::setId (int id)
84 {
85  this->_id = id;
86 }
87 
88 std::string Rule::getCode () const
89 {
90  return this->_code;
91 }
92 
93 void Rule::setCode (const std::string& code)
94 {
95  this->_code = code;
96 }
97 
98 bool Rule::operator ==(const Rule& rule)
99 {
100  return _id == rule._id;
101 }
102 
103 bool operator ==(const Rule& a, const Rule& b)
104 {
105  return a.getId() == b.getId();
106 }
107 
108 } // namespace