23
23
/**
24
24
* @author peng-yongsheng
25
25
*/
26
- public abstract class Window <WindowCollection extends Collection > {
26
+ public abstract class Window <WINDOW_COLLECTION extends Collection > {
27
27
28
28
private AtomicInteger windowSwitch = new AtomicInteger (0 );
29
29
30
- private WindowCollection pointer ;
30
+ private WINDOW_COLLECTION pointer ;
31
31
32
- private WindowCollection windowDataA ;
33
- private WindowCollection windowDataB ;
32
+ private WINDOW_COLLECTION windowDataA ;
33
+ private WINDOW_COLLECTION windowDataB ;
34
34
35
35
protected Window () {
36
36
this .windowDataA = collectionInstance ();
37
37
this .windowDataB = collectionInstance ();
38
38
this .pointer = windowDataA ;
39
39
}
40
40
41
- public abstract WindowCollection collectionInstance ();
41
+ public abstract WINDOW_COLLECTION collectionInstance ();
42
42
43
43
public boolean trySwitchPointer () {
44
44
return windowSwitch .incrementAndGet () == 1 && !getLast ().isReading ();
@@ -57,7 +57,7 @@ public void switchPointer() {
57
57
getLast ().reading ();
58
58
}
59
59
60
- protected WindowCollection getCurrentAndWriting () {
60
+ protected WINDOW_COLLECTION getCurrentAndWriting () {
61
61
if (pointer == windowDataA ) {
62
62
windowDataA .writing ();
63
63
return windowDataA ;
@@ -67,11 +67,11 @@ protected WindowCollection getCurrentAndWriting() {
67
67
}
68
68
}
69
69
70
- protected WindowCollection getCurrent () {
70
+ protected WINDOW_COLLECTION getCurrent () {
71
71
return pointer ;
72
72
}
73
73
74
- public WindowCollection getLast () {
74
+ public WINDOW_COLLECTION getLast () {
75
75
if (pointer == windowDataA ) {
76
76
return windowDataB ;
77
77
} else {
0 commit comments