subtr_actor/stats/analysis_graph/nodes/
double_tap.rs1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5pub struct DoubleTapNode {
6 calculator: DoubleTapCalculator,
7}
8
9impl DoubleTapNode {
10 pub fn new() -> Self {
11 Self {
12 calculator: DoubleTapCalculator::new(),
13 }
14 }
15}
16
17impl Default for DoubleTapNode {
18 fn default() -> Self {
19 Self::new()
20 }
21}
22
23impl AnalysisNode for DoubleTapNode {
24 type State = DoubleTapCalculator;
25
26 fn name(&self) -> &'static str {
27 "double_tap"
28 }
29
30 fn dependencies(&self) -> NodeDependencies {
31 vec![
32 frame_info_dependency(),
33 ball_frame_state_dependency(),
34 player_frame_state_dependency(),
35 touch_state_dependency(),
36 backboard_bounce_state_dependency(),
37 live_play_dependency(),
38 ]
39 }
40
41 fn evaluate(&mut self, ctx: &AnalysisStateContext<'_>) -> SubtrActorResult<()> {
42 self.calculator.update(
43 ctx.get::<FrameInfo>()?,
44 ctx.get::<BallFrameState>()?,
45 ctx.get::<PlayerFrameState>()?,
46 ctx.get::<TouchState>()?,
47 ctx.get::<BackboardBounceState>()?,
48 ctx.get::<LivePlayState>()?,
49 )
50 }
51
52 fn state(&self) -> &Self::State {
53 &self.calculator
54 }
55}
56
57pub(crate) fn boxed_default() -> Box<dyn AnalysisNodeDyn> {
58 Box::new(DoubleTapNode::new())
59}