1 /*
   2  * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 /*
  26 /**
  27 *******************************************************************************
  28 * Copyright (C) 1996-2004, International Business Machines Corporation and    *
  29 * others. All Rights Reserved.                                                *
  30 *******************************************************************************
  31 */
  32 // CHANGELOG
  33 //      2005-05-19 Edward Wang
  34 //          - copy this file from icu4jsrc_3_2/src/com/ibm/icu/lang/UCharacterDirection.java
  35 //          - move from package com.ibm.icu.lang to package sun.net.idn
  36 //
  37 
  38 package jdk.internal.icu.lang;
  39 
  40 /**
  41  * Enumerated Unicode character linguistic direction constants.
  42  * Used as return results from <a href=UCharacter.html>UCharacter</a>
  43  * <p>
  44  * This class is not subclassable
  45  * </p>
  46  * @author Syn Wee Quek
  47  * @stable ICU 2.1
  48  */
  49 
  50 @SuppressWarnings("deprecation")
  51 public final class UCharacterDirection implements UCharacterEnums.ECharacterDirection {
  52 
  53     // private constructor =========================================
  54     ///CLOVER:OFF
  55     /**
  56      * Private constructor to prevent initialisation
  57      */
  58     private UCharacterDirection()
  59     {
  60     }
  61     ///CLOVER:ON
  62 
  63     /**
  64      * Gets the name of the argument direction
  65      * @param dir direction type to retrieve name
  66      * @return directional name
  67      * @stable ICU 2.1
  68      */
  69     public static String toString(int dir) {
  70         switch(dir)
  71             {
  72             case LEFT_TO_RIGHT :
  73                 return "Left-to-Right";
  74             case RIGHT_TO_LEFT :
  75                 return "Right-to-Left";
  76             case EUROPEAN_NUMBER :
  77                 return "European Number";
  78             case EUROPEAN_NUMBER_SEPARATOR :
  79                 return "European Number Separator";
  80             case EUROPEAN_NUMBER_TERMINATOR :
  81                 return "European Number Terminator";
  82             case ARABIC_NUMBER :
  83                 return "Arabic Number";
  84             case COMMON_NUMBER_SEPARATOR :
  85                 return "Common Number Separator";
  86             case BLOCK_SEPARATOR :
  87                 return "Paragraph Separator";
  88             case SEGMENT_SEPARATOR :
  89                 return "Segment Separator";
  90             case WHITE_SPACE_NEUTRAL :
  91                 return "Whitespace";
  92             case OTHER_NEUTRAL :
  93                 return "Other Neutrals";
  94             case LEFT_TO_RIGHT_EMBEDDING :
  95                 return "Left-to-Right Embedding";
  96             case LEFT_TO_RIGHT_OVERRIDE :
  97                 return "Left-to-Right Override";
  98             case RIGHT_TO_LEFT_ARABIC :
  99                 return "Right-to-Left Arabic";
 100             case RIGHT_TO_LEFT_EMBEDDING :
 101                 return "Right-to-Left Embedding";
 102             case RIGHT_TO_LEFT_OVERRIDE :
 103                 return "Right-to-Left Override";
 104             case POP_DIRECTIONAL_FORMAT :
 105                 return "Pop Directional Format";
 106             case DIR_NON_SPACING_MARK :
 107                 return "Non-Spacing Mark";
 108             case BOUNDARY_NEUTRAL :
 109                 return "Boundary Neutral";
 110             }
 111         return "Unassigned";
 112     }
 113 }