1
2
3
4
5
6 package io.github.olyutorskii.aletojio.idling;
7
8
9
10
11 public abstract class AbstractRndMonitor implements RndMonitor {
12
13 private boolean meet = false;
14
15
16
17
18
19 protected AbstractRndMonitor() {
20 super();
21 return;
22 }
23
24
25
26
27
28 @Override
29 public void reset() {
30 this.meet = false;
31 resetImpl();
32 return;
33 }
34
35
36
37
38 protected abstract void resetImpl();
39
40
41
42
43
44
45
46 @Override
47 public boolean probe(int iVal) {
48 if (this.meet) {
49 return true;
50 }
51
52 if (probeImpl(iVal)) {
53 this.meet = true;
54 }
55
56 return this.meet;
57 }
58
59
60
61
62
63
64
65 protected abstract boolean probeImpl(int iVal);
66
67
68
69
70
71
72 @Override
73 public boolean hasMet() {
74 return this.meet;
75 }
76
77 }