org.boxed_economy.besp.model.fmfw
クラス World

java.lang.Object
  拡張org.boxed_economy.besp.model.fmfw.FmFwObject
      拡張org.boxed_economy.besp.model.fmfw.World
すべての実装インタフェース:
java.io.Serializable

public class World
extends FmFwObject

モデルにおけるworldを定義します。Worldの役割は以下の通りです。 1.worldにAgentを配置して管理します。 2.Worldを継承したクラスによってモデルを定義することができます。   (Agentの生成・追加などをinit()をオーバーライドして記述します。) 3.Clock,Spaceを保持し、取得できます。(Worldの時間・空間を規定) 4.乱数生成アルゴリズム(RandomNumberGenerator)を管理します。 5.Vocaburalyクラスを通して、Model内のTypeを管理します。   これらの役割から、基礎モデルによって実現される経済モデルでWorldはベースとなる要素と いうことができます。 また、実装のために以下の機能があります。 Worldにデフォルト実装を行ないました。基礎モデルで定義されている機能に加えて ・UpdateModelEventを配信するために、PresentationContainerを取得する機能 ・一定時間実行のためのLimitedRunSettingの管理 ・TimeEventの配信順を管理するために、PriorityクラスとTypeを関連付ける機能

バージョン:
$Id: World.java,v 1.3 2004/06/07 06:22:50 macchan Exp $
作成者:
macchan
関連項目:
直列化された形式

入れ子クラスの概要
 
クラス org.boxed_economy.besp.model.fmfw.FmFwObject から継承した入れ子クラス
FmFwObject.InstanceCounter
 
コンストラクタの概要
World()
           
 
メソッドの概要
 void consumeGoods(Goods goods)
          Goodsを消費するために明示的に呼ぶメソッドです。
 Agent createAgent()
          デフォルトの定数を利用してエージェントを生成します。
 Agent createAgent(AgentType type)
          エージェントを生成します。
 Goods createGoods(GoodsType type, double quantity)
          引数に基づき、Goodsを生成して返します。
 void destroyAgent(Agent agent)
          WorldからAgentを削除します。
protected  void fireAgentCreated(UpdateWorldEvent e)
          イベント送信関連
protected  void fireAgentDestroyed(UpdateWorldEvent e)
           
protected  void fireGoodsConsumed(UpdateWorldEvent e)
           
protected  void fireGoodsCreated(UpdateWorldEvent e)
           
 Agent getAgent(AgentType type)
          引数のTypeのAgentを返します。
 java.util.Collection getAgents(AgentType type)
          引数のTypeのAgentのCollectionを返します。
 java.util.Collection getAgentsRecursively(AgentType type)
          引数のType及びその子TypeのAgentのCollectionを返します。
 AgentType getAgentType(java.lang.String key)
          キーに該当するAgentTypeを取得します。
 java.util.Collection getAllAgents()
          全てのAgentの集合を返します。
 BehaviorType getBehaviorType(Behavior behavior)
          Behaviorに該当するBehaviorTypeを取得します。
 BehaviorType getBehaviorType(java.lang.String key)
          キーに該当するBehaviorTypeを取得します。
 Clock getClock()
          このWorldが保持するClockを取得します。
 long getDefaultRandomSeed()
          Returns the defaultRandomSeed.
 java.lang.String getDescription()
          モデルの説明を返します.
 GoodsType getGoodsType(java.lang.String key)
          キーに該当するGoodsTypeを取得します。
 InformationType getInformationType(Information information)
          Informationに該当するInformationTypeを取得します。
 InformationType getInformationType(java.lang.String key)
          キーに該当するInformationTypeを取得します。
 ModelContainer getModelContainer()
           
 java.lang.String getName()
          モデルの名前を返します。
 PresentationContainer getPresentationContainer()
           
 int getPriority(AgentType agentType)
          引数のAgentTypeに対応するPriorityを返します。
 RandomNumberGenerator getRandomNumberGenerator()
          DefaultのRandomNumberGeneratorを検索して返します。
 RandomNumberGenerator getRandomNumberGenerator(java.lang.String name)
          引数のnameのRandomNumberGeneratorを検索して返します。
 RelationType getRelationType(java.lang.String key)
          キーに該当するRelationTypeを取得します。
 Space getSpace()
          このWorldが保持する空間を取得します。
 long getTimeEventRandomSeed()
          Returns the timeEventRandomSeed.
 void initialize()
          初期化します
 void initializeAgents()
          エージェントを初期化します (エージェント, 財, 関係の初期化を想定しています)
 void initializeWorld()
          世界を初期化します (ランダム, 時計, 空間の初期化を想定しています)
 AgentType installAgentType(java.lang.String name)
          AgentTypeを生成して返します。
 AgentType installAgentType(java.lang.String name, int priority)
          AgentTypeを生成して返します。
 BehaviorType installBehaviorType(java.lang.String name)
          BehaviorTypeを生成して返します。
 GoodsType installGoodsType(java.lang.String name)
          GoodsTypeを生成して返します。
 InformationType installInformationType(java.lang.String name)
          InformationTypeを生成して返します。
 void installRandomNumberGenerator(RandomNumberGenerator random)
          引数のRandomNumberGeneratorをrandomMapに追加します。
 RelationType installRelationType(java.lang.String name)
          RelationTypeを生成して返します。
 void setClock(Clock clock)
          global時間を設定します。
 void setDefaultRandomSeed(long defaultRandomSeed)
          Sets the defaultRandomSeed.
 void setModelContainer(ModelContainer container)
          Container関連
 void setPriority(AgentType agentType, int priority)
          Priorityを追加設定します。
 void setSpace(Space space)
          global空間を設定します。
 void setTimeEventRandomSeed(long timeEventRandomSeed)
          Sets the timeEventRandomSeed.
 
