%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
tsukuba_bunko.peko.scenario.ElementHandler |
|
|
1 | /* |
|
2 | * "Peko" Visual Novel System |
|
3 | * |
|
4 | * All Rights Reserved. |
|
5 | * Copyright (c) 1999-2003 Tsukuba Bunko. |
|
6 | * |
|
7 | * $Id: ElementHandler.java,v 1.1 2005/07/11 12:49:18 ppoi Exp $ |
|
8 | */ |
|
9 | package tsukuba_bunko.peko.scenario; |
|
10 | ||
11 | import org.xml.sax.Attributes; |
|
12 | import org.xml.sax.SAXException; |
|
13 | ||
14 | import tsukuba_bunko.peko.PekoSystem; |
|
15 | ||
16 | ||
17 | /** |
|
18 | * PSML Scene 要素を処理するハンドラの基本機能を定義します。 |
|
19 | * @author $Author: ppoi $ |
|
20 | * @version $Revision: 1.1 $ |
|
21 | */ |
|
22 | public abstract class ElementHandler { |
|
23 | ||
24 | /** |
|
25 | * PSML 1.0 "Scene" XML Namespace URI |
|
26 | */ |
|
27 | public static final String NAMESPACE_SCENE = "http://tsukuba-bunko.org/ns/psml-scene"; |
|
28 | ||
29 | /** |
|
30 | * シーンコンテクスト |
|
31 | */ |
|
32 | 0 | protected SceneContext _context = null; |
33 | ||
34 | /** |
|
35 | * 親要素のハンドラ |
|
36 | */ |
|
37 | 0 | protected ElementHandler _parent = null; |
38 | ||
39 | /** |
|
40 | * シーンがこの要素の処理を以て終了するかどうか |
|
41 | */ |
|
42 | 0 | protected boolean _endOfScene = false; |
43 | ||
44 | ||
45 | /** |
|
46 | * <code>ElementHandler</code> のインスタンスを生成します。 |
|
47 | */ |
|
48 | protected ElementHandler() |
|
49 | { |
|
50 | 0 | super(); |
51 | 0 | } |
52 | ||
53 | /** |
|
54 | * シーンコンテクストを設定します。 |
|
55 | * @param context シーンコンテクスト |
|
56 | */ |
|
57 | public void setSceneContext( SceneContext context ) |
|
58 | { |
|
59 | 0 | _context = context; |
60 | 0 | } |
61 | ||
62 | /** |
|
63 | * シーンコンテクストを取得します。 |
|
64 | * @return シーンコンテクスト |
|
65 | */ |
|
66 | public SceneContext getSceneContext() |
|
67 | { |
|
68 | 0 | return _context; |
69 | } |
|
70 | ||
71 | /** |
|
72 | * 親要素を処理している ElementHandler を設定します。 |
|
73 | * @param handler 親要素のハンドラ |
|
74 | */ |
|
75 | public void setParentHandler( ElementHandler handler ) |
|
76 | { |
|
77 | 0 | _parent = handler; |
78 | 0 | } |
79 | ||
80 | /** |
|
81 | * 親要素を処理している ElementHandler を取得します。 |
|
82 | * @return 親要素のハンドラ |
|
83 | */ |
|
84 | public ElementHandler getParentHandler() |
|
85 | { |
|
86 | 0 | return _parent; |
87 | } |
|
88 | ||
89 | /** |
|
90 | * シーンがこの要素の処理を以て終了するかどうかを設定します。 |
|
91 | * @param end シーンが終了する場合 <code>true</code>、それ以外の場合 <code>false</code> |
|
92 | */ |
|
93 | protected void setEndOfScene( boolean end ) |
|
94 | { |
|
95 | 0 | _endOfScene = end; |
96 | 0 | } |
97 | ||
98 | /** |
|
99 | * シーンがこの要素の処理を以て終了するかどうかを判定します。 |
|
100 | * @return シーンが終了する場合 <code>true</code>、それ以外の場合 <code>false</code> |
|
101 | */ |
|
102 | public boolean isEndOfScene() |
|
103 | { |
|
104 | 0 | return _endOfScene; |
105 | } |
|
106 | ||
107 | /** |
|
108 | * 処理を一時停止します。 |
|
109 | * @param wait 最大停止時間 |
|
110 | */ |
|
111 | protected void stop( long wait ) |
|
112 | { |
|
113 | 0 | if( _context != null ) { |
114 | 0 | if( _context.getSceneProcessor().isAborted() ) { |
115 | 0 | return; |
116 | } |
|
117 | 0 | tsukuba_bunko.peko.Logger.debug( "[scenario.handler] stop using ElementHandler#stop(wait)." ); |
118 | 0 | PekoSystem.getInstance().getActionControler().stop( wait ); |
119 | } |
|
120 | 0 | } |
121 | ||
122 | /** |
|
123 | * 処理をユーザーのアクションがあるまで一時停止します。 |
|
124 | */ |
|
125 | protected void stop() |
|
126 | { |
|
127 | 0 | if( _context != null ) { |
128 | 0 | if( _context.getSceneProcessor().isAborted() ) { |
129 | 0 | return; |
130 | } |
|
131 | 0 | tsukuba_bunko.peko.Logger.debug( "[scenario.handler] stop using ElementHandler#stop()." ); |
132 | 0 | PekoSystem.getInstance().getActionControler().stop(); |
133 | } |
|
134 | 0 | } |
135 | ||
136 | ||
137 | // |
|
138 | // SAX ContentHandler |
|
139 | // |
|
140 | public void startDocument() |
|
141 | throws SAXException |
|
142 | { |
|
143 | 0 | } |
144 | ||
145 | public void endDocument() |
|
146 | throws SAXException |
|
147 | { |
|
148 | 0 | } |
149 | ||
150 | public void startElement( String namespaceURI, String localName, String qName, Attributes attrs ) |
|
151 | throws SAXException |
|
152 | { |
|
153 | 0 | } |
154 | ||
155 | public void endElement( String namespaceURI, String localName, String qName ) |
|
156 | throws SAXException |
|
157 | { |
|
158 | 0 | } |
159 | ||
160 | public void characters( char[] ch, int begin, class="keyword">int length ) |
|
161 | throws SAXException |
|
162 | { |
|
163 | 0 | } |
164 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |