1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240 | package Torello.Java.JSON;
import Torello.Java.Function.IntIntTConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
class SETTINGS_REC_BUILDER
{
// ********************************************************************************************
// ********************************************************************************************
// All RJArr Classes producing **STREAM** styled SettingsRec instances
// ********************************************************************************************
// ********************************************************************************************
static <T, U> SettingsRec<T, U> createForStreams(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt,
final STREAM_BUILDER<T, U> sb
)
{
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
// For Streams, a new stream needs to be built each time
sb.acceptor,
sb.constructNewBuilder,
sb.runBuilderDotBuild,
// acceptor2: The "IntIntTConsumer" variant of an acceptor
null,
// The "CHANGEABLE_CONSUMER"
null,
// Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed)
null
);
}
// ********************************************************************************************
// ********************************************************************************************
// RJArr Classes that produce **CONSUMER** styled SettingsRec instances
// ********************************************************************************************
// ********************************************************************************************
// This Static-Builder will accept a Consumer<T>. This one does not allow for accepting the
// "Two Integer", JsonArray-Index & Java Object-Count. The Consumer that is provided here
// is deisnged to **ONLY** accept the User-Specified Type 'T' (It is a simple Consumer<T>)
static <T, U> SettingsRec<T, U> createForConsumers(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
final Consumer<T> acceptor,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt
)
{
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
acceptor, // The User-Provided Consumer (in this constructor)
() -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder;
() -> null, // UNUSED: final Supplier<U> runBuilderDotBuild;
// acceptor2: The "IntIntTConsumer" variant of an acceptor
null,
// The "CHANGEABLE_CONSUMER"
null,
// Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed)
null
);
}
// This consumer works with the IntIntTConsumer<T> kind of User-Provided Consumer.
static <T, U> SettingsRec<T, U> createForIIConsumers(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
final IntIntTConsumer<T> acceptor2,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt
)
{
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
null, // The User-Provided Consumer (in this constructor)
() -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder;
() -> null, // UNUSED: final Supplier<U> runBuilderDotBuild;
// acceptor2: The "IntIntTConsumer" variant of an acceptor
acceptor2,
// The "CHANGEABLE_CONSUMER"
null,
// Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed)
null
);
}
// ********************************************************************************************
// ********************************************************************************************
// RJArr Classes that produce **CONSUMER** styled SettingsRec instances
// ********************************************************************************************
// ********************************************************************************************
// This Static-Builder will accept a Consumer<T>. This one does not allow for accepting the
// "Two Integer", JsonArray-Index & Java Object-Count. The Consumer that is provided here
// is deisnged to **ONLY** accept the User-Specified Type 'T' (It is a simple Consumer<T>)
static <T, U> SettingsRec<T, U> createForConsumers(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt
)
{
final CHANGEABLE_CONSUMER<T> cc = new CHANGEABLE_CONSUMER<>(true /* ==> Mode V1 */);
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
cc.wrappedAcceptorV1, // acceptor, The User-Provided Consumer
() -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder;
() -> null, // UNUSED: final Supplier<U> runBuilderDotBuild;
// acceptor2: The "IntIntTConsumer" variant of an acceptor
null,
// The "CHANGEABLE_CONSUMER"
cc,
// Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed)
null
);
}
// This consumer works with the IntIntTConsumer<T> kind of User-Provided Consumer.
static <T, U> SettingsRec<T, U> createForIIConsumers(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt
)
{
final CHANGEABLE_CONSUMER<T> cc = new CHANGEABLE_CONSUMER<>(false /* ==> Mode V2 */);
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
null, // The User-Provided Consumer (in this constructor)
() -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder;
() -> null, // UNUSED: final Supplier<U> runBuilderDotBuild;
// acceptor2: The "IntIntTConsumer" variant of an acceptor
cc.wrappedAcceptorV2, // acceptor2,
// The "CHANGEABLE_CONSUMER"
cc,
// Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed)
null
);
}
// ********************************************************************************************
// ********************************************************************************************
// RJArr Classes that produce **ARRAYS** styled SettingsRec instances
// ********************************************************************************************
// ********************************************************************************************
static <T, U> SettingsRec<T, U> createForDimNArrays(
// Passed by the user in the initial method invocation
final T defaultValue,
final int FLAGS,
final Function<String, T> userParser,
// computed configurations, determined by the requested type
final BASIC_TYPES<T> bt,
final STREAM_BUILDER<T, U> sb,
// Specialized Constructor used by the Multi-Dimensional Array-Builder Class
final boolean arrayGen1DRefOrPrimitive
)
{
return new SettingsRec<>(
// The Basics
defaultValue, FLAGS, userParser, bt,
// For Streams, a new stream needs to be built each time
sb.acceptor,
sb.constructNewBuilder,
sb.runBuilderDotBuild,
// acceptor2: The "IntIntTConsumer" variant of an acceptor
null,
// The "CHANGEABLE_CONSUMER"
null,
// This constructor is used by the Multi-Dimensional Array Class
arrayGen1DRefOrPrimitive
);
}
}
|