クラス org.boxed_economy.besp.model.fmfw.FmFwObject から継承したメソッド
finalize, getInstanceCounters
 
クラス java.lang.Object から継承したメソッド
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

World

public World()
メソッドの詳細

initialize

public final void initialize()
初期化します


initializeWorld

public void initializeWorld()
世界を初期化します (ランダム, 時計, 空間の初期化を想定しています)


initializeAgents

public void initializeAgents()
エージェントを初期化します (エージェント, 財, 関係の初期化を想定しています)


getName

public java.lang.String getName()
モデルの名前を返します。 デフォルトの実装ではクラス名を返します。 継承したモデルでオーバーライドすることによってクラス名以外の名前を利用できます。


getDescription

public java.lang.String getDescription()
モデルの説明を返します.


setModelContainer

public void setModelContainer(ModelContainer container)
Container関連


getPresentationContainer

public PresentationContainer getPresentationContainer()

getModelContainer

public ModelContainer getModelContainer()

getAgent

public Agent getAgent(AgentType type)
引数のTypeのAgentを返します。複数ある場合、一番最初に追加されたAgentを返します。 もしなければ、Exceptionを返します。

パラメータ:
type - 指定するAgentType
戻り値:
Agent 該当するAgent

getAgents

public java.util.Collection getAgents(AgentType type)
引数のTypeのAgentのCollectionを返します。 もしなければ、空のCollectionを返します。

パラメータ:
type - 指定するAgentType
戻り値:
Collection 該当するAgentの集合

getAgentsRecursively

public java.util.Collection getAgentsRecursively(AgentType type)
引数のType及びその子TypeのAgentのCollectionを返します。 もしなければ、空のCollectionを返します。

パラメータ:
type - 指定するAgentType
戻り値:
Collection 該当するAgentの集合

getAllAgents

public java.util.Collection getAllAgents()
全てのAgentの集合を返します。

戻り値:
Collection Agentの集合

createAgent

public Agent createAgent()
デフォルトの定数を利用してエージェントを生成します。

戻り値:
Agent 生成されたAgent

createAgent

public Agent createAgent(AgentType type)
エージェントを生成します。生成直後にAgentのinitメソッドを呼びます。

パラメータ:
type - 生成するAgentのType
戻り値:
Agent 生成されたAgent

destroyAgent

public void destroyAgent(Agent agent)
WorldからAgentを削除します。Agentの死亡・消滅を意味します。 存在しない場合、Exceptionを投げます。


createGoods

public Goods createGoods(GoodsType type,
                         double quantity)
引数に基づき、Goodsを生成して返します。

パラメータ:
type - Goodsに指定するのGoodsType
戻り値:
Goods 生成されたGoods

consumeGoods

public void consumeGoods(Goods goods)
Goodsを消費するために明示的に呼ぶメソッドです。

パラメータ:
goods -

setClock

public void setClock(Clock clock)
global時間を設定します。

パラメータ:
clock - 設定する時間

getClock

public Clock getClock()
このWorldが保持するClockを取得します。

戻り値:
clock このWorldのClock

setSpace

public void setSpace(Space space)
global空間を設定します。

パラメータ:
space - 設定する空間

getSpace

public Space getSpace()
このWorldが保持する空間を取得します。

