CheckId.java 3.02 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*-
 *  Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
 * 
 *  This file is part of CityDoctor2.
 *
 *  CityDoctor2 is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  CityDoctor2 is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with CityDoctor2.  If not, see <https://www.gnu.org/licenses/>.
 */
package de.hft.stuttgart.citydoctor2.check;

import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;

public enum CheckId {

	C_GE_R_TOO_FEW_POINTS("C_GE_R_TOO_FEW_POINTS"), C_GE_R_NOT_CLOSED("C_GE_R_NOT_CLOSED"),
	C_GE_S_MULTIPLE_CONNECTED_COMPONENTS("C_GE_S_MULTIPLE_CONNECTED_COMPONENTS"),
	C_GE_R_DUPLICATE_POINT("C_GE_R_DUPLICATE_POINT"), C_GE_R_SELF_INTERSECTION("C_GE_R_SELF_INTERSECTION"),
	C_GE_P_INTERIOR_DISCONNECTED("C_GE_P_INTERIOR_DISCONNECTED"),
	C_GE_P_INTERSECTING_RINGS("C_GE_P_INTERSECTING_RINGS"), C_GE_P_NON_PLANAR("C_GE_P_NON_PLANAR"),
	C_GE_S_TOO_FEW_POLYGONS("C_GE_S_TOO_FEW_POLYGONS"), NULL_AREA("C_GE_R_NULL_AREA"),
	C_GE_S_NOT_CLOSED("C_GE_S_NOT_CLOSED"), C_GE_S_NON_MANIFOLD_EDGE("C_GE_S_NON_MANIFOLD_EDGE"),
	C_GE_S_POLYGON_WRONG_ORIENTATION("C_GE_S_POLYGON_WRONG_ORIENTATION"),
	C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION("C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION"),
	C_GE_S_NON_MANIFOLD_VERTEX("C_GE_S_NON_MANIFOLD_VERTEX"), C_GE_S_SELF_INTERSECTION("C_GE_S_SELF_INTERSECTION"),
	C_GE_P_HOLE_OUTSIDE("C_GE_P_HOLE_OUTSIDE"), C_GE_P_ORIENTATION_RINGS_SAME("C_GE_P_ORIENTATION_RINGS_SAME"),
	C_GE_P_INNER_RINGS_NESTED("C_GE_P_INNER_RINGS_NESTED"), IS_CEILING("IS_CEILING"),
	C_SEM_F_MISSING_ID("C_SEM_F_MISSING_ID"), C_SEM_BS_NOT_CEILING("C_SEM_BS_NOT_CEILING"),
	C_SEM_BS_NOT_FLOOR("C_SEM_BS_NOT_FLOOR"), C_SEM_BS_NOT_GROUND("C_SEM_BS_NOT_GROUND"),
	C_SEM_BS_GROUND_NOT_FRAGMENTED("C_SEM_BS_GROUND_NOT_FRAGMENTED"), C_SEM_BS_IS_WALL("C_SEM_BS_IS_WALL"),
	C_SEM_SCHEMATRON("C_SEM_SCHEMATRON"), C_SEM_BS_ROOF_NOT_FRAGMENTED("C_SEM_BS_ROOF_NOT_FRAGMENTED");

	private static final Map<String, CheckId> ENUM_MAP;

	static {
		Map<String, CheckId> map = new TreeMap<>();
		for (CheckId instance : CheckId.values()) {
			map.put(instance.toString().toUpperCase(), instance);
		}
		ENUM_MAP = Collections.unmodifiableMap(map);
	}

	private String id;

	private CheckId(String id) {
		this.id = id;
	}

	@Override
	public String toString() {
		return id;
	}

	/**
	 * Converts a String to a check id if possible.
	 * 
	 * @param checkName the string representation of a check
	 * @return the check id or null if not found.
	 */
	public static CheckId getIdForName(String checkName) {
		return ENUM_MAP.get(checkName.toUpperCase());
	}
}