1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-02 00:20:49 +00:00
plantuml/src/net/sourceforge/plantuml/abel/LeafType.java

103 lines
3.1 KiB
Java
Raw Normal View History

2010-11-15 20:35:36 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2023-02-22 18:43:48 +00:00
* (C) Copyright 2009-2024, Arnaud Roques
2010-11-15 20:35:36 +00:00
*
2023-02-22 18:43:48 +00:00
* Project Info: https://plantuml.com
*
2017-03-15 19:13:31 +00:00
* If you like this project or if you find it useful, you can support us at:
*
2023-02-22 18:43:48 +00:00
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
2010-11-15 20:35:36 +00:00
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2013-12-10 19:36:50 +00:00
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
2010-11-15 20:35:36 +00:00
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
* Contribution : Hisashi Miyashita
2020-05-18 20:01:37 +00:00
* Contribution : Serge Wenger
* Contribution : The-Lum
2010-11-15 20:35:36 +00:00
*
*/
2023-02-22 18:43:48 +00:00
package net.sourceforge.plantuml.abel;
2010-11-15 20:35:36 +00:00
2022-12-17 11:10:05 +00:00
import net.sourceforge.plantuml.StringUtils;
2013-12-10 19:36:50 +00:00
public enum LeafType {
2010-11-15 20:35:36 +00:00
EMPTY_PACKAGE,
2023-02-22 18:43:48 +00:00
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, PROTOCOL, STRUCT, EXCEPTION, METACLASS, STEREOTYPE, LOLLIPOP_FULL,
LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION, ENUM, CIRCLE,
2020-12-14 18:31:06 +00:00
2020-10-12 20:56:58 +00:00
USECASE, USECASE_BUSINESS,
2013-12-10 19:36:50 +00:00
2015-04-07 18:18:37 +00:00
DESCRIPTION,
2013-12-10 19:36:50 +00:00
ARC_CIRCLE,
2010-11-15 20:35:36 +00:00
ACTIVITY, BRANCH, SYNCHRO_BAR, CIRCLE_START, CIRCLE_END, POINT_FOR_ASSOCIATION, ACTIVITY_CONCURRENT,
2020-05-18 20:01:37 +00:00
STATE, STATE_CONCURRENT, PSEUDO_STATE, DEEP_HISTORY, STATE_CHOICE, STATE_FORK_JOIN,
2010-11-15 20:35:36 +00:00
2017-01-21 22:25:28 +00:00
BLOCK, ENTITY,
2020-12-14 18:31:06 +00:00
2018-05-21 19:15:19 +00:00
DOMAIN, REQUIREMENT,
2020-12-14 18:31:06 +00:00
2022-09-01 17:40:58 +00:00
PORTIN, PORTOUT,
2010-11-15 20:35:36 +00:00
2023-11-16 05:49:00 +00:00
CHEN_ENTITY, CHEN_RELATIONSHIP, CHEN_ATTRIBUTE, CHEN_CIRCLE,
2023-11-15 22:29:37 +00:00
2013-12-10 19:36:50 +00:00
STILL_UNKNOWN;
2010-11-15 20:35:36 +00:00
2017-04-05 17:37:42 +00:00
public static LeafType getLeafType(String type) {
type = StringUtils.goUpperCase(type);
2022-08-26 16:00:28 +00:00
if (type.startsWith("ABSTRACT"))
2013-12-10 19:36:50 +00:00
return LeafType.ABSTRACT_CLASS;
2022-08-26 16:00:28 +00:00
if (type.startsWith("DIAMOND"))
2018-10-21 19:44:14 +00:00
return LeafType.STATE_CHOICE;
2022-08-26 16:00:28 +00:00
if (type.startsWith("STATIC"))
return LeafType.CLASS;
2017-04-05 17:37:42 +00:00
return LeafType.valueOf(type);
2013-12-10 19:36:50 +00:00
}
public boolean isLikeClass() {
return this == LeafType.ANNOTATION || this == LeafType.ABSTRACT_CLASS || this == LeafType.CLASS
2022-08-24 16:46:33 +00:00
|| this == LeafType.INTERFACE || this == LeafType.ENUM || this == LeafType.ENTITY
|| this == LeafType.PROTOCOL || this == LeafType.STRUCT || this == LeafType.EXCEPTION
|| this == LeafType.METACLASS || this == LeafType.STEREOTYPE;
2013-12-10 19:36:50 +00:00
}
public String toHtml() {
2015-04-07 18:18:37 +00:00
final String html = StringUtils.goLowerCase(toString().replace('_', ' '));
2013-12-10 19:36:50 +00:00
return StringUtils.capitalize(html);
2010-11-15 20:35:36 +00:00
}
2020-12-14 18:31:06 +00:00
// public boolean manageModifier() {
// if (this == ANNOTATION || this == ABSTRACT_CLASS || this == CLASS || this == INTERFACE || this == ENUM
// || this == OBJECT || this == ENTITY) {
// return true;
// }
// return false;
// }
2010-11-15 20:35:36 +00:00
}