戻り値:
space 空間

getRandomNumberGenerator

public RandomNumberGenerator getRandomNumberGenerator(java.lang.String name)
引数のnameのRandomNumberGeneratorを検索して返します。

戻り値:
見つかったRandomNumberGenerator(見つからなければnull)

getRandomNumberGenerator

public RandomNumberGenerator getRandomNumberGenerator()
DefaultのRandomNumberGeneratorを検索して返します。

戻り値:
見つかったRandomNumberGenerator(見つからなければnull)

installRandomNumberGenerator

public void installRandomNumberGenerator(RandomNumberGenerator random)
引数のRandomNumberGeneratorをrandomMapに追加します。 もし、同じnameのRandomNumberGeneratorが既にあれば、入れ替えます。


getDefaultRandomSeed

public long getDefaultRandomSeed()
Returns the defaultRandomSeed.

戻り値:
long

setDefaultRandomSeed

public void setDefaultRandomSeed(long defaultRandomSeed)
Sets the defaultRandomSeed.

パラメータ:
defaultRandomSeed - The defaultRandomSeed to set

getTimeEventRandomSeed

public long getTimeEventRandomSeed()
Returns the timeEventRandomSeed.

戻り値:
long

setTimeEventRandomSeed

public void setTimeEventRandomSeed(long timeEventRandomSeed)
Sets the timeEventRandomSeed.

パラメータ:
timeEventRandomSeed - The timeEventRandomSeed to set

getAgentType

public AgentType getAgentType(java.lang.String key)
キーに該当するAgentTypeを取得します。 存在しなければ、nullを返します。

パラメータ:
key - 検索するキー文字列

getBehaviorType

public BehaviorType getBehaviorType(java.lang.String key)
キーに該当するBehaviorTypeを取得します。 存在しなければ、nullを返します。

パラメータ:
key - 検索するキー文字列

getBehaviorType

public BehaviorType getBehaviorType(Behavior behavior)
Behaviorに該当するBehaviorTypeを取得します。 存在しなければ、nullを返します。


getGoodsType

public GoodsType getGoodsType(java.lang.String key)
キーに該当するGoodsTypeを取得します。 存在しなければ、nullを返します。

パラメータ:
key - 検索するキー文字列

getInformationType

public InformationType getInformationType(java.lang.String key)
キーに該当するInformationTypeを取得します。 存在しなければ、nullを返します。

パラメータ:
key - 検索するキー文字列

getInformationType

public InformationType getInformationType(Information information)
Informationに該当するInformationTypeを取得します。 存在しなければ、nullを返します。


getRelationType

public RelationType getRelationType(java.lang.String key)
キーに該当するRelationTypeを取得します。 存在しなければ、nullを返します。

パラメータ:
key - 検索するキー文字列

installAgentType

public AgentType installAgentType(java.lang.String name)
AgentTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
AgentType 生成されたType

installAgentType

public AgentType installAgentType(java.lang.String name,
                                  int priority)
AgentTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
AgentType 生成されたType

installGoodsType

public GoodsType installGoodsType(java.lang.String name)
GoodsTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
GoodsType 生成されたType

installBehaviorType

public BehaviorType installBehaviorType(java.lang.String name)
BehaviorTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
BehaviorType 生成されたType

installRelationType

public RelationType installRelationType(java.lang.String name)
RelationTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
RelationType 生成されたType

installInformationType

public InformationType installInformationType(java.lang.String name)
InformationTypeを生成して返します。Typeの生成は必ずこのメソッドを用いて行って下さい。

パラメータ:
name - 生成するTypeの名前
戻り値:
InformationType 生成されたType

getPriority

public int getPriority(AgentType agentType)
引数のAgentTypeに対応するPriorityを返します。 もし、存在しなければnullを返します。

パラメータ:
agentType - 取得したいPriorityのType
戻り値:
Priority 該当するPriority

setPriority

public void setPriority(AgentType agentType,
                        int priority)
Priorityを追加設定します。intで指定したPriorityを生成して追加します。 intの値のPriorityが既にあれば、それに追加します。

パラメータ:
agentType - 関連付けるType

fireAgentCreated

protected void fireAgentCreated(UpdateWorldEvent e)
イベント送信関連


fireAgentDestroyed

protected void fireAgentDestroyed(UpdateWorldEvent e)

fireGoodsCreated

protected void fireGoodsCreated(UpdateWorldEvent e)

fireGoodsConsumed

protected void fireGoodsConsumed(UpdateWorldEvent e)