View Javadoc
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    *      https://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  
18  /*
19   * This is not the original file distributed by the Apache Software Foundation
20   * It has been modified by the Hipparchus project
21   */
22  package org.hipparchus.geometry;
23  
24  import java.util.Locale;
25  
26  import org.hipparchus.exception.Localizable;
27  
28  /**
29   * Enumeration for localized messages formats used in exceptions messages.
30   * <p>
31   * The constants in this enumeration represent the available
32   * formats as localized strings. These formats are intended to be
33   * localized using simple properties files, using the constant
34   * name as the key and the property value as the message format.
35   * The source English format is provided in the constants themselves
36   * to serve both as a reminder for developers to understand the parameters
37   * needed by each format, as a basis for translators to create
38   * localized properties files, and as a default format if some
39   * translation is missing.
40   * </p>
41   */
42  public enum LocalizedGeometryFormats implements Localizable {
43  
44      /** CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR. */
45      CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR("cannot normalize a zero norm vector"),
46  
47      /** CLOSE_VERTICES. */
48      CLOSE_VERTICES("too close vertices near point ({0}, {1}, {2})"),
49  
50      /** CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT. */
51      CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),
52  
53      /** CROSSING_BOUNDARY_LOOPS. */
54      CROSSING_BOUNDARY_LOOPS("some outline boundary loops cross each other"),
55  
56      /** EDGE_CONNECTED_TO_ONE_FACET. */
57      EDGE_CONNECTED_TO_ONE_FACET("edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5}) is connected to one facet only"),
58  
59      /** FACET_ORIENTATION_MISMATCH. */
60      FACET_ORIENTATION_MISMATCH("facets orientation mismatch around edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5})"),
61  
62      /** INCONSISTENT_STATE_AT_2_PI_WRAPPING. */
63      INCONSISTENT_STATE_AT_2_PI_WRAPPING("inconsistent state at 2π wrapping"),
64  
65      /** NON_INVERTIBLE_TRANSFORM. */
66      NON_INVERTIBLE_TRANSFORM("non-invertible affine transform collapses some lines into single points"),
67  
68      /** NOT_CONVEX. */
69      NOT_CONVEX("vertices do not form a convex hull in CCW winding"),
70  
71      /** NOT_CONVEX_HYPERPLANES. */
72      NOT_CONVEX_HYPERPLANES("hyperplanes do not define a convex region"),
73  
74      /** NOT_SUPPORTED_IN_DIMENSION_N. */
75      NOT_SUPPORTED_IN_DIMENSION_N("method not supported in dimension {0}"),
76  
77      /** OUTLINE_BOUNDARY_LOOP_OPEN. */
78      OUTLINE_BOUNDARY_LOOP_OPEN("an outline boundary loop is open"),
79  
80      /** FACET_WITH_SEVERAL_BOUNDARY_LOOPS. */
81      FACET_WITH_SEVERAL_BOUNDARY_LOOPS("a facet has several boundary loops"),
82  
83      /** OUT_OF_PLANE. */
84      OUT_OF_PLANE("point ({0}, {1}, {2}) is out of plane"),
85  
86      /** ROTATION_MATRIX_DIMENSIONS. */
87      ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
88  
89      /** UNABLE_TO_ORTHOGONOLIZE_MATRIX. */
90      UNABLE_TO_ORTHOGONOLIZE_MATRIX("unable to orthogonalize matrix in {0} iterations"),
91  
92      /** ZERO_NORM_FOR_ROTATION_AXIS. */
93      ZERO_NORM_FOR_ROTATION_AXIS("zero norm for rotation axis"),
94  
95      /** ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR. */
96      ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR("zero norm for rotation defining vector"),
97  
98      /** TOO_SMALL_TOLERANCE. */
99      TOO_SMALL_TOLERANCE("tolerance {0,number,0.00000E00} is not computationally feasible, it is smaller than {1} ({2,number,0.00000E00})"),
100 
101     /** INVALID_ROTATION_ORDER_NAME. */
102     INVALID_ROTATION_ORDER_NAME("the value {0} does not correspond to a rotation order"),
103 
104     /** CANNOT_FIND_INSIDE_POINT.
105      * @since 4.0
106      */
107     CANNOT_FIND_INSIDE_POINT("cannot find an inside point after {0} iterations");
108 
109     /** Source English format. */
110     private final String sourceFormat;
111 
112     /** Simple constructor.
113      * @param sourceFormat source English format to use when no
114      * localized version is available
115      */
116     LocalizedGeometryFormats(final String sourceFormat) {
117         this.sourceFormat = sourceFormat;
118     }
119 
120     /** {@inheritDoc} */
121     @Override
122     public String getSourceString() {
123         return sourceFormat;
124     }
125 
126     /** {@inheritDoc} */
127     @Override
128     public String getLocalizedString(final Locale locale) {
129         return getLocalizedString("assets/" + LocalizedGeometryFormats.class.getName().replaceAll("\\.", "/"),
130                                   name(), locale);
131     }
132 
133 }