OSDN Git Service

e0cbc4db2a0c2fc9445f0785179c9e0563a1ddc0
[mikutoga/Vmd2XML.git] / src / main / java / jp / sfjp / mikutoga / vmd / model / xml / VmdTag.java
1 /*
2  * tags of vmd xml file
3  *
4  * License : The MIT License
5  * Copyright(c) 2013 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.vmd.model.xml;
9
10 import java.util.HashMap;
11 import java.util.Map;
12
13 /**
14  * XML要素名一覧。
15  */
16 enum VmdTag {
17
18     VMD_MOTION     ("vmdMotion"),
19     META           ("meta"),
20     MODEL_NAME     ("modelName"),
21
22     BONE_M_SEQUENCE("boneMotionSequence"),
23     BONE_PART      ("bonePart"),
24     BONE_MOTION    ("boneMotion"),
25     BONE_POSITION  ("bonePosition"),
26     BONE_ROT_QUAT  ("boneRotQuat"),
27     BONE_ROT_EYXZ  ("boneRotEyxz"),
28
29     MORPH_SEQUENCE ("morphSequence"),
30     MORPH_PART     ("morphPart"),
31     MORPH_MOTION   ("morphMotion"),
32
33     CAMERA_SEQUENCE("cameraSequence"),
34     CAMERA_MOTION  ("cameraMotion"),
35     CAMERA_TARGET  ("cameraTarget"),
36     CAMERA_ROTATION("cameraRotation"),
37     CAMERA_RANGE   ("cameraRange"),
38     PROJECTION     ("projection"),
39
40     LUMI_SEQUENCE  ("luminousSequence"),
41     LUMINOUS_ACT   ("luminousAct"),
42     LUMI_COLOR     ("lumiColor"),
43     LUMI_DIRECTION ("lumiDirection"),
44
45     SHADOW_SEQUENCE("shadowSequence"),
46     SHADOW_ACT     ("shadowAct"),
47
48     BEZIER         ("bezier"),
49     DEF_LINEAR     ("defLinear"),
50     DEF_EASE_IN_OUT("defEaseInOut"),
51
52     ;
53
54
55     private static final Map<String, VmdTag> NAME_MAP =
56             new HashMap<String, VmdTag>();
57
58     static{
59         for(VmdTag tag : values()){
60             NAME_MAP.put(tag.tag(), tag);
61         }
62     }
63
64
65     private final String tagName;
66
67
68     /**
69      * コンストラクタ。
70      * @param tagName 要素名
71      */
72     private VmdTag(String tagName){
73         this.tagName = tagName.intern();
74         return;
75     }
76
77
78     /**
79      * XML要素名から列挙子を得る。
80      * @param name 要素名
81      * @return 列挙子。合致する物がなければnull。
82      */
83     static VmdTag parse(String name){
84         VmdTag result;
85         result = NAME_MAP.get(name);
86         return result;
87     }
88
89
90     /**
91      * XML要素名を返す。
92      * @return 要素名
93      */
94     String tag(){
95         return this.tagName;
96     }
97
98 }