Home | History | Annotate | Download | only in util
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 package org.apache.commons.math.exception.util;
     18 
     19 import java.util.Locale;
     20 import java.util.MissingResourceException;
     21 import java.util.ResourceBundle;
     22 
     23 /**
     24  * Enumeration for localized messages formats used in exceptions messages.
     25  * <p>
     26  * The constants in this enumeration represent the available
     27  * formats as localized strings. These formats are intended to be
     28  * localized using simple properties files, using the constant
     29  * name as the key and the property value as the message format.
     30  * The source English format is provided in the constants themselves
     31  * to serve both as a reminder for developers to understand the parameters
     32  * needed by each format, as a basis for translators to create
     33  * localized properties files, and as a default format if some
     34  * translation is missing.
     35  * </p>
     36  * @since 2.2
     37  * @version $Revision: 1073165 $ $Date: 2011-02-21 23:04:14 +0100 (lun. 21 fvr. 2011) $
     38  */
     39 public enum LocalizedFormats implements Localizable {
     40 
     41     // CHECKSTYLE: stop MultipleVariableDeclarations
     42     // CHECKSTYLE: stop JavadocVariable
     43 
     44     ARGUMENT_OUTSIDE_DOMAIN("Argument {0} outside domain [{1} ; {2}]"),
     45     ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1("array sizes should have difference 1 ({0} != {1} + 1)"),
     46     ARRAY_SUMS_TO_ZERO("array sums to zero"),
     47     ASSYMETRIC_EIGEN_NOT_SUPPORTED("eigen decomposition of assymetric matrices not supported yet"),
     48     AT_LEAST_ONE_COLUMN("matrix must have at least one column"),
     49     AT_LEAST_ONE_ROW("matrix must have at least one row"),
     50     BANDWIDTH_OUT_OF_INTERVAL("bandwidth must be in the interval [0,1], but got {0}"),
     51     BINOMIAL_INVALID_PARAMETERS_ORDER("must have n >= k for binomial coefficient (n,k), got n = {0}, k = {1}"),
     52     BINOMIAL_NEGATIVE_PARAMETER("must have n >= 0 for binomial coefficient (n,k), got n = {0}"),
     53     CANNOT_CLEAR_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be cleared"),
     54     CANNOT_COMPUTE_0TH_ROOT_OF_UNITY("cannot compute 0-th root of unity, indefinite result"),
     55     CANNOT_COMPUTE_BETA_DENSITY_AT_0_FOR_SOME_ALPHA("cannot compute beta density at 0 when alpha = {0,number}"),
     56     CANNOT_COMPUTE_BETA_DENSITY_AT_1_FOR_SOME_BETA("cannot compute beta density at 1 when beta = %.3g"),
     57     CANNOT_COMPUTE_NTH_ROOT_FOR_NEGATIVE_N("cannot compute nth root for null or negative n: {0}"),
     58     CANNOT_CONVERT_OBJECT_TO_FRACTION("cannot convert given object to a fraction number: {0}"),
     59     CANNOT_DISCARD_NEGATIVE_NUMBER_OF_ELEMENTS("cannot discard a negative number of elements ({0})"),
     60     CANNOT_FORMAT_INSTANCE_AS_3D_VECTOR("cannot format a {0} instance as a 3D vector"),
     61     CANNOT_FORMAT_INSTANCE_AS_COMPLEX("cannot format a {0} instance as a complex number"),
     62     CANNOT_FORMAT_INSTANCE_AS_REAL_VECTOR("cannot format a {0} instance as a real vector"),
     63     CANNOT_FORMAT_OBJECT_TO_FRACTION("cannot format given object as a fraction number"),
     64     CANNOT_INCREMENT_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be incremented"),
     65     CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR("cannot normalize a zero norm vector"),
     66     CANNOT_RETRIEVE_AT_NEGATIVE_INDEX("elements cannot be retrieved from a negative array index {0}"),
     67     CANNOT_SET_AT_NEGATIVE_INDEX("cannot set an element at a negative index {0}"),
     68     CANNOT_SUBSTITUTE_ELEMENT_FROM_EMPTY_ARRAY("cannot substitute an element from an empty array"),
     69     CANNOT_TRANSFORM_TO_DOUBLE("Conversion Exception in Transformation: {0}"),
     70     CARDAN_ANGLES_SINGULARITY("Cardan angles singularity"),
     71     CLASS_DOESNT_IMPLEMENT_COMPARABLE("class ({0}) does not implement Comparable"),
     72     CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),
     73     COLUMN_INDEX_OUT_OF_RANGE("column index {0} out of allowed range [{1}, {2}]"),
     74     CONTINUED_FRACTION_INFINITY_DIVERGENCE("Continued fraction convergents diverged to +/- infinity for value {0}"),
     75     CONTINUED_FRACTION_NAN_DIVERGENCE("Continued fraction diverged to NaN for value {0}"),
     76     CONTRACTION_CRITERIA_SMALLER_THAN_EXPANSION_FACTOR("contraction criteria ({0}) smaller than the expansion factor ({1}).  This would lead to a never ending loop of expansion and contraction as a newly expanded internal storage array would immediately satisfy the criteria for contraction."),
     77     CONTRACTION_CRITERIA_SMALLER_THAN_ONE("contraction criteria smaller than one ({0}).  This would lead to a never ending loop of expansion and contraction as an internal storage array length equal to the number of elements would satisfy the contraction criteria."),
     78     CONVERGENCE_FAILED("convergence failed"),
     79     CUMULATIVE_PROBABILITY_RETURNED_NAN("Cumulative probability function returned NaN for argument {0} p = {1}"),
     80     DIFFERENT_ROWS_LENGTHS("some rows have length {0} while others have length {1}"),
     81     DIGEST_NOT_INITIALIZED("digest not initialized"),
     82     DIMENSIONS_MISMATCH_2x2("dimensions mismatch: got {0}x{1} but expected {2}x{3}"),
     83     DIMENSIONS_MISMATCH_SIMPLE("dimensions mismatch {0} != {1}"), /* keep */
     84     DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN("Discrete cumulative probability function returned NaN for argument {0}"),
     85     DISTRIBUTION_NOT_LOADED("distribution not loaded"),
     86     DUPLICATED_ABSCISSA("Abscissa {0} is duplicated at both indices {1} and {2}"),
     87     EMPTY_CLUSTER_IN_K_MEANS("empty cluster in k-means"),
     88     EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY("empty polynomials coefficients array"), /* keep */
     89     EMPTY_SELECTED_COLUMN_INDEX_ARRAY("empty selected column index array"),
     90     EMPTY_SELECTED_ROW_INDEX_ARRAY("empty selected row index array"),
     91     EMPTY_STRING_FOR_IMAGINARY_CHARACTER("empty string for imaginary character"),
     92     ENDPOINTS_NOT_AN_INTERVAL("endpoints do not specify an interval: [{0}, {1}]"),
     93     EQUAL_VERTICES_IN_SIMPLEX("equal vertices {0} and {1} in simplex configuration"),
     94     EULER_ANGLES_SINGULARITY("Euler angles singularity"),
     95     EVALUATION_FAILED("evaluation failed for argument = {0}"),
     96     EXPANSION_FACTOR_SMALLER_THAN_ONE("expansion factor smaller than one ({0})"),
     97     FACTORIAL_NEGATIVE_PARAMETER("must have n >= 0 for n!, got n = {0}"),
     98     FAILED_BRACKETING("number of iterations={0}, maximum iterations={1}, initial={2}, lower bound={3}, upper bound={4}, final a value={5}, final b value={6}, f(a)={7}, f(b)={8}"),
     99     FAILED_FRACTION_CONVERSION("Unable to convert {0} to fraction after {1} iterations"),
    100     FIRST_COLUMNS_NOT_INITIALIZED_YET("first {0} columns are not initialized yet"),
    101     FIRST_ELEMENT_NOT_ZERO("first element is not 0: {0}"),
    102     FIRST_ROWS_NOT_INITIALIZED_YET("first {0} rows are not initialized yet"),
    103     FRACTION_CONVERSION_OVERFLOW("Overflow trying to convert {0} to fraction ({1}/{2})"),
    104     FUNCTION_NOT_DIFFERENTIABLE("function is not differentiable"),
    105     FUNCTION_NOT_POLYNOMIAL("function is not polynomial"),
    106     GCD_OVERFLOW_32_BITS("overflow: gcd({0}, {1}) is 2^31"),
    107     GCD_OVERFLOW_64_BITS("overflow: gcd({0}, {1}) is 2^63"),
    108     HOLE_BETWEEN_MODELS_TIME_RANGES("{0} wide hole between models time ranges"),
    109     IDENTICAL_ABSCISSAS_DIVISION_BY_ZERO("identical abscissas x[{0}] == x[{1}] == {2} cause division by zero"),
    110     INDEX_LARGER_THAN_MAX("the index specified: {0} is larger than the current maximal index {1}"),
    111     INDEX_NOT_POSITIVE("index ({0}) is not positive"),
    112     INDEX_OUT_OF_RANGE("index {0} out of allowed range [{1}, {2}]"),
    113     INFINITE_ARRAY_ELEMENT("Array contains an infinite element, {0} at index {1}"),
    114     INFINITE_VALUE_CONVERSION("cannot convert infinite value"),
    115     INITIAL_CAPACITY_NOT_POSITIVE("initial capacity ({0}) is not positive"),
    116     INITIAL_COLUMN_AFTER_FINAL_COLUMN("initial column {0} after final column {1}"),
    117     INITIAL_ROW_AFTER_FINAL_ROW("initial row {0} after final row {1}"),
    118     INPUT_DATA_FROM_UNSUPPORTED_DATASOURCE("input data comes from unsupported datasource: {0}, supported sources: {1}, {2}"),
    119     INSTANCES_NOT_COMPARABLE_TO_EXISTING_VALUES("instance of class {0} not comparable to existing values"),
    120     INSUFFICIENT_DATA_FOR_T_STATISTIC("insufficient data for t statistic, needs at least 2, got {0}"),
    121     INSUFFICIENT_DIMENSION("insufficient dimension {0}, must be at least {1}"),
    122     INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE("sample contains {0} observed points, at least {1} are required"),
    123     INSUFFICIENT_ROWS_AND_COLUMNS("insufficient data: only {0} rows and {1} columns."),
    124     INTEGRATION_METHOD_NEEDS_AT_LEAST_ONE_PREVIOUS_POINT("{0} method needs at least one previous point"),
    125     INTERNAL_ERROR("internal error, please fill a bug report at {0}"),
    126     INVALID_BRACKETING_PARAMETERS("invalid bracketing parameters:  lower bound={0},  initial={1}, upper bound={2}"),
    127     INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS("invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}"),
    128     INVALID_ITERATIONS_LIMITS("invalid iteration limits: min={0}, max={1}"),
    129     INVALID_MAX_ITERATIONS("bad value for maximum iterations number: {0}"),
    130     INVALID_REGRESSION_ARRAY("input data array length = {0} does not match the number of observations = {1} and the number of regressors = {2}"),
    131     INVALID_ROUNDING_METHOD("invalid rounding method {0}, valid methods: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})"),
    132     ITERATOR_EXHAUSTED("iterator exhausted"),
    133     LCM_OVERFLOW_32_BITS("overflow: lcm({0}, {1}) is 2^31"),
    134     LCM_OVERFLOW_64_BITS("overflow: lcm({0}, {1}) is 2^63"),
    135     LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE("list of chromosomes bigger than maxPopulationSize"),
    136     LOESS_EXPECTS_AT_LEAST_ONE_POINT("Loess expects at least 1 point"),
    137     LOWER_BOUND_NOT_BELOW_UPPER_BOUND("lower bound ({0}) must be strictly less than upper bound ({1})"), /* keep */
    138     LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT("lower endpoint ({0}) must be less than or equal to upper endpoint ({1})"),
    139     MAP_MODIFIED_WHILE_ITERATING("map has been modified while iterating"),
    140     MAX_EVALUATIONS_EXCEEDED("maximal number of evaluations ({0}) exceeded"),
    141     MAX_ITERATIONS_EXCEEDED("maximal number of iterations ({0}) exceeded"),
    142     MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION("minimal step size ({0,number,0.00E00}) reached, integration needs {1,number,0.00E00}"),
    143     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"),
    144     NAN_ELEMENT_AT_INDEX("element {0} is NaN"),
    145     NAN_VALUE_CONVERSION("cannot convert NaN value"),
    146     NEGATIVE_BRIGHTNESS_EXPONENT("brightness exponent should be positive or null, but got {0}"),
    147     NEGATIVE_COMPLEX_MODULE("negative complex module {0}"),
    148     NEGATIVE_ELEMENT_AT_2D_INDEX("element ({0}, {1}) is negative: {2}"),
    149     NEGATIVE_ELEMENT_AT_INDEX("element {0} is negative: {1}"),
    150     NEGATIVE_NUMBER_OF_SUCCESSES("number of successes must be non-negative ({0})"),
    151     NEGATIVE_NUMBER_OF_TRIALS("number of trials must be non-negative ({0})"),
    152     NEGATIVE_ROBUSTNESS_ITERATIONS("the number of robustness iterations must be non-negative, but got {0}"),
    153     START_POSITION("start position ({0})"), /* keep */
    154     NON_CONVERGENT_CONTINUED_FRACTION("Continued fraction convergents failed to converge for value {0}"),
    155     NON_POSITIVE_MICROSPHERE_ELEMENTS("number of microsphere elements must be positive, but got {0}"),
    156     NON_POSITIVE_POLYNOMIAL_DEGREE("polynomial degree must be positive: degree={0}"),
    157     NON_REAL_FINITE_ABSCISSA("all abscissae must be finite real numbers, but {0}-th is {1}"),
    158     NON_REAL_FINITE_ORDINATE("all ordinatae must be finite real numbers, but {0}-th is {1}"),
    159     NON_REAL_FINITE_WEIGHT("all weights must be finite real numbers, but {0}-th is {1}"),
    160     NON_SQUARE_MATRIX("a {0}x{1} matrix was provided instead of a square matrix"),
    161     NORMALIZE_INFINITE("Cannot normalize to an infinite value"),
    162     NORMALIZE_NAN("Cannot normalize to NaN"),
    163     NOT_ADDITION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not addition compatible"),
    164     NOT_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not decreasing ({2} < {3})"),
    165     NOT_DECREASING_SEQUENCE("points {3} and {2} are not decreasing ({1} < {0})"), /* keep */
    166     NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS("not enough data ({0} rows) for this many predictors ({1} predictors)"),
    167     NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION("spline partition must have at least {0} points, got {1}"),
    168     NOT_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not increasing ({2} > {3})"),
    169     NOT_INCREASING_SEQUENCE("points {3} and {2} are not increasing ({1} > {0})"), /* keep */
    170     NOT_MULTIPLICATION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not multiplication compatible"),
    171     NOT_OVERRIDEN("method not overriden"),
    172     NOT_POSITIVE_ALPHA("alpha must be positive ({0})"),
    173     NOT_POSITIVE_BETA("beta must be positive ({0})"),
    174     NOT_POSITIVE_COLUMNDIMENSION("invalid column dimension: {0} (must be positive)"),
    175     NOT_POSITIVE_DEFINITE_MATRIX("not positive definite matrix"),
    176     NOT_POSITIVE_DEGREES_OF_FREEDOM("degrees of freedom must be positive ({0})"),
    177     NOT_POSITIVE_ELEMENT_AT_INDEX("element {0} is not positive: {1}"),
    178     NOT_POSITIVE_EXPONENT("invalid exponent {0} (must be positive)"),
    179     NOT_POSITIVE_LENGTH("length must be positive ({0})"),
    180     LENGTH("length ({0})"), /* keep */
    181     NOT_POSITIVE_MEAN("mean must be positive ({0})"),
    182     MEAN("mean ({0})"), /* keep */
    183     NOT_POSITIVE_NUMBER_OF_SAMPLES("number of sample is not positive: {0}"),
    184     NUMBER_OF_SAMPLES("number of samples ({0})"), /* keep */
    185     NOT_POSITIVE_PERMUTATION("permutation k ({0}) must be positive"),
    186     PERMUTATION_SIZE("permutation size ({0}"), /* keep */
    187     NOT_POSITIVE_POISSON_MEAN("the Poisson mean must be positive ({0})"),
    188     NOT_POSITIVE_POPULATION_SIZE("population size must be positive ({0})"),
    189     NOT_POSITIVE_ROW_DIMENSION("invalid row dimension: {0} (must be positive)"),
    190     NOT_POSITIVE_SAMPLE_SIZE("sample size must be positive ({0})"),
    191     NOT_POSITIVE_SCALE("scale must be positive ({0})"),
    192     NOT_POSITIVE_SHAPE("shape must be positive ({0})"),
    193     NOT_POSITIVE_STANDARD_DEVIATION("standard deviation must be positive ({0})"),
    194     STANDARD_DEVIATION("standard deviation ({0})"), /* keep */
    195     NOT_POSITIVE_UPPER_BOUND("upper bound must be positive ({0})"),
    196     NOT_POSITIVE_WINDOW_SIZE("window size must be positive ({0})"),
    197     NOT_POWER_OF_TWO("{0} is not a power of 2"),
    198     NOT_POWER_OF_TWO_CONSIDER_PADDING("{0} is not a power of 2, consider padding for fix"),
    199     NOT_POWER_OF_TWO_PLUS_ONE("{0} is not a power of 2 plus one"),
    200     NOT_STRICTLY_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly decreasing ({2} <= {3})"),
    201     NOT_STRICTLY_DECREASING_SEQUENCE("points {3} and {2} are not strictly decreasing ({1} <= {0})"), /* keep */
    202     NOT_STRICTLY_INCREASING_KNOT_VALUES("knot values must be strictly increasing"),
    203     NOT_STRICTLY_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly increasing ({2} >= {3})"),
    204     NOT_STRICTLY_INCREASING_SEQUENCE("points {3} and {2} are not strictly increasing ({1} >= {0})"), /* keep */
    205     NOT_SUBTRACTION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not subtraction compatible"),
    206     NOT_SYMMETRIC_MATRIX("not symmetric matrix"),
    207     NO_BIN_SELECTED("no bin selected"),
    208     NO_CONVERGENCE_WITH_ANY_START_POINT("none of the {0} start points lead to convergence"),
    209     NO_DATA("no data"), /* keep */
    210     NO_DEGREES_OF_FREEDOM("no degrees of freedom ({0} measurements, {1} parameters)"),
    211     NO_DENSITY_FOR_THIS_DISTRIBUTION("This distribution does not have a density function implemented"),
    212     NO_FEASIBLE_SOLUTION("no feasible solution"),
    213     NO_OPTIMUM_COMPUTED_YET("no optimum computed yet"),
    214     NO_RESULT_AVAILABLE("no result available"),
    215     NO_SUCH_MATRIX_ENTRY("no entry at indices ({0}, {1}) in a {2}x{3} matrix"),
    216     NULL_NOT_ALLOWED("null is not allowed"), /* keep */
    217     COVARIANCE_MATRIX("covariance matrix"), /* keep */
    218     DENOMINATOR("denominator"), /* keep */
    219     DENOMINATOR_FORMAT("denominator format"), /* keep */
    220     FRACTION("fraction"), /* keep */
    221     FUNCTION("function"), /* keep */
    222     IMAGINARY_FORMAT("imaginary format"), /* keep */
    223     INPUT_ARRAY("input array"), /* keep */
    224     NUMERATOR("numerator"), /* keep */
    225     NUMERATOR_FORMAT("numerator format"), /* keep */
    226     OBJECT_TRANSFORMATION("conversion exception in transformation"), /* keep */
    227     REAL_FORMAT("real format"), /* keep */
    228     WHOLE_FORMAT("whole format"), /* keep */
    229     NUMBER_TOO_LARGE("{0} is larger than the maximum ({1})"), /* keep */
    230     NUMBER_TOO_SMALL("{0} is smaller than the minimum ({1})"), /* keep */
    231     NUMBER_TOO_LARGE_BOUND_EXCLUDED("{0} is larger than, or equal to, the maximum ({1})"), /* keep */
    232     NUMBER_TOO_SMALL_BOUND_EXCLUDED("{0} is smaller than, or equal to, the minimum ({1})"), /* keep */
    233     NUMBER_OF_SUCCESS_LARGER_THAN_POPULATION_SIZE("number of successes ({0}) must be less than or equal to population size ({1})"),
    234     NUMERATOR_OVERFLOW_AFTER_MULTIPLY("overflow, numerator too large after multiply: {0}"),
    235     N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED("{0} points Legendre-Gauss integrator not supported, number of points must be in the {1}-{2} range"),
    236     OBSERVED_COUNTS_ALL_ZERO("observed counts are all 0 in observed array {0}"),
    237     OBSERVED_COUNTS_BOTTH_ZERO_FOR_ENTRY("observed counts are both zero for entry {0}"),
    238     OUT_OF_BOUNDS_QUANTILE_VALUE("out of bounds quantile value: {0}, must be in (0, 100]"),
    239     OUT_OF_BOUND_SIGNIFICANCE_LEVEL("out of bounds significance level {0}, must be between {1} and {2}"),
    240     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}"),
    241     OUT_OF_RANGE_ROOT_OF_UNITY_INDEX("out of range root of unity index {0} (must be in [{1};{2}])"),
    242     OUT_OF_RANGE_SIMPLE("{0} out of [{1}, {2}] range"), /* keep */
    243     OVERFLOW_IN_FRACTION("overflow in fraction {0}/{1}, cannot negate"),
    244     OVERFLOW_IN_ADDITION("overflow in addition: {0} + {1}"),
    245     OVERFLOW_IN_SUBTRACTION("overflow in subtraction: {0} - {1}"),
    246     PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD("cannot access {0} method in percentile implementation {1}"),
    247     PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD("percentile implementation {0} does not support {1}"),
    248     PERMUTATION_EXCEEDS_N("permutation size ({0}) exceeds permuation domain ({1})"), /* keep */
    249     POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS("number of polynomial interpolants must match the number of segments ({0} != {1} - 1)"),
    250     POPULATION_LIMIT_NOT_POSITIVE("population limit has to be positive"),
    251     POSITION_SIZE_MISMATCH_INPUT_ARRAY("position {0} and size {1} don't fit to the size of the input array {2}"),
    252     POWER_NEGATIVE_PARAMETERS("cannot raise an integral value to a negative power ({0}^{1})"),
    253     PROPAGATION_DIRECTION_MISMATCH("propagation direction mismatch"),
    254     RANDOMKEY_MUTATION_WRONG_CLASS("RandomKeyMutation works only with RandomKeys, not {0}"),
    255     ROOTS_OF_UNITY_NOT_COMPUTED_YET("roots of unity have not been computed yet"),
    256     ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
    257     ROW_INDEX_OUT_OF_RANGE("row index {0} out of allowed range [{1}, {2}]"),
    258     SAME_SIGN_AT_ENDPOINTS("function values at endpoints do not have different signs, endpoints: [{0}, {1}], values: [{2}, {3}]"),
    259     SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE("sample size ({0}) exceeds collection size ({1})"), /* keep */
    260     SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE("sample size ({0}) must be less than or equal to population size ({1})"),
    261     SIMPLEX_NEED_ONE_POINT("simplex must contain at least one point"),
    262     SIMPLE_MESSAGE("{0}"),
    263     SINGULAR_MATRIX("matrix is singular"),
    264     SUBARRAY_ENDS_AFTER_ARRAY_END("subarray ends after array end"),
    265     TOO_LARGE_CUTOFF_SINGULAR_VALUE("cutoff singular value is {0}, should be at most {1}"),
    266     TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY("cannot discard {0} elements from a {1} elements array"),
    267     TOO_SMALL_BANDWIDTH("the bandwidth must be large enough to accomodate at least 2 points. There are {0}  data points, and bandwidth must be at least {1}  but it is only {2}"),
    268     TOO_SMALL_COST_RELATIVE_TOLERANCE("cost relative tolerance is too small ({0}), no further reduction in the sum of squares is possible"),
    269     TOO_SMALL_INTEGRATION_INTERVAL("too small integration interval: length = {0}"),
    270     TOO_SMALL_ORTHOGONALITY_TOLERANCE("orthogonality tolerance is too small ({0}), solution is orthogonal to the jacobian"),
    271     TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE("parameters relative tolerance is too small ({0}), no further improvement in the approximate solution is possible"),
    272     TWO_OR_MORE_CATEGORIES_REQUIRED("two or more categories required, got {0}"),
    273     TWO_OR_MORE_VALUES_IN_CATEGORY_REQUIRED("two or more values required in each category, one has {0}"),
    274     UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH("unable to bracket optimum in line search"),
    275     UNABLE_TO_COMPUTE_COVARIANCE_SINGULAR_PROBLEM("unable to compute covariances: singular problem"),
    276     UNABLE_TO_FIRST_GUESS_HARMONIC_COEFFICIENTS("unable to first guess the harmonic coefficients"),
    277     UNABLE_TO_ORTHOGONOLIZE_MATRIX("unable to orthogonalize matrix in {0} iterations"),
    278     UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN("unable to perform Q.R decomposition on the {0}x{1} jacobian matrix"),
    279     UNABLE_TO_SOLVE_SINGULAR_PROBLEM("unable to solve: singular problem"),
    280     UNBOUNDED_SOLUTION("unbounded solution"),
    281     UNKNOWN_MODE("unknown mode {0}, known modes: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}) and {11} ({12})"),
    282     UNPARSEABLE_3D_VECTOR("unparseable 3D vector: \"{0}\""),
    283     UNPARSEABLE_COMPLEX_NUMBER("unparseable complex number: \"{0}\""),
    284     UNPARSEABLE_FRACTION_NUMBER("unparseable fraction number: \"{0}\""),
    285     UNPARSEABLE_REAL_VECTOR("unparseable real vector: \"{0}\""),
    286     UNSUPPORTED_EXPANSION_MODE("unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})"),
    287     UNSUPPORTED_OPERATION("unsupported operation"), /* keep */
    288     USER_EXCEPTION("exception generated in user code"), /* keep */
    289     URL_CONTAINS_NO_DATA("URL {0} contains no data"),
    290     VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC("{0} values have been added before statistic is configured"),
    291     VECTOR_LENGTH_MISMATCH("vector length mismatch: got {0} but expected {1}"),
    292     VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT("vector must have at least one element"),
    293     WEIGHT_AT_LEAST_ONE_NON_ZERO("weigth array must contain at least one non-zero value"),
    294     WRONG_BLOCK_LENGTH("wrong array shape (block length = {0}, expected {1})"),
    295     WRONG_NUMBER_OF_POINTS("{0} points are required, got only {1}"),
    296     NUMBER_OF_POINTS("number of points ({0})"), /* keep */
    297     ZERO_DENOMINATOR("denominator must be different from 0"),
    298     ZERO_DENOMINATOR_IN_FRACTION("zero denominator in fraction {0}/{1}"),
    299     ZERO_FRACTION_TO_DIVIDE_BY("the fraction to divide by must not be zero: {0}/{1}"),
    300     ZERO_NORM("zero norm"),
    301     ZERO_NORM_FOR_ROTATION_AXIS("zero norm for rotation axis"),
    302     ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR("zero norm for rotation defining vector"),
    303     ZERO_NOT_ALLOWED("zero not allowed here");
    304 
    305     // CHECKSTYLE: resume JavadocVariable
    306     // CHECKSTYLE: resume MultipleVariableDeclarations
    307 
    308 
    309     /** Source English format. */
    310     private final String sourceFormat;
    311 
    312     /** Simple constructor.
    313      * @param sourceFormat source English format to use when no
    314      * localized version is available
    315      */
    316     private LocalizedFormats(final String sourceFormat) {
    317         this.sourceFormat = sourceFormat;
    318     }
    319 
    320     /** {@inheritDoc} */
    321     public String getSourceString() {
    322         return sourceFormat;
    323     }
    324 
    325     /** {@inheritDoc} */
    326     public String getLocalizedString(final Locale locale) {
    327         try {
    328             ResourceBundle bundle =
    329                     ResourceBundle.getBundle("META-INF/localization/LocalizedFormats", locale);
    330             if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
    331                 // the value of the resource is the translated format
    332                 return bundle.getString(toString());
    333             }
    334 
    335         } catch (MissingResourceException mre) {
    336             // do nothing here
    337         }
    338 
    339         // either the locale is not supported or the resource is unknown
    340         // don't translate and fall back to using the source format
    341         return sourceFormat;
    342 
    343     }
    344 
    345 }
    346