Coverage report

  %line %branch
tsukuba_bunko.peko.scenario.NextSceneMapping
0% 
0% 

 1  
 /*
 2  
  * All Rights Reserved.
 3  
  * Copyright (C) 1999-2005 Tsukuba Bunko.
 4  
  *
 5  
  * Licensed under the BSD License ("the License"); you may not use
 6  
  * this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  *       http://www.tsukuba-bunko.org/licenses/LICENSE.txt
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  *
 17  
  * $Id: NextSceneMapping.java,v 1.2 2005/07/23 18:56:03 ppoi Exp $
 18  
  */
 19  
 package tsukuba_bunko.peko.scenario;
 20  
 
 21  
 import	java.io.Serializable;
 22  
 
 23  
 import	java.util.Iterator;
 24  
 import	java.util.List;
 25  
 import	java.util.Map;
 26  
 
 27  
 import	tsukuba_bunko.peko.Logger;
 28  
 
 29  
 
 30  
 /**
 31  
  * @author	${Author}$
 32  
  * @version	${Revision}$
 33  
  */
 34  
 public class NextSceneMapping	implements Serializable	{
 35  
 
 36  
 	/**
 37  
 	 * serial version UID
 38  
 	 */
 39  
 	private static final long	serialVersionUID	= -3896489854104011813L;
 40  
 
 41  
 	/**
 42  
 	 * 評価の順番
 43  
 	 */
 44  0
 	private List	_conditionList = new java.util.ArrayList();
 45  
 
 46  
 	/**
 47  
 	 * シーン遷移先表
 48  
 	 */
 49  0
 	private Map	_nextScenes = new java.util.HashMap();
 50  
 
 51  
 
 52  
 	/**
 53  
 	 * <code>NextSceneMapping</code> のインスタンスを生成します。
 54  
 	 */
 55  
 	public NextSceneMapping()
 56  0
 	{
 57  0
 	}
 58  
 
 59  
 
 60  
 	public void addNextSceneMapping( String condition, String nextScene )
 61  
 	{
 62  0
 		if( _conditionList.contains(condition) )	{
 63  0
 			Logger.warn( MessageIDs.SCN0010W, new Object[]{condition, _nextScenes.get(condition), nextScene} );
 64  0
 		}
 65  
 		else	{
 66  0
 			_conditionList.add( condition );
 67  0
 			_nextScenes.put( condition, nextScene );
 68  
 		}
 69  0
 	}
 70  
 
 71  
 	public void setDefaultSceneMapping( String nextScene )
 72  
 	{
 73  0
 		setDefaultSceneMapping( nextScene, true );
 74  0
 	}
 75  
 
 76  
 	public void setDefaultSceneMapping( String nextScene, boolean warn )
 77  
 	{
 78  0
 		if( _nextScenes.containsKey(null) && warn )	{
 79  0
 			Logger.warn( MessageIDs.SCN0010W, new Object[]{"_default_", _nextScenes.get(null), nextScene} );
 80  0
 		}
 81  
 		else	{
 82  0
 			_nextScenes.put( null, nextScene );
 83  
 		}
 84  0
 	}
 85  
 
 86  
 	public String getNextScene( SceneContext context )
 87  
 	{
 88  0
 		Iterator	itr = _conditionList.iterator();
 89  0
 		String	condition = null;
 90  0
 		while( itr.hasNext() )	{
 91  0
 			condition = (String)itr.next();
 92  0
 			if( PSMLUtil.isEvaluatable(condition, context) )	{
 93  0
 				return (String)_nextScenes.get( condition );
 94  
 			}
 95  
 		}
 96  0
 		return (String)_nextScenes.get( null );
 97  
 	}
 98  
 }

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