View Javadoc

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: SaveData.java,v 1.2 2005/07/23 19:06:28 ppoi Exp $
18   */
19  package tsukuba_bunko.peko.session;
20  
21  import	java.io.Serializable;
22  
23  import	java.util.Map;
24  
25  
26  /***
27   * セーブデータです。
28   * @author	$Author: ppoi $
29   * @version	$Revision: 1.2 $
30   */
31  public class SaveData	implements Serializable	{
32  
33  	/***
34  	 * serial version UID
35  	 */
36  	private static final long	serialVersionUID	= 4620578133330608340L;
37  
38  	/***
39  	 * セーブデータ情報
40  	 */
41  	protected SaveDataInfo	_info = null;
42  
43  	/***
44  	 * セッション
45  	 */
46  	protected Session	_session = null;
47  
48  	/***
49  	 * セーブデータエントリ
50  	 */
51  	protected Map	_entries = new java.util.HashMap( 17 );
52  
53  
54  	/***
55  	 * <code>SaveData</code> のインスタンスを生成します。
56  	 */
57  	public SaveData()
58  	{
59  		super();
60  	}
61  
62  	/***
63  	 * セーブデータ情報を設定します。
64  	 * @param	info	セーブデータ情報
65  	 */
66  	public void setSaveDataInfo( SaveDataInfo info )
67  	{
68  		_info = info;
69  	}
70  
71  	/***
72  	 * セーブデータ情報を取得します。
73  	 * @return	セーブデータ情報
74  	 */
75  	public SaveDataInfo getSaveDataInfo()
76  	{
77  		return _info;
78  	}
79  
80  	/***
81  	 * 保存するセッションを設定します。
82  	 * @param	session	保存するセッション
83  	 */
84  	public void setSession( Session session )
85  	{
86  		_session = session;
87  	}
88  
89  	/***
90  	 * 保存するセッションを取得します。
91  	 * @return	保存するセッション
92  	 */
93  	public Session getSession()
94  	{
95  		return _session;
96  	}
97  
98  	/***
99  	 * セーブデータにエントリを追加します。
100 	 * @param	name	エントリ名
101 	 * @param	entry	エントリ
102 	 */
103 	public void addEntry( String name, Serializable entry )
104 	{
105 		_entries.put( name, entry );
106 	}
107 
108 	/***
109 	 * セーブデータ中のエントリを取得します。
110 	 * @param	name	エントリ名
111 	 * @return	エントリ
112 	 */
113 	public Serializable getEntry( String name )
114 	{
115 		return (Serializable)_entries.get( name );
116 	}
117 }