Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
DatasetType | 28 | 6 | 0% | 4 | 1 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.chart.dataset; | |
21 | ||
22 | /** | |
23 | * Enumeration of supported dataset types. | |
24 | * | |
25 | * @version $Id: 37c1a97333bc6ac99211f027f32e93b24f8f6295 $ | |
26 | * @since 4.2M1 | |
27 | */ | |
28 | public enum DatasetType | |
29 | { | |
30 | /** Category dataset type. */ | |
31 | CATEGORY("category"), | |
32 | /** Pie dataset type. */ | |
33 | PIE("pie"), | |
34 | /** XY dataset type. */ | |
35 | XY("xy"), | |
36 | /** Time table xy dataset type. */ | |
37 | TIMETABLE_XY("timetable_xy"); | |
38 | ||
39 | /** The name. */ | |
40 | private final String name; | |
41 | ||
42 | /** | |
43 | * @param name the name. | |
44 | */ | |
45 | 8 | DatasetType(String name) |
46 | { | |
47 | 8 | this.name = name; |
48 | } | |
49 | ||
50 | /** @return the name. */ | |
51 | 20 | public String getName() |
52 | { | |
53 | 20 | return name; |
54 | } | |
55 | ||
56 | /** | |
57 | * @param name A plot type. | |
58 | * @return the dataset type corresponding to the name, or {@code null}. | |
59 | */ | |
60 | 5 | public static DatasetType forName(String name) |
61 | { | |
62 | 5 | for (DatasetType type : values()) |
63 | { | |
64 | 20 | if (name.equals(type.getName())) { |
65 | 5 | return type; |
66 | } | |
67 | } | |
68 | ||
69 | 0 | return null; |
70 | } | |
71 | } |