Coverage report

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

1 |  |
     /*
2 |  |
      * "Peko" Visual Novel System
3 |  |
      *
4 |  |
      * All Rights Reserved.
5 |  |
      * Copyright (c) 1999-2003 Tsukuba Bunko.
6 |  |
      *
7 |  |
      * $Id: DimensionDeserializer.java,v 1.1 2005/07/11 12:49:18 ppoi Exp $
8 |  |
      */
9 |  |
     package tsukuba_bunko.peko.resource;
10 |  |
11 |  |
     import	java.awt.Dimension;
12 |  |
13 |  |
     import	org.xml.sax.SAXException;
14 |  |
15 |  |
     import	tsukuba_bunko.resource.SimpleDeserializer;
16 |  |
17 |  |
18 |  |
     /**
19 |  |
      * {@link java.awt.Dimension} 型のリソースに対する {@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:dimension">peko:dimension 型のリソース</a>
23 |  |
      */
24 |  |
     public class DimensionDeserializer	extends SimpleDeserializer	{
25 |  |
26 |  |
     	/**
27 |  |
     	 * <code>DimensionDeserializer</code> のインスタンスを作成します。
28 |  |
     	 */
29 |  |
     	public DimensionDeserializer()
30 |  |
     	{
31 | 0 |
     		super();
32 | 0 |
     	}
33 |  |
34 |  |
35 |  |
     //
36 |  |
     //	SimpleDeserializer の実装
37 |  |
     //
38 |  |
     	protected Object convertValue( String source )
39 |  |
     		throws SAXException
40 |  |
     	{
41 |  |
     		try	{
42 | 0 |
     			return DimensionDeserializer.parseDimension( source );
43 |  |
     		}
44 | 0 |
     		catch( Exception e )	{
45 | 0 |
     			throw new SAXException( e );
46 |  |
     		}
47 |  |
     	}
48 |  |
49 |  |
50 |  |
     	/**
51 |  |
     	 * <code>source</code> を Dimension として解析します。
52 |  |
     	 * @param	source	解析元の文字列
53 |  |
     	 * @return	解析結果
54 |  |
     	 */
55 |  |
     	public static Dimension parseDimension( String source )
56 |  |
     		throws IllegalArgumentException
57 |  |
     	{
58 |  |
     		try	{
59 | 0 |
     			int	delm = source.indexOf( ',' );
60 | 0 |
     			int	x = Integer.parseInt( source.substring(0, delm) );
61 | 0 |
     			int	y = Integer.parseInt( source.substring(delm + 1) );
62 | 0 |
     			return new Dimension( x, y );
63 |  |
     		}
64 | 0 |
     		catch( Exception e )	{
65 | 0 |
     			throw new IllegalArgumentException( e.getMessage() );
66 |  |
     		}
67 |  |
     	}
68 |  |
     }

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