@@ -14,7 +14,7 @@ using ..Responses: BareResponses, Response, Responses
1414using .. NextItemRules: compute_criteria, best_item
1515using .. Sim: CatLoop, Sim, item_label
1616
17- export StatefulCat, StatefulCatConfig
17+ export StatefulCat, StatefulCatRules
1818public next_item, ranked_items, item_criteria
1919public add_response!, rollback!, reset!, get_responses, get_ability
2020
@@ -190,26 +190,28 @@ $(TYPEDSIGNATURES)
190190This is a the `StatefulCat` implementation in terms of `CatRules`.
191191It is also the de-facto standard for the behavior of the interface.
192192"""
193- struct StatefulCatConfig {TrackedResponsesT <: TrackedResponses } <: StatefulCat
193+ struct StatefulCatRules {TrackedResponsesT <: TrackedResponses } <: StatefulCat
194194 rules:: CatRules
195195 tracked_responses:: Ref{TrackedResponsesT}
196196end
197197
198- function StatefulCatConfig (rules:: CatRules , item_bank:: AbstractItemBank )
198+ function StatefulCatRules (rules:: CatRules , item_bank:: AbstractItemBank )
199199 bare_responses = BareResponses (ResponseType (item_bank))
200200 tracked_responses = TrackedResponses (
201201 bare_responses,
202202 item_bank,
203203 rules. ability_tracker
204204 )
205- return StatefulCatConfig (rules, Ref (tracked_responses))
205+ return StatefulCatRules (rules, Ref (tracked_responses))
206206end
207207
208- function next_item (config:: StatefulCatConfig )
208+ StatefulCat (rules:: CatRules , item_bank:: AbstractItemBank ) = StatefulCatRules (rules, item_bank)
209+
210+ function next_item (config:: StatefulCatRules )
209211 return best_item (config. rules. next_item, config. tracked_responses[])
210212end
211213
212- function ranked_items (config:: StatefulCatConfig )
214+ function ranked_items (config:: StatefulCatRules )
213215 criteria = compute_criteria (
214216 config. rules. next_item, config. tracked_responses[])
215217 if criteria === nothing
@@ -218,27 +220,27 @@ function ranked_items(config::StatefulCatConfig)
218220 return sortperm (criteria)
219221end
220222
221- function item_criteria (config:: StatefulCatConfig )
223+ function item_criteria (config:: StatefulCatRules )
222224 return compute_criteria (
223225 config. rules. next_item, config. tracked_responses[])
224226end
225227
226- function add_response! (config:: StatefulCatConfig , index, response)
228+ function add_response! (config:: StatefulCatRules , index, response)
227229 tracked_responses = config. tracked_responses[]
228230 Responses. add_response! (
229231 tracked_responses, Response (
230232 ResponseType (tracked_responses. item_bank), index, response))
231233end
232234
233- function rollback! (config:: StatefulCatConfig )
235+ function rollback! (config:: StatefulCatRules )
234236 Responses. pop_response! (config. tracked_responses[])
235237end
236238
237- function reset! (config:: StatefulCatConfig )
239+ function reset! (config:: StatefulCatRules )
238240 empty! (config. tracked_responses[])
239241end
240242
241- function set_item_bank! (config:: StatefulCatConfig , item_bank)
243+ function set_item_bank! (config:: StatefulCatRules , item_bank)
242244 bare_responses = BareResponses (ResponseType (item_bank))
243245 config. tracked_responses[] = TrackedResponses (
244246 bare_responses,
@@ -247,23 +249,23 @@ function set_item_bank!(config::StatefulCatConfig, item_bank)
247249 )
248250end
249251
250- function get_responses (config:: StatefulCatConfig )
252+ function get_responses (config:: StatefulCatRules )
251253 return config. tracked_responses[]. responses
252254end
253255
254- function get_ability (config:: StatefulCatConfig )
256+ function get_ability (config:: StatefulCatRules )
255257 return (config. rules. ability_estimator (config. tracked_responses[]), nothing )
256258end
257259
258- function likelihood (config:: StatefulCatConfig , ability)
260+ function likelihood (config:: StatefulCatRules , ability)
259261 pdf (distribution_estimator (config. rules. ability_estimator), config. tracked_responses[], ability)
260262end
261263
262- function item_bank_size (config:: StatefulCatConfig )
264+ function item_bank_size (config:: StatefulCatRules )
263265 return length (config. tracked_responses[]. item_bank)
264266end
265267
266- function item_response_functions (config:: StatefulCatConfig , index, ability)
268+ function item_response_functions (config:: StatefulCatRules , index, ability)
267269 item_bank = config. tracked_responses[]. item_bank
268270 item_response = ItemResponse (item_bank, index)
269271 return resp_vec (item_response, ability)
0 commit comments