Coverage report

| %line | %branch
--- | --- | ---
tsukuba_bunko.peko.resource.LocaleDeserializer |
0% |
0% |

1 |  |
     /*
2 |  |
      * "Peko" Visual Novel System
3 |  |
      *
4 |  |
      * All Rights Reserved.
5 |  |
      * Copyright (c) 1999-2003 Tsukuba Bunko.
6 |  |
      *
7 |  |
      * $Id: LocaleDeserializer.java,v 1.1 2005/07/11 12:49:19 ppoi Exp $
8 |  |
      */
9 |  |
     package tsukuba_bunko.peko.resource;
10 |  |
11 |  |
     import	java.util.Locale;
12 |  |
13 |  |
     import	org.xml.sax.Attributes;
14 |  |
15 |  |
     import tsukuba_bunko.resource.BasicDeserializer;
16 |  |
17 |  |
18 |  |
     /**
19 |  |
      * {@link java.util.Locale} 型のリソースに対する {@link tsukuba_bunko.resource.ResourceDeserializer} 実装です。
20 |  |
      * @author	$Author: ppoi $
21 |  |
      * @version	$Revision: 1.1 $
22 |  |
      * @see <a href="http://softlab.tsukuba-bunko.org/peko/userguide/resource.html#type-peko:locale">peko:locale 型のリソース</a>
23 |  |
      */
24 |  |
     public class LocaleDeserializer extends BasicDeserializer {
25 |  |
26 |  |
     	/**
27 |  |
     	 * テキスト
28 |  |
     	 */
29 | 0 |
     	private StringBuffer	_text = null;
30 |  |
31 |  |
     	/**
32 |  |
     	 * 国コード
33 |  |
     	 */
34 | 0 |
     	private String	_country = null;
35 |  |
36 |  |
     	/**
37 |  |
     	 * 言語コード
38 |  |
     	 */
39 | 0 |
     	private String	_language = null;
40 |  |
41 |  |
42 |  |
     	/**
43 |  |
     	 * <code>LocaleDeserializer</code> のインスタンスを生成します。
44 |  |
     	 */
45 |  |
     	public LocaleDeserializer()
46 |  |
     	{
47 | 0 |
     		super();
48 | 0 |
     	}
49 |  |
50 |  |
51 |  |
     //
52 |  |
     //	ContentHandler の実装
53 |  |
     //
54 |  |
     	public void startDocument()
55 |  |
     	{
56 | 0 |
     		_country = null;
57 | 0 |
     		_language = null;
58 | 0 |
     	}
59 |  |
60 |  |
     	public void endDocument()
61 |  |
     	{
62 | 0 |
     		if( _language != null )	{
63 | 0 |
     			if( _country != null )	{
64 | 0 |
     				setValue( new Locale(_language, _country) );
65 | 0 |
     			}
66 |  |
     			else	{
67 | 0 |
     				setValue( new Locale(_language) );
68 |  |
     			}
69 | 0 |
     		}
70 |  |
     		else	{
71 | 0 |
     			setValue( Locale.getDefault() );
72 |  |
     		}
73 | 0 |
     	}
74 |  |
75 |  |
     	public void startElement( String namespaceURI, String localName, String qName, Attributes attrs )
76 |  |
     	{
77 | 0 |
     		if( "language".equals(localName) || "country".equals(localName) )	{
78 | 0 |
     			_text = new StringBuffer();
79 |  |
     		}
80 | 0 |
     	}
81 |  |
82 |  |
     	public void endElement( String namespaceURI, String localName, String qName )
83 |  |
     	{
84 | 0 |
     		if( "language".equals(localName) )	{
85 | 0 |
     			String	language = new String(_text).trim();
86 | 0 |
     			if( language.length() > 0 )	{
87 | 0 |
     				_language = language;
88 |  |
     			}
89 | 0 |
     		}
90 | 0 |
     		else if( "country".equals(localName) )	{
91 | 0 |
     			String	country = new String(_text).trim();
92 | 0 |
     			if( country.length() > 0 )	{
93 | 0 |
     				_country = country;
94 |  |
     			}
95 |  |
     		}
96 | 0 |
     		_text = null;
97 | 0 |
     	}
98 |  |
99 |  |
     	public void characters( char[] ch, int begin, class="keyword">int length )
100 |  |
     	{
101 | 0 |
     		if( _text != null )	{
102 | 0 |
     			_text.append( ch, begin, length );
103 |  |
     		}
104 | 0 |
     	}
105 |  |
     }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.