Coverage report

  %line %branch
tsukuba_bunko.peko.scenario.util.FlagHandler
0% 
0% 

 1  
 /*
 2  
  * "Peko" Visual Novel System
 3  
  *
 4  
  * All Rights Reserved.
 5  
  * Copyright (c) 1999-2003 Tsukuba Bunko.
 6  
  *
 7  
  * $Id: FlagHandler.java,v 1.1 2005/07/11 12:49:19 ppoi Exp $
 8  
  */
 9  
 package tsukuba_bunko.peko.scenario.util;
 10  
 
 11  
 import	org.xml.sax.Attributes;
 12  
 
 13  
 import	tsukuba_bunko.peko.Logger;
 14  
 
 15  
 import	tsukuba_bunko.peko.scenario.ElementHandler;
 16  
 import	tsukuba_bunko.peko.scenario.FlagScope;
 17  
 import	tsukuba_bunko.peko.scenario.PSMLUtil;
 18  
 
 19  
 
 20  
 /**
 21  
  * <samp>flag</samp> 要素を処理する ElementHandler 実装です。
 22  
  * @author	$Author: ppoi $
 23  
  * @version	$Revision: 1.1 $
 24  
  */
 25  
 public class FlagHandler	extends ElementHandler	{
 26  
 
 27  
 	/**
 28  
 	 * フラグ ID
 29  
 	 */
 30  0
 	private String	_flagID = null;
 31  
 
 32  
 	/**
 33  
 	 * フラグスコープ
 34  
 	 */
 35  0
 	private FlagScope	_scope = null;
 36  
 
 37  
 	/**
 38  
 	 * フラグを立てるか降ろすか
 39  
 	 */
 40  0
 	private boolean	_declare = true;
 41  
 
 42  
 
 43  
 	/**
 44  
 	 * <code>FlagHandler</code> のインスタンスを生成します。
 45  
 	 */
 46  
 	public FlagHandler()
 47  
 	{
 48  0
 		super();
 49  0
 	}
 50  
 
 51  
 
 52  
 //
 53  
 //	ContentHandler の実装
 54  
 //
 55  
 	public void startDocument()
 56  
 	{
 57  0
 		_flagID = null;
 58  0
 		_declare = true;
 59  0
 		_scope = null;
 60  0
 	}
 61  
 
 62  
 	public void endDocument()
 63  
 	{
 64  0
 		if( _flagID != null )	{
 65  0
 			if( _declare )	{
 66  0
 				getSceneContext().declareFlag( _flagID, _scope );
 67  0
 			}
 68  
 			else	{
 69  0
 				getSceneContext().undeclareFlag( _flagID, _scope );
 70  
 			}
 71  
 		}
 72  0
 	}
 73  
 
 74  
 	public void startElement( String namespaceURI, String localname, String qName, Attributes attrs )
 75  
 	{
 76  0
 		String	flagID = PSMLUtil.getAttributeValue( attrs, "id" );
 77  0
 		if( flagID == null )	{
 78  0
 			Logger.error( MessageIDs.SCN6002W, new Object[]{getSceneContext().getCurrentPath()} );
 79  0
 		}
 80  
 		else	{
 81  0
 			_flagID = flagID;
 82  
 		}
 83  
 
 84  0
 		String	scope = PSMLUtil.getAttributeValue( attrs, "scope" );
 85  0
 		if( "scene".equals(scope) )	{
 86  0
 			_scope = FlagScope.SCENE;
 87  0
 		}
 88  0
 		else if( "session".equals(scope) )	{
 89  0
 			_scope = FlagScope.SESSION;
 90  0
 		}
 91  0
 		else if( "system".equals(scope) )	{
 92  0
 			_scope = FlagScope.SYSTEM;
 93  0
 		}
 94  
 		else	{
 95  0
 			Logger.error( MessageIDs.SCN6003W, new Object[]{((scope == null)?"null":scope), getSceneContext().getCurrentPath()} );
 96  0
 			_flagID = null;
 97  
 		}
 98  
 
 99  0
 		String	action = PSMLUtil.getAttributeValue( attrs, "action" );
 100  0
 		if( action != null )	{
 101  0
 			if( "undeclare".equals(action) )	{
 102  0
 				_declare = false;
 103  0
 			}
 104  0
 			else if( "declare".equals(action) )	{
 105  0
 				_declare = true;
 106  0
 			}
 107  
 			else	{
 108  0
 				Logger.warn( MessageIDs.SCN6004W, new Object[]{getSceneContext().getCurrentPath()} );
 109  0
 				_flagID = null;
 110  
 			}
 111  0
 		}
 112  
 		else	{
 113  0
 			_declare = true;
 114  
 		}
 115  0
 	}
 116  
 }

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