* Bug 15876 fixed: now struct and cells are reported native in browsevar
[scilab.git] / scilab / modules / types / src / java / org / scilab / modules / types / ScilabTypeEnumDescription.java
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2011-2011 - DIGITEO - Sylvestre LEDRU
4  *  Copyright (C) 2012 - Scilab Enterprises - Sylvestre LEDRU
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  */
16
17 package org.scilab.modules.types;
18
19 import org.scilab.modules.localization.Messages;
20
21 public class ScilabTypeEnumDescription {
22
23     public static String getTypeDescriptionFromId(int type) {
24         try {
25             switch (ScilabTypeEnum.swigToEnum(type)) {
26                 case sci_matrix:
27                     return Messages.gettext("Double");
28                 case sci_poly:
29                     return Messages.gettext("Polynomial");
30                 case sci_boolean:
31                     return Messages.gettext("Boolean");
32                 case sci_sparse:
33                     return Messages.gettext("Sparse");
34                 case sci_boolean_sparse:
35                     return Messages.gettext("Boolean Sparse");
36                 case sci_matlab_sparse:
37                     return Messages.gettext("Matlab Sparse");
38                 case sci_ints:
39                     return Messages.gettext("Integer");
40                 case sci_handles:
41                     return Messages.gettext("Graphic handle");
42                 case sci_strings:
43                     return Messages.gettext("String");
44                 case sci_u_function:
45                 case sci_c_function:
46                     return Messages.gettext("User function");
47                 case sci_lib:
48                     return Messages.gettext("Function library");
49                 case sci_list:
50                     return Messages.gettext("List");
51                 case sci_tlist:
52                     return Messages.gettext("Tlist");
53                 case sci_mlist:
54                     return Messages.gettext("Mlist");
55                 case sci_struct:
56                     return Messages.gettext("Struct");
57                 case sci_cell:
58                     return Messages.gettext("Cell");
59                 case sci_pointer:
60                     return Messages.gettext("Pointer");
61                 case sci_implicit_poly:
62                     return Messages.gettext("Implicit polynomial");
63                 case sci_intrinsic_function:
64                     return Messages.gettext("Intrinsic function");
65             }
66             return Messages.gettext("Unknown datatype");
67
68         } catch (IllegalArgumentException e) {
69             return Messages.gettext("Unknown datatype");
70         }
71     }
72
73     /*
74      * Return the description of the mlist code ('ce' => 'cell', 'st => 'struct', etc)
75      * @param shortCode the short code
76      * @return the full description
77      */
78     public static String getListTypeDescription (String shortCode) {
79         // Once we switch to Java 7, we can replace that by a String switch
80         if (shortCode.equals("ce")) {
81             shortCode = "cell";
82         } else {
83             if (shortCode.equals("st")) {
84                 shortCode = "struct";
85             } else {
86                 if (shortCode.equals("fptr")) {
87                     shortCode = "built-in";
88                 }
89             }
90         }
91         return shortCode;
92     }
93 }