LocalizedGeometryFormats.java

  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.  * This is not the original file distributed by the Apache Software Foundation
  19.  * It has been modified by the Hipparchus project
  20.  */
  21. package org.hipparchus.geometry;

  22. import java.util.Locale;

  23. import org.hipparchus.exception.Localizable;

  24. /**
  25.  * Enumeration for localized messages formats used in exceptions messages.
  26.  * <p>
  27.  * The constants in this enumeration represent the available
  28.  * formats as localized strings. These formats are intended to be
  29.  * localized using simple properties files, using the constant
  30.  * name as the key and the property value as the message format.
  31.  * The source English format is provided in the constants themselves
  32.  * to serve both as a reminder for developers to understand the parameters
  33.  * needed by each format, as a basis for translators to create
  34.  * localized properties files, and as a default format if some
  35.  * translation is missing.
  36.  * </p>
  37.  */
  38. public enum LocalizedGeometryFormats implements Localizable {

  39.     /** CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR. */
  40.     CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR("cannot normalize a zero norm vector"),

  41.     /** CLOSE_VERTICES. */
  42.     CLOSE_VERTICES("too close vertices near point ({0}, {1}, {2})"),

  43.     /** CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT. */
  44.     CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),

  45.     /** CROSSING_BOUNDARY_LOOPS. */
  46.     CROSSING_BOUNDARY_LOOPS("some outline boundary loops cross each other"),

  47.     /** EDGE_CONNECTED_TO_ONE_FACET. */
  48.     EDGE_CONNECTED_TO_ONE_FACET("edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5}) is connected to one facet only"),

  49.     /** FACET_ORIENTATION_MISMATCH. */
  50.     FACET_ORIENTATION_MISMATCH("facets orientation mismatch around edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5})"),

  51.     /** INCONSISTENT_STATE_AT_2_PI_WRAPPING. */
  52.     INCONSISTENT_STATE_AT_2_PI_WRAPPING("inconsistent state at 2π wrapping"),

  53.     /** NON_INVERTIBLE_TRANSFORM. */
  54.     NON_INVERTIBLE_TRANSFORM("non-invertible affine transform collapses some lines into single points"),

  55.     /** NOT_CONVEX. */
  56.     NOT_CONVEX("vertices do not form a convex hull in CCW winding"),

  57.     /** NOT_CONVEX_HYPERPLANES. */
  58.     NOT_CONVEX_HYPERPLANES("hyperplanes do not define a convex region"),

  59.     /** NOT_SUPPORTED_IN_DIMENSION_N. */
  60.     NOT_SUPPORTED_IN_DIMENSION_N("method not supported in dimension {0}"),

  61.     /** OUTLINE_BOUNDARY_LOOP_OPEN. */
  62.     OUTLINE_BOUNDARY_LOOP_OPEN("an outline boundary loop is open"),

  63.     /** FACET_WITH_SEVERAL_BOUNDARY_LOOPS. */
  64.     FACET_WITH_SEVERAL_BOUNDARY_LOOPS("a facet has several boundary loops"),

  65.     /** OUT_OF_PLANE. */
  66.     OUT_OF_PLANE("point ({0}, {1}, {2}) is out of plane"),

  67.     /** ROTATION_MATRIX_DIMENSIONS. */
  68.     ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),

  69.     /** UNABLE_TO_ORTHOGONOLIZE_MATRIX. */
  70.     UNABLE_TO_ORTHOGONOLIZE_MATRIX("unable to orthogonalize matrix in {0} iterations"),

  71.     /** ZERO_NORM_FOR_ROTATION_AXIS. */
  72.     ZERO_NORM_FOR_ROTATION_AXIS("zero norm for rotation axis"),

  73.     /** ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR. */
  74.     ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR("zero norm for rotation defining vector"),

  75.     /** TOO_SMALL_TOLERANCE. */
  76.     TOO_SMALL_TOLERANCE("tolerance {0,number,0.00000E00} is not computationally feasible, it is smaller than {1} ({2,number,0.00000E00})"),

  77.     /** INVALID_ROTATION_ORDER_NAME. */
  78.     INVALID_ROTATION_ORDER_NAME("the value {0} does not correspond to a rotation order"),

  79.     /** CANNOT_FIND_INSIDE_POINT.
  80.      * @since 4.0
  81.      */
  82.     CANNOT_FIND_INSIDE_POINT("cannot find an inside point after {0} iterations");

  83.     /** Source English format. */
  84.     private final String sourceFormat;

  85.     /** Simple constructor.
  86.      * @param sourceFormat source English format to use when no
  87.      * localized version is available
  88.      */
  89.     LocalizedGeometryFormats(final String sourceFormat) {
  90.         this.sourceFormat = sourceFormat;
  91.     }

  92.     /** {@inheritDoc} */
  93.     @Override
  94.     public String getSourceString() {
  95.         return sourceFormat;
  96.     }

  97.     /** {@inheritDoc} */
  98.     @Override
  99.     public String getLocalizedString(final Locale locale) {
  100.         return getLocalizedString("assets/" + LocalizedGeometryFormats.class.getName().replaceAll("\\.", "/"),
  101.                                   name(), locale);
  102.     }

  103. }