OSDN Git Service

checkstyle対応
[mikutoga/Pmd2XML.git] / src / main / java / jp / sfjp / mikutoga / pmd / model / ShadeInfo.java
1 /*
2  * shading information
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.pmd.model;
9
10 /**
11  * シェーディング情報。
12  */
13 public class ShadeInfo {
14
15     private ToonMap toonMap = new ToonMap();
16     private int toonIdx;
17
18     private String textureFileName = null;
19     private String spheremapFileName = null;
20
21
22     /**
23      * コンストラクタ。
24      */
25     public ShadeInfo(){
26         super();
27         return;
28     }
29
30
31     /**
32      * トゥーンマップを設定する。
33      * @param map トゥーンマップ
34      */
35     public void setToonMap(ToonMap map){
36         this.toonMap = map;
37         return;
38     }
39
40     /**
41      * トゥーンマップを返す。
42      * @return トゥーンマップ
43      */
44     public ToonMap getToonMap(){
45         return this.toonMap;
46     }
47
48     /**
49      * トゥーンインデックスを設定する。
50      * @param idx トゥーンインデックス
51      */
52     public void setToonIndex(int idx){
53         this.toonIdx = idx;
54         return;
55     }
56
57     /**
58      * トゥーンインデックス値を返す。
59      * @return トゥーンインデックス値
60      */
61     public int getToonIndex(){
62         return this.toonIdx;
63     }
64
65     /**
66      * トゥーンインデックス値が有効か判定する。
67      * 現時点では0から9までの値を有効とする。
68      * @return 有効ならtrue
69      */
70     public boolean isValidToonIndex(){
71         boolean result;
72         result =   (0 <= this.toonIdx)
73                 &&      (this.toonIdx < ToonMap.MAX_CUSTOM_TOON);
74         return result;
75     }
76
77     /**
78      * トゥーンファイル名を返す。
79      * @return トゥーンファイル名
80      * @throws IllegalStateException トゥーンマップが設定されていない。
81      */
82     public String getToonFileName() throws IllegalStateException{
83         if(this.toonMap == null) throw new IllegalStateException();
84         String result = this.toonMap.getIndexedToon(this.toonIdx);
85         return result;
86     }
87
88     /**
89      * テクスチャファイル名を設定する。
90      * @param fileName テクスチャファイル名
91      */
92     public void setTextureFileName(String fileName){
93         this.textureFileName = fileName;
94         return;
95     }
96
97     /**
98      * テクスチャファイル名を返す。
99      * @return テクスチャファイル名
100      */
101     public String getTextureFileName(){
102         return this.textureFileName;
103     }
104
105     /**
106      * スフィアマップファイル名を設定する。
107      * @param fileName スフィアマップファイル名
108      */
109     public void setSpheremapFileName(String fileName){
110         this.spheremapFileName = fileName;
111         return;
112     }
113
114     /**
115      * スフィアマップファイル名を返す。
116      * @return スフィアマップファイル名
117      */
118     public String getSpheremapFileName(){
119         return this.spheremapFileName;
120     }
121
122     /**
123      * {@inheritDoc}
124      * @return {@inheritDoc}
125      */
126     @Override
127     public String toString(){
128         StringBuilder result = new StringBuilder();
129
130         result.append("toon(")
131               .append(this.toonIdx)
132               .append(")=")
133               .append(getToonFileName())
134               .append(' ');
135         result.append("texture=")
136               .append(this.textureFileName)
137               .append(' ');
138         result.append("sphere=")
139               .append(this.spheremapFileName);
140
141         return result.toString();
142     }
143
144 }