@@ -38,7 +38,7 @@ public StateAccessImpl(Object caller, ElementFactory elementFactory, StateRegist
3838 }
3939
4040 @ Override
41- public final <T > State <T > state (T initialValue ) {
41+ public <T > State <T > state (T initialValue ) {
4242 final long id = State .next ();
4343 final StateValueFactory factory = (host , state ) -> new ImmutableValue (state , initialValue );
4444 final State <T > state = new BaseState <>(id , factory );
@@ -48,7 +48,7 @@ public final <T> State<T> state(T initialValue) {
4848 }
4949
5050 @ Override
51- public final <T > MutableState <T > mutableState (T initialValue ) {
51+ public <T > MutableState <T > mutableState (T initialValue ) {
5252 final long id = State .next ();
5353 final StateValueFactory factory = (host , state ) -> new MutableValue (state , initialValue );
5454 final MutableState <T > state = new MutableGenericStateImpl <>(id , factory );
@@ -58,7 +58,7 @@ public final <T> MutableState<T> mutableState(T initialValue) {
5858 }
5959
6060 @ Override
61- public final MutableIntState mutableState (int initialValue ) {
61+ public MutableIntState mutableState (int initialValue ) {
6262 final long id = State .next ();
6363 final StateValueFactory factory = (host , state ) -> new MutableValue (state , initialValue );
6464 final MutableIntState state = new MutableIntStateImpl (id , factory );
@@ -68,7 +68,7 @@ public final MutableIntState mutableState(int initialValue) {
6868 }
6969
7070 @ Override
71- public final <T > State <T > computedState (@ NotNull Function <Context , T > computation ) {
71+ public <T > State <T > computedState (@ NotNull Function <Context , T > computation ) {
7272 final long id = State .next ();
7373 @ SuppressWarnings ("unchecked" )
7474 final StateValueFactory factory =
@@ -80,7 +80,7 @@ public final <T> State<T> computedState(@NotNull Function<Context, T> computatio
8080 }
8181
8282 @ Override
83- public final <T > State <T > computedState (@ NotNull Supplier <T > computation ) {
83+ public <T > State <T > computedState (@ NotNull Supplier <T > computation ) {
8484 final long id = State .next ();
8585 final StateValueFactory factory = (host , state ) -> new ComputedValue (state , computation );
8686 final State <T > state = new BaseState <>(id , factory );
@@ -90,7 +90,7 @@ public final <T> State<T> computedState(@NotNull Supplier<T> computation) {
9090 }
9191
9292 @ Override
93- public final <T > State <T > lazyState (@ NotNull Function <Context , T > computation ) {
93+ public <T > State <T > lazyState (@ NotNull Function <Context , T > computation ) {
9494 final long id = State .next ();
9595 @ SuppressWarnings ("unchecked" )
9696 final StateValueFactory factory =
@@ -102,7 +102,7 @@ public final <T> State<T> lazyState(@NotNull Function<Context, T> computation) {
102102 }
103103
104104 @ Override
105- public final <T > State <T > lazyState (@ NotNull Supplier <T > computation ) {
105+ public <T > State <T > lazyState (@ NotNull Supplier <T > computation ) {
106106 final long id = State .next ();
107107 final StateValueFactory factory = (host , state ) -> new LazyValue (state , computation );
108108 final State <T > state = new BaseState <>(id , factory );
@@ -113,13 +113,13 @@ public final <T> State<T> lazyState(@NotNull Supplier<T> computation) {
113113
114114 @ SuppressWarnings ("DataFlowIssue" )
115115 @ Override
116- public final <T > MutableState <T > initialState () {
116+ public <T > MutableState <T > initialState () {
117117 return initialState (null );
118118 }
119119
120120 @ SuppressWarnings ("NullableProblems" )
121121 @ Override
122- public final <T > MutableState <T > initialState (@ NotNull String key ) {
122+ public <T > MutableState <T > initialState (@ NotNull String key ) {
123123 final long id = State .next ();
124124 final MutableState <T > state =
125125 new BaseMutableState <>(id , (host , valueState ) -> new InitialDataStateValue (valueState , host , key ));
@@ -129,7 +129,14 @@ public final <T> MutableState<T> initialState(@NotNull String key) {
129129 }
130130
131131 @ Override
132- public final <T > State <Pagination > paginationState (
132+ public TimerState timerState (long intervalInTicks ) {
133+ final TimerState state = elementFactory .createTimerState (State .next (), intervalInTicks );
134+ this .stateRegistry .registerState (state , this );
135+ return state ;
136+ }
137+
138+ @ Override
139+ public <T > State <Pagination > paginationState (
133140 @ NotNull List <? super T > sourceProvider ,
134141 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > elementConsumer ) {
135142 return this .<T >buildPaginationState (sourceProvider )
@@ -138,7 +145,7 @@ public final <T> State<Pagination> paginationState(
138145 }
139146
140147 @ Override
141- public final <T > State <Pagination > computedPaginationState (
148+ public <T > State <Pagination > computedPaginationState (
142149 @ NotNull Function <Context , List <? super T >> sourceProvider ,
143150 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
144151 return this .buildComputedPaginationState (sourceProvider )
@@ -147,7 +154,7 @@ public final <T> State<Pagination> computedPaginationState(
147154 }
148155
149156 @ Override
150- public final <T > State <Pagination > computedAsyncPaginationState (
157+ public <T > State <Pagination > computedAsyncPaginationState (
151158 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ,
152159 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
153160 return this .buildComputedAsyncPaginationState (sourceProvider )
@@ -156,7 +163,7 @@ public final <T> State<Pagination> computedAsyncPaginationState(
156163 }
157164
158165 @ Override
159- public final <T > State <Pagination > lazyPaginationState (
166+ public <T > State <Pagination > lazyPaginationState (
160167 @ NotNull Function <Context , List <? super T >> sourceProvider ,
161168 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
162169 return this .buildLazyPaginationState (sourceProvider )
@@ -183,48 +190,48 @@ public <T> State<Pagination> lazyAsyncPaginationState(
183190 }
184191
185192 @ Override
186- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildPaginationState (
193+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildPaginationState (
187194 @ NotNull List <? super T > sourceProvider ) {
188195 return new PaginationStateBuilder <>(
189196 this .elementFactory , sourceProvider , this ::createPaginationState , false , false );
190197 }
191198
192199 @ Override
193- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedPaginationState (
200+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedPaginationState (
194201 @ NotNull Function <Context , List <? super T >> sourceProvider ) {
195202 return new PaginationStateBuilder <>(
196203 this .elementFactory , sourceProvider , this ::createPaginationState , false , true );
197204 }
198205
199206 @ Override
200- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedAsyncPaginationState (
207+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedAsyncPaginationState (
201208 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ) {
202209 return new PaginationStateBuilder <>(
203210 this .elementFactory , sourceProvider , this ::createPaginationState , true , true );
204211 }
205212
206213 @ Override
207- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
214+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
208215 @ NotNull Supplier <List <? super T >> sourceProvider ) {
209216 return new PaginationStateBuilder <>(
210217 this .elementFactory , sourceProvider , this ::createPaginationState , false , false );
211218 }
212219
213220 @ Override
214- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
221+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
215222 @ NotNull Function <Context , List <? super T >> sourceProvider ) {
216223 return new PaginationStateBuilder <>(
217224 this .elementFactory , sourceProvider , this ::createPaginationState , false , false );
218225 }
219226
220227 @ Override
221- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyAsyncPaginationState (
228+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyAsyncPaginationState (
222229 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ) {
223230 return new PaginationStateBuilder <>(
224231 this .elementFactory , sourceProvider , this ::createPaginationState , true , false );
225232 }
226233
227- protected final <V > State <Pagination > createPaginationState (
234+ private <V > State <Pagination > createPaginationState (
228235 @ NotNull PaginationStateBuilder <Context , ItemBuilder , V > builder ) {
229236 final long id = State .next ();
230237 @ SuppressWarnings ({"unchecked" , "rawtypes" })
0 commit comments