OSDN Git Service

modify javadoc format.
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / pmd / parser / PmdParserExt2.java
1 /*
2  * pmd parser extensin 2
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.pmd.parser;
9
10 import java.io.IOException;
11 import java.io.InputStream;
12 import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
13 import jp.sfjp.mikutoga.pmd.PmdConst;
14
15 /**
16  * PMDモデルファイルのパーサ拡張その2。
17  *
18  * <p>※ 独自トゥーンテクスチャファイル名対応
19  */
20 public class PmdParserExt2 extends PmdParserExt1 {
21
22     private PmdToonHandler toonHandler = PmdUnifiedHandler.EMPTY;
23
24     /**
25      * コンストラクタ。
26      * @param source 入力ソース
27      */
28     public PmdParserExt2(InputStream source){
29         super(source);
30         return;
31     }
32
33     /**
34      * トゥーンテクスチャファイルハンドラを登録する。
35      * @param handler ハンドラ
36      */
37     public void setToonHandler(PmdToonHandler handler){
38         if(handler == null){
39             this.toonHandler = PmdUnifiedHandler.EMPTY;
40         }else{
41             this.toonHandler = handler;
42         }
43         return;
44     }
45
46     /**
47      * {@inheritDoc}
48      * @throws IOException {@inheritDoc}
49      * @throws MmdFormatException {@inheritDoc}
50      */
51     @Override
52     protected void parseBody()
53             throws IOException, MmdFormatException{
54         super.parseBody();
55
56         if(hasMore()){
57             parseToonName();
58         }
59
60         return;
61     }
62
63     /**
64      * 独自トゥーンテクスチャファイル名のパースと通知。
65      * @throws IOException IOエラー
66      * @throws MmdFormatException フォーマットエラー
67      */
68     private void parseToonName() throws IOException, MmdFormatException{
69         this.toonHandler.loopStart(PmdToonHandler.TOON_LIST,
70                                    PmdConst.TOON_FIXEDNUM );
71
72         for(int ct = 0; ct < PmdConst.TOON_FIXEDNUM; ct++){
73             String toonName =
74                     parsePmdText(PmdConst.MAXBYTES_TOONFILENAME);
75             this.toonHandler.pmdToonFileInfo(toonName);
76
77             this.toonHandler.loopNext(PmdToonHandler.TOON_LIST);
78         }
79
80         this.toonHandler.loopEnd(PmdToonHandler.TOON_LIST);
81
82         return;
83     }
84
85 }