@@ -39,7 +39,7 @@ public StateAccessImpl(
3939 }
4040
4141 @ Override
42- public final <T > State <T > state (T initialValue ) {
42+ public <T > State <T > state (T initialValue ) {
4343 final long id = State .next ();
4444 final StateValueFactory factory = (host , state ) -> new ImmutableValue (state , initialValue );
4545 final State <T > state = new BaseState <>(id , factory );
@@ -49,7 +49,7 @@ public final <T> State<T> state(T initialValue) {
4949 }
5050
5151 @ Override
52- public final <T > MutableState <T > mutableState (T initialValue ) {
52+ public <T > MutableState <T > mutableState (T initialValue ) {
5353 final long id = State .next ();
5454 final StateValueFactory factory = (host , state ) -> new MutableValue (state , initialValue );
5555 final MutableState <T > state = new MutableGenericStateImpl <>(id , factory );
@@ -59,7 +59,7 @@ public final <T> MutableState<T> mutableState(T initialValue) {
5959 }
6060
6161 @ Override
62- public final MutableIntState mutableState (int initialValue ) {
62+ public MutableIntState mutableState (int initialValue ) {
6363 final long id = State .next ();
6464 final StateValueFactory factory = (host , state ) -> new MutableValue (state , initialValue );
6565 final MutableIntState state = new MutableIntStateImpl (id , factory );
@@ -69,7 +69,7 @@ public final MutableIntState mutableState(int initialValue) {
6969 }
7070
7171 @ Override
72- public final <T > State <T > computedState (@ NotNull Function <Context , T > computation ) {
72+ public <T > State <T > computedState (@ NotNull Function <Context , T > computation ) {
7373 final long id = State .next ();
7474 @ SuppressWarnings ("unchecked" )
7575 final StateValueFactory factory =
@@ -81,7 +81,7 @@ public final <T> State<T> computedState(@NotNull Function<Context, T> computatio
8181 }
8282
8383 @ Override
84- public final <T > State <T > computedState (@ NotNull Supplier <T > computation ) {
84+ public <T > State <T > computedState (@ NotNull Supplier <T > computation ) {
8585 final long id = State .next ();
8686 final StateValueFactory factory = (host , state ) -> new ComputedValue (state , computation );
8787 final State <T > state = new BaseState <>(id , factory );
@@ -91,7 +91,7 @@ public final <T> State<T> computedState(@NotNull Supplier<T> computation) {
9191 }
9292
9393 @ Override
94- public final <T > State <T > lazyState (@ NotNull Function <Context , T > computation ) {
94+ public <T > State <T > lazyState (@ NotNull Function <Context , T > computation ) {
9595 final long id = State .next ();
9696 @ SuppressWarnings ("unchecked" )
9797 final StateValueFactory factory =
@@ -103,7 +103,7 @@ public final <T> State<T> lazyState(@NotNull Function<Context, T> computation) {
103103 }
104104
105105 @ Override
106- public final <T > State <T > lazyState (@ NotNull Supplier <T > computation ) {
106+ public <T > State <T > lazyState (@ NotNull Supplier <T > computation ) {
107107 final long id = State .next ();
108108 final StateValueFactory factory = (host , state ) -> new LazyValue (state , computation );
109109 final State <T > state = new BaseState <>(id , factory );
@@ -114,13 +114,13 @@ public final <T> State<T> lazyState(@NotNull Supplier<T> computation) {
114114
115115 @ SuppressWarnings ("DataFlowIssue" )
116116 @ Override
117- public final <T > MutableState <T > initialState () {
117+ public <T > MutableState <T > initialState () {
118118 return initialState (null );
119119 }
120120
121121 @ SuppressWarnings ("NullableProblems" )
122122 @ Override
123- public final <T > MutableState <T > initialState (@ NotNull String key ) {
123+ public <T > MutableState <T > initialState (@ NotNull String key ) {
124124 final long id = State .next ();
125125 final MutableState <T > state =
126126 new BaseMutableState <>(id , (host , valueState ) -> new InitialDataStateValue (valueState , host , key ));
@@ -130,7 +130,14 @@ public final <T> MutableState<T> initialState(@NotNull String key) {
130130 }
131131
132132 @ Override
133- public final <T > State <Pagination > paginationState (
133+ public TimerState timerState (long intervalInTicks ) {
134+ final TimerState state = elementFactory .createTimerState (State .next (), intervalInTicks );
135+ this .stateRegistry .registerState (state , this );
136+ return state ;
137+ }
138+
139+ @ Override
140+ public <T > State <Pagination > paginationState (
134141 @ NotNull List <? super T > sourceProvider ,
135142 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > elementConsumer ) {
136143 return this .<T >buildPaginationState (sourceProvider )
@@ -139,7 +146,7 @@ public final <T> State<Pagination> paginationState(
139146 }
140147
141148 @ Override
142- public final <T > State <Pagination > computedPaginationState (
149+ public <T > State <Pagination > computedPaginationState (
143150 @ NotNull Function <Context , List <? super T >> sourceProvider ,
144151 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
145152 return this .buildComputedPaginationState (sourceProvider )
@@ -148,7 +155,7 @@ public final <T> State<Pagination> computedPaginationState(
148155 }
149156
150157 @ Override
151- public final <T > State <Pagination > computedAsyncPaginationState (
158+ public <T > State <Pagination > computedAsyncPaginationState (
152159 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ,
153160 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
154161 return this .buildComputedAsyncPaginationState (sourceProvider )
@@ -157,7 +164,7 @@ public final <T> State<Pagination> computedAsyncPaginationState(
157164 }
158165
159166 @ Override
160- public final <T > State <Pagination > lazyPaginationState (
167+ public <T > State <Pagination > lazyPaginationState (
161168 @ NotNull Function <Context , List <? super T >> sourceProvider ,
162169 @ NotNull PaginationValueConsumer <Context , ItemBuilder , T > valueConsumer ) {
163170 return this .buildLazyPaginationState (sourceProvider )
@@ -184,48 +191,48 @@ public <T> State<Pagination> lazyAsyncPaginationState(
184191 }
185192
186193 @ Override
187- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildPaginationState (
194+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildPaginationState (
188195 @ NotNull List <? super T > sourceProvider ) {
189196 return new PaginationStateBuilder <>(
190197 elementFactoryProvider , sourceProvider , this ::createPaginationState , false , false );
191198 }
192199
193200 @ Override
194- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedPaginationState (
201+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedPaginationState (
195202 @ NotNull Function <Context , List <? super T >> sourceProvider ) {
196203 return new PaginationStateBuilder <>(
197204 elementFactoryProvider , sourceProvider , this ::createPaginationState , false , true );
198205 }
199206
200207 @ Override
201- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedAsyncPaginationState (
208+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildComputedAsyncPaginationState (
202209 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ) {
203210 return new PaginationStateBuilder <>(
204211 elementFactoryProvider , sourceProvider , this ::createPaginationState , true , true );
205212 }
206213
207214 @ Override
208- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
215+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
209216 @ NotNull Supplier <List <? super T >> sourceProvider ) {
210217 return new PaginationStateBuilder <>(
211218 elementFactoryProvider , sourceProvider , this ::createPaginationState , false , false );
212219 }
213220
214221 @ Override
215- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
222+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyPaginationState (
216223 @ NotNull Function <Context , List <? super T >> sourceProvider ) {
217224 return new PaginationStateBuilder <>(
218225 elementFactoryProvider , sourceProvider , this ::createPaginationState , false , false );
219226 }
220227
221228 @ Override
222- public final <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyAsyncPaginationState (
229+ public <T > PaginationStateBuilder <Context , ItemBuilder , T > buildLazyAsyncPaginationState (
223230 @ NotNull Function <Context , CompletableFuture <List <T >>> sourceProvider ) {
224231 return new PaginationStateBuilder <>(
225232 elementFactoryProvider , sourceProvider , this ::createPaginationState , true , false );
226233 }
227234
228- protected final <V > State <Pagination > createPaginationState (
235+ private <V > State <Pagination > createPaginationState (
229236 @ NotNull PaginationStateBuilder <Context , ItemBuilder , V > builder ) {
230237 final long id = State .next ();
231238 @ SuppressWarnings ({"unchecked" , "rawtypes" })
0 commit comments