• R/O
  • SSH
  • HTTPS

moltonf: Commit


Commit MetaInfo

Revision7 (tree)
Time2010-12-18 22:56:36
Authorhironytic

Log Message

登場人物の役職を保持できるようにモデルを変更。
プレイデータアーカイブのファイルから読み込む際に役職も読み込むようにした。

得られる情報を制限した Story オブジェクトを実装途中。

Change Summary

Incremental Difference

--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/Role.java (nonexistent)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/Role.java (revision 7)
@@ -0,0 +1,56 @@
1+/*
2+ * Moltonf
3+ *
4+ * Copyright (c) 2010 Project Moltonf
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining
7+ * a copy of this software and associated documentation files (the
8+ * "Software"), to deal in the Software without restriction, including
9+ * without limitation the rights to use, copy, modify, merge, publish,
10+ * distribute, sublicense, and/or sell copies of the Software, and to
11+ * permit persons to whom the Software is furnished to do so, subject to
12+ * the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included
15+ * in all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+ */
25+
26+package com.hironytic.moltonf.model;
27+
28+/**
29+ * 役職を表す列挙型です。
30+ */
31+public enum Role {
32+
33+ /** 村人 */
34+ INNOCENT,
35+
36+ /** 狼 */
37+ WOLF,
38+
39+ /** 占い師 */
40+ SEER,
41+
42+ /** 霊能者 */
43+ SHAMAN,
44+
45+ /** 狂人 */
46+ MADMAN,
47+
48+ /** 狩人 */
49+ HUNTER,
50+
51+ /** 共有者 */
52+ FRATER,
53+
54+ /** ハムスター人間 */
55+ HAMSTER,
56+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/archive/ArchivedStoryLoader.java (revision 6)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/archive/ArchivedStoryLoader.java (revision 7)
@@ -47,6 +47,7 @@
4747 import com.hironytic.moltonf.MoltonfException;
4848 import com.hironytic.moltonf.model.Avatar;
4949 import com.hironytic.moltonf.model.EventFamily;
50+import com.hironytic.moltonf.model.Role;
5051 import com.hironytic.moltonf.model.Story;
5152 import com.hironytic.moltonf.model.StoryElement;
5253 import com.hironytic.moltonf.model.StoryEvent;
@@ -444,7 +445,8 @@
444445 storyEvent.setStoryPeriod(period);
445446 storyEvent.setEventFamily(eventFamily);
446447
447- List<String> messageLines = new ArrayList<String>();
448+ List<String> messageLines = new ArrayList<String>();
449+ QName storyEventElemName = staxReader.getName();
448450
449451 // 子ノード
450452 while (staxReader.hasNext()) {
@@ -455,6 +457,9 @@
455457 QName elemName = staxReader.getName();
456458 if (SchemaConstants.NAME_LI.equals(elemName)) {
457459 messageLines.add(loadLi());
460+ } else if (SchemaConstants.NAME_PLAYER_LIST.equals(storyEventElemName) &&
461+ SchemaConstants.NAME_PLAYER_INFO.equals(elemName)) {
462+ loadPlayerInfo();
458463 } else {
459464 skipElement();
460465 }
@@ -466,6 +471,72 @@
466471 }
467472
468473 /**
474+ * playerInfo 要素以下を読み込みます。
475+ * このメソッドが呼ばれたとき staxReader は playerInfo 要素の START_ELEMENT にいることが前提です。
476+ * @throws XMLStreamException 読み込み時にエラーが発生した場合
477+ */
478+ private void loadPlayerInfo() throws XMLStreamException {
479+ // playerInfo のうち、role 属性で示される役職を読み込んで
480+ // avatarId 属性で示されるアバターの Avatar オブジェクトに役職をセットする
481+
482+ String avatarId = null;
483+ String roleString = null;
484+
485+ // 属性
486+ for (int ix = 0; ix < staxReader.getAttributeCount(); ++ix) {
487+ QName attrName = staxReader.getAttributeName(ix);
488+ if (SchemaConstants.NAME_AVATAR_ID.equals(attrName)) {
489+ avatarId = staxReader.getAttributeValue(ix);
490+ } else if (SchemaConstants.NAME_ROLE.equals(attrName)) {
491+ roleString = staxReader.getAttributeValue(ix);
492+ }
493+ if (avatarId != null && roleString != null) {
494+ break;
495+ }
496+ }
497+
498+ if (avatarId != null && roleString != null) {
499+ // スキーマとして avatarList が先に登場することが保証されているので
500+ // 正しいデータならこの時点で avatarMap は作成済み。
501+ Avatar avatar = avatarMap.get(avatarId);
502+ if (avatar != null) {
503+ avatar.setRole(toRole(roleString));
504+ }
505+ }
506+
507+ skipElement();
508+ }
509+
510+ /**
511+ * 役職の値文字列を Role に変換します。
512+ * @param roleString 役職の値文字列 (role 属性の値)
513+ * @return Role。該当するものがなければ null。
514+ */
515+ private Role toRole(String roleString) {
516+ Role role = null;
517+ if (SchemaConstants.VAL_ROLE_INNOCENT.equals(roleString)) {
518+ role = Role.INNOCENT;
519+ } else if (SchemaConstants.VAL_ROLE_WOLF.equals(roleString)) {
520+ role = Role.WOLF;
521+ } else if (SchemaConstants.VAL_ROLE_SEER.equals(roleString)) {
522+ role = Role.SEER;
523+ } else if (SchemaConstants.VAL_ROLE_SHAMAN.equals(roleString)) {
524+ role = Role.SHAMAN;
525+ } else if (SchemaConstants.VAL_ROLE_MADMAN.equals(roleString)) {
526+ role = Role.MADMAN;
527+ } else if (SchemaConstants.VAL_ROLE_HUNTER.equals(roleString)) {
528+ role = Role.HUNTER;
529+ } else if (SchemaConstants.VAL_ROLE_FRATER.equals(roleString)) {
530+ role = Role.FRATER;
531+ } else if (SchemaConstants.VAL_ROLE_HAMSTER.equals(roleString)) {
532+ role = Role.HAMSTER;
533+ } else {
534+ Moltonf.getLogger().warning("invalid role : role=\"" + roleString + "\"");
535+ }
536+ return role;
537+ }
538+
539+ /**
469540 * assault 要素以下を読み込みます。
470541 * このメソッドが呼ばれたとき staxReader は assault 要素の START_ELEMENT にいることが前提です。
471542 * @param period 読み込んだ WolfAttackTalk が所属する StoryPeriod。
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/archive/SchemaConstants.java (revision 6)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/archive/SchemaConstants.java (revision 7)
@@ -95,8 +95,8 @@
9595 /** avatarId 属性の QName */
9696 public static final QName NAME_AVATAR_ID = new QName("avatarId");
9797
98- /** fullName 属性の QName */
99- //public static final QName NAME_FULL_NAME = new QName("fullName"); // 既に定義されているので省略
98+// /** fullName 属性の QName */
99+// public static final QName NAME_FULL_NAME = new QName("fullName"); // 既に定義されているので省略
100100
101101 /** shortName 属性の QName */
102102 public static final QName NAME_SHORT_NAME = new QName("shortName");
@@ -234,8 +234,8 @@
234234 /** 発言種別:青発言 */
235235 public static final String VAL_TALK_TYPE_GRAVE = "grave";
236236
237- /** avatarId 属性の QName */
238- //public static final QName NAME_AVATAR_ID = new QName("avatarId"); // 既に定義されているので省略
237+// /** avatarId 属性の QName */
238+// public static final QName NAME_AVATAR_ID = new QName("avatarId"); // 既に定義されているので省略
239239
240240 /** time 属性の QName */
241241 public static final QName NAME_TIME = new QName("time");
@@ -248,4 +248,43 @@
248248
249249 /** li 要素の QName */
250250 public static final QName NAME_LI = new QName(NS_ARCHIVE, "li");
251+
252+ /*
253+ * --------------------------------------------------
254+ * playerInfo
255+ * --------------------------------------------------
256+ */
257+
258+ /** playerInfo 要素の QName */
259+ public static final QName NAME_PLAYER_INFO = new QName(NS_ARCHIVE, "playerInfo");
260+
261+// /** avatarId 属性の QName */
262+// public static final QName NAME_AVATAR_ID = new QName("avatarId"); // 既に定義されているので省略
263+
264+ /** role 要素の QName */
265+ public static final QName NAME_ROLE = new QName("role");
266+
267+ /** 役職:村人 */
268+ public static final String VAL_ROLE_INNOCENT = "innocent";
269+
270+ /** 役職:狼 */
271+ public static final String VAL_ROLE_WOLF = "wolf";
272+
273+ /** 役職:占い師 */
274+ public static final String VAL_ROLE_SEER = "seer";
275+
276+ /** 役職:霊能者 */
277+ public static final String VAL_ROLE_SHAMAN = "shaman";
278+
279+ /** 役職:狂人 */
280+ public static final String VAL_ROLE_MADMAN = "madman";
281+
282+ /** 役職:狩人 */
283+ public static final String VAL_ROLE_HUNTER = "hunter";
284+
285+ /** 役職:共有者 */
286+ public static final String VAL_ROLE_FRATER = "frater";
287+
288+ /** 役職:ハムスター人間 */
289+ public static final String VAL_ROLE_HAMSTER = "hamster";
251290 }
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/basic/BasicAvatar.java (revision 6)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/basic/BasicAvatar.java (revision 7)
@@ -29,6 +29,7 @@
2929 import java.net.URI;
3030
3131 import com.hironytic.moltonf.model.Avatar;
32+import com.hironytic.moltonf.model.Role;
3233 import com.hironytic.moltonf.model.Story;
3334
3435 /**
@@ -36,7 +37,7 @@
3637 */
3738 public class BasicAvatar implements Avatar {
3839
39- /** このオブジェクトが属する Story */
40+ /** このオブジェクトが属する Story */
4041 private Story story;
4142
4243 /** 省略名 */
@@ -57,6 +58,9 @@
5758 /** 短い名前 */
5859 private String shortName;
5960
61+ /** 役職 */
62+ private Role role;
63+
6064 /**
6165 * コンストラクタ
6266 */
@@ -134,6 +138,15 @@
134138 }
135139
136140 /**
141+ * 役職を返します。
142+ * @return 役職
143+ */
144+ @Override
145+ public Role getRole() {
146+ return role;
147+ }
148+
149+ /**
137150 * このオブジェクトが属する Story をセットします。
138151 * @param story このオブジェクトが属する Story
139152 */
@@ -197,6 +210,15 @@
197210 }
198211
199212 /**
213+ * 役職をセットします。
214+ * @param role セットしたい役職の値
215+ */
216+ @Override
217+ public void setRole(Role role) {
218+ this.role = role;
219+ }
220+
221+ /**
200222 * @see java.lang.Object#toString()
201223 */
202224 @Override
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedAvatar.java (nonexistent)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedAvatar.java (revision 7)
@@ -0,0 +1,195 @@
1+/*
2+ * Moltonf
3+ *
4+ * Copyright (c) 2010 Project Moltonf
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining
7+ * a copy of this software and associated documentation files (the
8+ * "Software"), to deal in the Software without restriction, including
9+ * without limitation the rights to use, copy, modify, merge, publish,
10+ * distribute, sublicense, and/or sell copies of the Software, and to
11+ * permit persons to whom the Software is furnished to do so, subject to
12+ * the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included
15+ * in all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+ */
25+
26+package com.hironytic.moltonf.model.limited;
27+
28+import java.awt.Image;
29+import java.net.URI;
30+
31+import com.hironytic.moltonf.MoltonfException;
32+import com.hironytic.moltonf.model.Avatar;
33+import com.hironytic.moltonf.model.Role;
34+import com.hironytic.moltonf.model.Story;
35+
36+/**
37+ * LimitedStory が保持する Avatar
38+ */
39+public class LimitedAvatar implements Avatar {
40+
41+ /** このオブジェクトが属する LimitedStory */
42+ private LimitedStory story;
43+
44+ /** 元となる Avatar */
45+ private Avatar baseAvatar;
46+
47+ /**
48+ * コンストラクタ
49+ * @param story このオブジェクトが属する LimitedStory
50+ * @param baseAvatar 元となる Avatar
51+ */
52+ public LimitedAvatar(LimitedStory story, Avatar baseAvatar) {
53+ this.story = story;
54+ this.baseAvatar = baseAvatar;
55+ }
56+
57+ /**
58+ * @see com.hironytic.moltonf.model.Avatar#getAbbreviatedName()
59+ */
60+ @Override
61+ public String getAbbreviatedName() {
62+ return baseAvatar.getAbbreviatedName();
63+ }
64+
65+ /**
66+ * @see com.hironytic.moltonf.model.Avatar#getAvatarId()
67+ */
68+ @Override
69+ public String getAvatarId() {
70+ return baseAvatar.getAvatarId();
71+ }
72+
73+ /**
74+ * @see com.hironytic.moltonf.model.Avatar#getFaceIconImage()
75+ */
76+ @Override
77+ public Image getFaceIconImage() {
78+ return baseAvatar.getFaceIconImage();
79+ }
80+
81+ /**
82+ * @see com.hironytic.moltonf.model.Avatar#getFaceIconUri()
83+ */
84+ @Override
85+ public URI getFaceIconUri() {
86+ return baseAvatar.getFaceIconUri();
87+ }
88+
89+ /**
90+ * @see com.hironytic.moltonf.model.Avatar#getFullName()
91+ */
92+ @Override
93+ public String getFullName() {
94+ return baseAvatar.getFullName();
95+ }
96+
97+ /**
98+ * @see com.hironytic.moltonf.model.Avatar#getShortName()
99+ */
100+ @Override
101+ public String getShortName() {
102+ return baseAvatar.getShortName();
103+ }
104+
105+ /**
106+ * @see com.hironytic.moltonf.model.Avatar#getStory()
107+ */
108+ @Override
109+ public Story getStory() {
110+ return story;
111+ }
112+
113+ /**
114+ * @see com.hironytic.moltonf.model.Avatar#getRole()
115+ */
116+ @Override
117+ public Role getRole() {
118+ // TODO: システム的に確定して見える人以外は見えない方がいいんだろうか。
119+ // たとえば、狼なら、別の狼が狼だとわかるし、共有者なら、別の共有者がわかるけど
120+ // それ以外のものは unknown だとか。
121+ return baseAvatar.getRole();
122+ }
123+
124+ /**
125+ * @see com.hironytic.moltonf.model.Avatar#setAbbreviatedName(java.lang.String)
126+ */
127+ @Override
128+ public void setAbbreviatedName(String abbreviatedName) {
129+ throw new MoltonfException("Don't set abbreviated name.", new UnsupportedOperationException("Modification is not allowed."));
130+ }
131+
132+ /**
133+ * @see com.hironytic.moltonf.model.Avatar#setAvatarId(java.lang.String)
134+ */
135+ @Override
136+ public void setAvatarId(String avatarId) {
137+ throw new MoltonfException("Don't set avatar id.", new UnsupportedOperationException("Modification is not allowed."));
138+ }
139+
140+ /**
141+ * @see com.hironytic.moltonf.model.Avatar#setFaceIconImage(java.awt.Image)
142+ */
143+ @Override
144+ public void setFaceIconImage(Image faceIconImage) {
145+ throw new MoltonfException("Don't set face icon image.", new UnsupportedOperationException("Modification is not allowed."));
146+ }
147+
148+ /**
149+ * @see com.hironytic.moltonf.model.Avatar#setFaceIconUri(java.net.URI)
150+ */
151+ @Override
152+ public void setFaceIconUri(URI faceIconUri) {
153+ throw new MoltonfException("Don't set face icon uri.", new UnsupportedOperationException("Modification is not allowed."));
154+ }
155+
156+ /**
157+ * @see com.hironytic.moltonf.model.Avatar#setFullName(java.lang.String)
158+ */
159+ @Override
160+ public void setFullName(String fullName) {
161+ throw new MoltonfException("Don't set full name.", new UnsupportedOperationException("Modification is not allowed."));
162+ }
163+
164+ /**
165+ * @see com.hironytic.moltonf.model.Avatar#setShortName(java.lang.String)
166+ */
167+ @Override
168+ public void setShortName(String shortName) {
169+ throw new MoltonfException("Don't set short name.", new UnsupportedOperationException("Modification is not allowed."));
170+ }
171+
172+ /**
173+ * @see com.hironytic.moltonf.model.Avatar#setStory(com.hironytic.moltonf.model.Story)
174+ */
175+ @Override
176+ public void setStory(Story story) {
177+ throw new MoltonfException("Don't set story.", new UnsupportedOperationException("Modification is not allowed."));
178+ }
179+
180+ /**
181+ * @see com.hironytic.moltonf.model.Avatar#setRole(com.hironytic.moltonf.model.Role)
182+ */
183+ @Override
184+ public void setRole(Role role) {
185+ throw new MoltonfException("Don't set role.", new UnsupportedOperationException("Modification is not allowed."));
186+ }
187+
188+ /**
189+ * @see java.lang.Object#toString()
190+ */
191+ @Override
192+ public String toString() {
193+ return "LimitedAvatar [baseAvatar=" + baseAvatar + "]";
194+ }
195+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedStory.java (nonexistent)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedStory.java (revision 7)
@@ -0,0 +1,199 @@
1+/*
2+ * Moltonf
3+ *
4+ * Copyright (c) 2010 Project Moltonf
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining
7+ * a copy of this software and associated documentation files (the
8+ * "Software"), to deal in the Software without restriction, including
9+ * without limitation the rights to use, copy, modify, merge, publish,
10+ * distribute, sublicense, and/or sell copies of the Software, and to
11+ * permit persons to whom the Software is furnished to do so, subject to
12+ * the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included
15+ * in all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+ */
25+
26+package com.hironytic.moltonf.model.limited;
27+
28+import java.awt.Image;
29+import java.net.URI;
30+import java.util.ArrayList;
31+import java.util.List;
32+
33+import com.hironytic.moltonf.MoltonfException;
34+import com.hironytic.moltonf.model.Avatar;
35+import com.hironytic.moltonf.model.Story;
36+import com.hironytic.moltonf.model.StoryPeriod;
37+import com.hironytic.moltonf.model.VillageState;
38+
39+/**
40+ * 経過日数や人物によって得られる情報を制限した Story
41+ */
42+public class LimitedStory implements Story {
43+
44+ /** 元になる(情報を制限する前の)Story */
45+ private Story baseStory;
46+
47+ /**
48+ * 制限するための登場人物。
49+ * この登場人物の視点で見える情報だけに制限します。
50+ */
51+ private Avatar targetAvatar;
52+
53+ /**
54+ * 何日目まで見えている状態か。
55+ * 例えばこの値が 1 ならインデックス 1 の StoryPeriod までが見えていることになります。
56+ */
57+ private int currentPeriod;
58+
59+ /** この Story に含まれる StoryPeriod のリスト */
60+ private List<StoryPeriod> periods;
61+
62+ /** 登場人物のリスト */
63+ private List<Avatar> avatarList;
64+
65+ /**
66+ * コンストラクタ
67+ * @param baseStory 元になる Story
68+ * @param targetAvatar 制限するための登場人物。
69+ * @param currentPeriod 何日目まで見えている状態か。
70+ */
71+ public LimitedStory(Story baseStory, Avatar targetAvatar, int currentPeriod) {
72+ this.baseStory = baseStory;
73+ this.targetAvatar = targetAvatar;
74+ this.currentPeriod = currentPeriod;
75+
76+ List<StoryPeriod> basePeriods = this.baseStory.getPeriods();
77+ if (basePeriods.size() <= this.currentPeriod) {
78+ this.currentPeriod = basePeriods.size() - 1;
79+ }
80+
81+ this.periods = new ArrayList<StoryPeriod>(this.currentPeriod + 1);
82+ for (int ix = 0; ix <= this.currentPeriod; ++ix) {
83+ this.periods.add(new LimitedStoryPeriod(this, basePeriods.get(ix)));
84+ }
85+
86+ List<Avatar> baseAvatarList = this.baseStory.getAvatarList();
87+ this.avatarList = new ArrayList<Avatar>(baseAvatarList.size());
88+ for (Avatar baseAvatar : baseAvatarList) {
89+ this.avatarList.add(new LimitedAvatar(this, baseAvatar));
90+ }
91+ }
92+
93+ /**
94+ * @see com.hironytic.moltonf.model.Story#getAvatarList()
95+ */
96+ @Override
97+ public List<Avatar> getAvatarList() {
98+ return avatarList;
99+ }
100+
101+ /**
102+ * @see com.hironytic.moltonf.model.Story#getGraveIconImage()
103+ */
104+ @Override
105+ public Image getGraveIconImage() {
106+ return baseStory.getGraveIconImage();
107+ }
108+
109+ /**
110+ * @see com.hironytic.moltonf.model.Story#getGraveIconUri()
111+ */
112+ @Override
113+ public URI getGraveIconUri() {
114+ return baseStory.getGraveIconUri();
115+ }
116+
117+ /**
118+ * @see com.hironytic.moltonf.model.Story#getPeriods()
119+ */
120+ @Override
121+ public List<StoryPeriod> getPeriods() {
122+ return periods;
123+ }
124+
125+ /**
126+ * @see com.hironytic.moltonf.model.Story#getVillageFullName()
127+ */
128+ @Override
129+ public String getVillageFullName() {
130+ return baseStory.getVillageFullName();
131+ }
132+
133+ /**
134+ * @see com.hironytic.moltonf.model.Story#getVillageState()
135+ */
136+ @Override
137+ public VillageState getVillageState() {
138+ // TODO: 制限されている範囲とは関係なく、baseStory のを返しているけどいいかな?
139+ return baseStory.getVillageState();
140+ }
141+
142+ /**
143+ * @see com.hironytic.moltonf.model.Story#setAvatarList(java.util.List)
144+ */
145+ @Override
146+ public void setAvatarList(List<Avatar> avatarList) {
147+ throw new MoltonfException("Don't set avatar list.", new UnsupportedOperationException("Modification is not allowed."));
148+ }
149+
150+ /**
151+ * @see com.hironytic.moltonf.model.Story#setGraveIconImage(java.awt.Image)
152+ */
153+ @Override
154+ public void setGraveIconImage(Image graveIconImage) {
155+ throw new MoltonfException("Don't set grave icon image.", new UnsupportedOperationException("Modification is not allowed."));
156+ }
157+
158+ /**
159+ * @see com.hironytic.moltonf.model.Story#setGraveIconUri(java.net.URI)
160+ */
161+ @Override
162+ public void setGraveIconUri(URI graveIconUri) {
163+ throw new MoltonfException("Don't set grave icon uri.", new UnsupportedOperationException("Modification is not allowed."));
164+ }
165+
166+ /**
167+ * @see com.hironytic.moltonf.model.Story#setPeriods(java.util.List)
168+ */
169+ @Override
170+ public void setPeriods(List<StoryPeriod> periods) {
171+ throw new MoltonfException("Don't set periods.", new UnsupportedOperationException("Modification is not allowed."));
172+ }
173+
174+ /**
175+ * @see com.hironytic.moltonf.model.Story#setVillageFullName(java.lang.String)
176+ */
177+ @Override
178+ public void setVillageFullName(String villageFullName) {
179+ throw new MoltonfException("Don't set village full name.", new UnsupportedOperationException("Modification is not allowed."));
180+ }
181+
182+ /**
183+ * @see com.hironytic.moltonf.model.Story#setVillageState(com.hironytic.moltonf.model.VillageState)
184+ */
185+ @Override
186+ public void setVillageState(VillageState villageState) {
187+ throw new MoltonfException("Don't set village state.", new UnsupportedOperationException("Modification is not allowed."));
188+ }
189+
190+ /**
191+ * @see java.lang.Object#toString()
192+ */
193+ @Override
194+ public String toString() {
195+ return "LimitedStory [currentPeriod=" + currentPeriod + ", periods="
196+ + periods + ", targetAvatar=" + targetAvatar + ", baseStory="
197+ + baseStory + "]";
198+ }
199+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedStoryPeriod.java (nonexistent)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/limited/LimitedStoryPeriod.java (revision 7)
@@ -0,0 +1,88 @@
1+/*
2+ * Moltonf
3+ *
4+ * Copyright (c) 2010 Project Moltonf
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining
7+ * a copy of this software and associated documentation files (the
8+ * "Software"), to deal in the Software without restriction, including
9+ * without limitation the rights to use, copy, modify, merge, publish,
10+ * distribute, sublicense, and/or sell copies of the Software, and to
11+ * permit persons to whom the Software is furnished to do so, subject to
12+ * the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included
15+ * in all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+ */
25+
26+package com.hironytic.moltonf.model.limited;
27+
28+import java.util.List;
29+
30+import com.hironytic.moltonf.MoltonfException;
31+import com.hironytic.moltonf.model.Story;
32+import com.hironytic.moltonf.model.StoryElement;
33+import com.hironytic.moltonf.model.StoryPeriod;
34+
35+/**
36+ * 経過日数や人物によって得られる情報を制限した StoryPeriod
37+ */
38+public class LimitedStoryPeriod implements StoryPeriod {
39+
40+ /** このオブジェクトが属する LimitedStory */
41+ private LimitedStory story;
42+
43+ /** 元となる StoryPeriod */
44+ private StoryPeriod basePeriod;
45+
46+ /**
47+ * コンストラクタ
48+ * @param story このオブジェクトが属する LimitedStory
49+ * @param basePeriod 元となる StoryPeriod
50+ */
51+ public LimitedStoryPeriod(LimitedStory story, StoryPeriod basePeriod) {
52+ this.story = story;
53+ this.basePeriod = basePeriod;
54+ }
55+
56+ /**
57+ * @see com.hironytic.moltonf.model.StoryPeriod#getStory()
58+ */
59+ @Override
60+ public Story getStory() {
61+ return story;
62+ }
63+
64+ /* (non-Javadoc)
65+ * @see com.hironytic.moltonf.model.StoryPeriod#getStoryElements()
66+ */
67+ @Override
68+ public List<StoryElement> getStoryElements() {
69+ // TODO Auto-generated method stub
70+ return null;
71+ }
72+
73+ /**
74+ * @see com.hironytic.moltonf.model.StoryPeriod#setStory(com.hironytic.moltonf.model.Story)
75+ */
76+ @Override
77+ public void setStory(Story story) {
78+ throw new MoltonfException("Don't set story.", new UnsupportedOperationException("Modification is not allowed."));
79+ }
80+
81+ /**
82+ * @see com.hironytic.moltonf.model.StoryPeriod#setStoryElements(java.util.List)
83+ */
84+ @Override
85+ public void setStoryElements(List<StoryElement> storyElements) {
86+ throw new MoltonfException("Don't set story elements.", new UnsupportedOperationException("Modification is not allowed."));
87+ }
88+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/Avatar.java (revision 6)
+++ trunk/Sources/Moltonf/src/com/hironytic/moltonf/model/Avatar.java (revision 7)
@@ -82,6 +82,12 @@
8282 public Image getFaceIconImage();
8383
8484 /**
85+ * 役職を返します。
86+ * @return 役職
87+ */
88+ public Role getRole();
89+
90+ /**
8591 * このオブジェクトが属する Story をセットします。
8692 * @param story このオブジェクトが属する Story
8793 */
@@ -122,4 +128,10 @@
122128 * @param faceIconImage セットしたい顔アイコン画像の値
123129 */
124130 public void setFaceIconImage(Image faceIconImage);
131+
132+ /**
133+ * 役職をセットします。
134+ * @param role セットしたい役職の値
135+ */
136+ public void setRole(Role role);
125137 }
Show on old repository browser