1 | <?php |
||
19 | final class Score |
||
20 | { |
||
21 | /** |
||
22 | * @var float The scaled score (a number between -1 and 1) |
||
23 | */ |
||
24 | private $scaled; |
||
25 | |||
26 | /** |
||
27 | * @var float The Agent's score (a number between min and max) |
||
28 | */ |
||
29 | private $raw; |
||
30 | |||
31 | /** |
||
32 | * @var float The minimum score being possible |
||
33 | */ |
||
34 | private $min; |
||
35 | |||
36 | /** |
||
37 | * @var float The maximum score being possible |
||
38 | */ |
||
39 | private $max; |
||
40 | |||
41 | /** |
||
42 | * @param float $scaled |
||
43 | * @param float $raw |
||
44 | * @param float $min |
||
45 | * @param float $max |
||
46 | */ |
||
47 | public function __construct($scaled = null, $raw = null, $min = null, $max = null) |
||
48 | { |
||
49 | $this->scaled = $scaled; |
||
50 | $this->raw = $raw; |
||
51 | $this->min = $min; |
||
52 | $this->max = $max; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param float $scaled |
||
57 | * |
||
58 | * @return Score |
||
59 | */ |
||
60 | public function withScaled($scaled) |
||
67 | |||
68 | /** |
||
69 | * @param float $raw |
||
70 | * |
||
71 | * @return Score |
||
72 | */ |
||
73 | public function withRaw($raw) |
||
80 | |||
81 | /** |
||
82 | * @param float $min |
||
83 | * |
||
84 | * @return Score |
||
85 | */ |
||
86 | public function withMin($min) |
||
93 | |||
94 | /** |
||
95 | * @param float $max |
||
96 | * |
||
97 | * @return Score |
||
98 | */ |
||
99 | public function withMax($max) |
||
106 | |||
107 | /** |
||
108 | * Returns the Agent's scaled score (a number between -1 and 1). |
||
109 | * |
||
110 | * @return float The scaled score |
||
111 | */ |
||
112 | public function getScaled() |
||
116 | |||
117 | /** |
||
118 | * Returns the Agent's score. |
||
119 | * |
||
120 | * @return float The score |
||
121 | */ |
||
122 | public function getRaw() |
||
126 | |||
127 | /** |
||
128 | * Returns the lowest possible score. |
||
129 | * |
||
130 | * @return float The lowest possible score |
||
131 | */ |
||
132 | public function getMin() |
||
136 | |||
137 | /** |
||
138 | * Returns the highest possible score. |
||
139 | * |
||
140 | * @return float The highest possible score |
||
141 | */ |
||
142 | public function getMax() |
||
146 | |||
147 | /** |
||
148 | * Checks if another score is equal. |
||
149 | * |
||
150 | * Two scores are equal if and only if all of their properties are equal. |
||
151 | * |
||
152 | * @param Score $score The score to compare with |
||
153 | * |
||
154 | * @return bool True if the scores are equal, false otherwise |
||
155 | */ |
||
156 | public function equals(Score $score) |
||
192 | } |
||
193 |