1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.hipparchus.migration;
23
24 import java.util.Locale;
25 import java.util.MissingResourceException;
26 import java.util.ResourceBundle;
27
28 import org.hipparchus.exception.Localizable;
29 import org.hipparchus.exception.UTF8Control;
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 @Deprecated
48 public enum LocalizedMigrationFormats implements Localizable {
49
50
51 ARGUMENT_OUTSIDE_DOMAIN("Argument {0} outside domain [{1} ; {2}]"),
52
53
54 ASSYMETRIC_EIGEN_NOT_SUPPORTED("eigen decomposition of assymetric matrices not supported yet"),
55
56
57 BOBYQA_BOUND_DIFFERENCE_CONDITION("the difference between the upper and lower bound must be larger than twice the initial trust region radius ({0})"),
58
59
60 CANNOT_CLEAR_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be cleared"),
61
62
63 CANNOT_FORMAT_INSTANCE_AS_3D_VECTOR("cannot format a {0} instance as a 3D vector"),
64
65
66 CANNOT_FORMAT_INSTANCE_AS_REAL_VECTOR("cannot format a {0} instance as a real vector"),
67
68
69 CANNOT_INCREMENT_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be incremented"),
70
71
72 CANNOT_RETRIEVE_AT_NEGATIVE_INDEX("elements cannot be retrieved from a negative array index {0}"),
73
74
75 CANNOT_SET_AT_NEGATIVE_INDEX("cannot set an element at a negative index {0}"),
76
77
78 CANNOT_TRANSFORM_TO_DOUBLE("Conversion Exception in Transformation: {0}"),
79
80
81 CARDAN_ANGLES_SINGULARITY("Cardan angles singularity"),
82
83
84 CLASS_DOESNT_IMPLEMENT_COMPARABLE("class ({0}) does not implement Comparable"),
85
86
87 COLUMN_INDEX_OUT_OF_RANGE("column index {0} out of allowed range [{1}, {2}]"),
88
89
90 DIMENSIONS_MISMATCH_SIMPLE("{0} != {1}"),
91
92
93 EMPTY_STRING_FOR_IMAGINARY_CHARACTER("empty string for imaginary character"),
94
95
96 EULER_ANGLES_SINGULARITY("Euler angles singularity"),
97
98
99 FUNCTION_NOT_DIFFERENTIABLE("function is not differentiable"),
100
101
102 FUNCTION_NOT_POLYNOMIAL("function is not polynomial"),
103
104
105 INDEX_OUT_OF_RANGE("index {0} out of allowed range [{1}, {2}]"),
106
107
108 INVALID_BRACKETING_PARAMETERS("invalid bracketing parameters: lower bound={0}, initial={1}, upper bound={2}"),
109
110
111 INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS("invalid interval, initial value parameters: lower={0}, initial={1}, upper={2}"),
112
113
114 INVALID_ITERATIONS_LIMITS("invalid iteration limits: min={0}, max={1}"),
115
116
117 INVALID_REGRESSION_ARRAY("input data array length = {0} does not match the number of observations = {1} and the number of regressors = {2}"),
118
119
120 ITERATOR_EXHAUSTED("iterator exhausted"),
121
122
123 LOESS_EXPECTS_AT_LEAST_ONE_POINT("Loess expects at least 1 point"),
124
125
126 MAP_MODIFIED_WHILE_ITERATING("map has been modified while iterating"),
127
128
129 MAX_ITERATIONS_EXCEEDED("maximal number of iterations ({0}) exceeded"),
130
131
132 MISMATCHED_LOESS_ABSCISSA_ORDINATE_ARRAYS("Loess expects the abscissa and ordinate arrays to be of the same size, but got {0} abscissae and {1} ordinatae"),
133
134
135 NEGATIVE_BRIGHTNESS_EXPONENT("brightness exponent should be positive or null, but got {0}"),
136
137
138 NEGATIVE_ELEMENT_AT_2D_INDEX("element ({0}, {1}) is negative: {2}"),
139
140
141 NEGATIVE_NUMBER_OF_SUCCESSES("number of successes must be non-negative ({0})"),
142
143
144 NEGATIVE_NUMBER_OF_TRIALS("number of trials must be non-negative ({0})"),
145
146
147 NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix: diagonal element at ({1},{1}) is smaller than {2} ({0})"),
148
149
150 NON_POSITIVE_MICROSPHERE_ELEMENTS("number of microsphere elements must be positive, but got {0}"),
151
152
153 NON_POSITIVE_POLYNOMIAL_DEGREE("polynomial degree must be positive: degree={0}"),
154
155
156 NON_REAL_FINITE_ABSCISSA("all abscissae must be finite real numbers, but {0}-th is {1}"),
157
158
159 NON_REAL_FINITE_ORDINATE("all ordinatae must be finite real numbers, but {0}-th is {1}"),
160
161
162 NON_REAL_FINITE_WEIGHT("all weights must be finite real numbers, but {0}-th is {1}"),
163
164
165 NOT_ADDITION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not addition compatible"),
166
167
168 NOT_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not decreasing ({2} < {3})"),
169
170
171 NOT_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not increasing ({2} > {3})"),
172
173
174 NOT_MULTIPLICATION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not multiplication compatible"),
175
176
177 NOT_POSITIVE_DEGREES_OF_FREEDOM("degrees of freedom must be positive ({0})"),
178
179
180 NOT_POSITIVE_ELEMENT_AT_INDEX("element {0} is not positive: {1}"),
181
182
183 NOT_POSITIVE_LENGTH("length must be positive ({0})"),
184
185
186 NOT_POSITIVE_MEAN("mean must be positive ({0})"),
187
188
189 NOT_POSITIVE_PERMUTATION("permutation k ({0}) must be positive"),
190
191
192 NOT_POSITIVE_POISSON_MEAN("the Poisson mean must be positive ({0})"),
193
194
195 NOT_POSITIVE_POPULATION_SIZE("population size must be positive ({0})"),
196
197
198 NOT_POSITIVE_ROW_DIMENSION("invalid row dimension: {0} (must be positive)"),
199
200
201 NOT_POSITIVE_SAMPLE_SIZE("sample size must be positive ({0})"),
202
203
204 NOT_POSITIVE_SHAPE("shape must be positive ({0})"),
205
206
207 NOT_POSITIVE_STANDARD_DEVIATION("standard deviation must be positive ({0})"),
208
209
210 NOT_POSITIVE_UPPER_BOUND("upper bound must be positive ({0})"),
211
212
213 NOT_STRICTLY_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly decreasing ({2} <= {3})"),
214
215
216 NOT_STRICTLY_INCREASING_KNOT_VALUES("knot values must be strictly increasing"),
217
218
219 NOT_STRICTLY_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly increasing ({2} >= {3})"),
220
221
222 NOT_SUBTRACTION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not subtraction compatible"),
223
224
225 NOT_SYMMETRIC_MATRIX("not symmetric matrix"),
226
227
228 NO_BIN_SELECTED("no bin selected"),
229
230
231 NO_DEGREES_OF_FREEDOM("no degrees of freedom ({0} measurements, {1} parameters)"),
232
233
234 NO_DENSITY_FOR_THIS_DISTRIBUTION("This distribution does not have a density function implemented"),
235
236
237 NO_RESULT_AVAILABLE("no result available"),
238
239
240 NO_SUCH_MATRIX_ENTRY("no entry at indices ({0}, {1}) in a {2}x{3} matrix"),
241
242
243 N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED("{0} points Legendre-Gauss integrator not supported, number of points must be in the {1}-{2} range"),
244
245
246 OBJECT_TRANSFORMATION("conversion exception in transformation"),
247
248
249 OBSERVED_COUNTS_ALL_ZERO("observed counts are all 0 in observed array {0}"),
250
251
252 OUT_OF_ORDER_ABSCISSA_ARRAY("the abscissae array must be sorted in a strictly increasing order, but the {0}-th element is {1} whereas {2}-th is {3}"),
253
254
255 OUT_OF_RANGE_RIGHT("{0} out of [{1}, {2}) range"),
256
257
258 POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS("number of polynomial interpolants must match the number of segments ({0} != {1} - 1)"),
259
260
261 POWER_NEGATIVE_PARAMETERS("cannot raise an integral value to a negative power ({0}^{1})"),
262
263
264 ROW_INDEX_OUT_OF_RANGE("row index {0} out of allowed range [{1}, {2}]"),
265
266
267 SAME_SIGN_AT_ENDPOINTS("function values at endpoints do not have different signs, endpoints: [{0}, {1}], values: [{2}, {3}]"),
268
269
270 UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH("unable to bracket optimum in line search"),
271
272
273 UNABLE_TO_COMPUTE_COVARIANCE_SINGULAR_PROBLEM("unable to compute covariances: singular problem"),
274
275
276 UNABLE_TO_FIRST_GUESS_HARMONIC_COEFFICIENTS("unable to first guess the harmonic coefficients"),
277
278
279 UNPARSEABLE_3D_VECTOR("unparseable 3D vector: \"{0}\""),
280
281
282 UNPARSEABLE_COMPLEX_NUMBER("unparseable complex number: \"{0}\""),
283
284
285 UNPARSEABLE_REAL_VECTOR("unparseable real vector: \"{0}\""),
286
287
288 UNSUPPORTED_EXPANSION_MODE("unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})"),
289
290
291 VECTOR_LENGTH_MISMATCH("vector length mismatch: got {0} but expected {1}"),
292
293
294 WRONG_BLOCK_LENGTH("wrong array shape (block length = {0}, expected {1})");
295
296
297 private final String sourceFormat;
298
299
300
301
302
303 LocalizedMigrationFormats(final String sourceFormat) {
304 this.sourceFormat = sourceFormat;
305 }
306
307
308 @Override
309 public String getSourceString() {
310 return sourceFormat;
311 }
312
313
314 @Override
315 public String getLocalizedString(final Locale locale) {
316 try {
317 final String path = LocalizedMigrationFormats.class.getName().replaceAll("\\.", "/");
318 ResourceBundle bundle =
319 ResourceBundle.getBundle("assets/" + path, locale, new UTF8Control());
320 if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
321 final String translated = bundle.getString(name());
322 if ((translated != null) &&
323 (translated.length() > 0) &&
324 (!translated.toLowerCase(locale).contains("missing translation"))) {
325
326 return translated;
327 }
328 }
329
330 } catch (MissingResourceException mre) {
331
332 }
333
334
335
336 return sourceFormat;
337
338 }
339
340 }