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

java.lang.Object
  拡張org.boxed_economy.besp.model.fmfw.FmFwObject
      拡張org.boxed_economy.besp.model.fmfw.Behavior
すべての実装インタフェース:
java.io.Serializable
直系の既知のサブクラス:
AbstractBehavior

public abstract class Behavior
extends FmFwObject

エージェントの行なう様々な行動をBehaviorとして定義します。 behaviorは状態機械によって実現されます。そして、様々なEventを受け取ります。 ただし、behaviorはmodelによってアルゴリズムが大きく異なる部分があるため、 アブストラクトとして提供します。実際モデルに使われるBehaviorはこのクラスを継承して作成してください。 フレームワークとして、開始・終了・イベント受信・Channel設定のためのインターフェースを提供します。 また、Channelを現在のChannelおよび、複数持つことができます。

バージョン:
$Id: Behavior.java,v 1.2 2004/03/21 20:07:07 macchan Exp $
作成者:
macchan
関連項目:
直列化された形式

入れ子クラスの概要
 
クラス org.boxed_economy.besp.model.fmfw.FmFwObject から継承した入れ子クラス
FmFwObject.InstanceCounter
 
コンストラクタの概要
Behavior()
           
 
メソッドの概要
 void firePrepareTimeEventReceive(UpdateBehaviorEvent e)
          for event
 void fireStateChanged(UpdateBehaviorEvent e)
           
 void fireTimeEventReceived(UpdateBehaviorEvent e)
           
 void fireTransitionStarted(UpdateBehaviorEvent e)
           
 Channel getActiveChannel()
          Behavior自身が開いているChannelを返します
 Agent getAgent()
          Behaviorを持つAgentを返します。
 java.util.List getAllChannels()
          すべての経路を取得します
 Goods getReceivedGoods()
           
 Information getReceivedInformation()
          情報だけを受け取るための便利メソッド
abstract  State getState()
          現在の状態を取得します.
 BehaviorType getType()
          Method getType.
 World getWorld()
          このBehaviorが所属しているAgentが配置されているWorldを返します。
protected abstract  boolean isReceivableEvent(Event e)
          RelationからChannelの開設に関して許可を求めるメソッドです。
 void keepReceivedGoods()
          財関連 受け取った財を保管しておくしくみ
 boolean receivedGoodsEquals(GoodsType type)
          受け取った財が引数で与えられたGoodsTypeと同じかどうか調べる。
 boolean receivedInformationEquals(InformationType type)
          受け取った財に付随する情報が引数で与えられたInformationTypeと同じかどうか調べる。
protected abstract  void receiveEvent(Event e)
          Channelや、Agentから送られたEventを受け取るメソッドです。
protected abstract  void run()
          状態機械を開始するためのメソッドです。
 void sendGoods(Goods goods)
          財を送信します 既に開かれているChannelを利用します 開かれているChannelがない場合、Exceptionを投げます
protected  void sendGoods(Relation relation, BehaviorType behaviorType, Goods goods)
          財を送信します 関係を指定します(自動的にkeep=falseなChannelを開きます)
 void sendGoods(Relation relation, BehaviorType behaviorType, Goods goods, boolean keep)
          財を送信します 関係を指定します(自動的にChannelを開きます)
protected  int sendGoods(RelationType relationType, BehaviorType behaviorType, GoodsType goodsType, double goodsQuantity, boolean createGoods)
          財を送信します
protected  int sendGoods(RelationType relationType, BehaviorType behaviorType, GoodsType goodsType, double goodsQuantity, boolean createGoods, boolean keep)
          財を送信します
 void sendInformation(Information information)
          情報を送信します。
 void sendInformation(InformationType key, Information information)
          タイプを指定して,情報を送信します。
 void sendInformation(Relation relation, BehaviorType behaviorType, Information information)
          情報を送信します。
 void sendInformation(Relation relation, BehaviorType behaviorType, Information information, boolean keep)
          情報を送信します。
 int sendInformation(RelationType relationType, BehaviorType behaviorType, Information information)
          情報を送信します。
 int sendInformation(RelationType relationType, BehaviorType behaviorType, Information information, boolean keep)
          情報を送信します。
 int sendInformation(RelationType relationType, BehaviorType behaviorType, InformationType key, Information information, boolean keep)
          タイプを指定して,情報を送信します。
 void setReceivedGoods(ChannelEvent event)
           
 void setType(BehaviorType type)
          Method setType.
protected abstract  void stop()
          状態機械を停止するためのメソッドです。
 
クラス org.boxed_economy.besp.model.fmfw.FmFwObject から継承したメソッド
finalize, getInstanceCounters
 
クラス java.lang.Object から継承したメソッド
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Behavior

public Behavior()
メソッドの詳細

getType

public BehaviorType getType()
Method getType.

戻り値:
BehaviorType

setType

public final void setType(BehaviorType type)
Method setType.

パラメータ:
type -

getWorld

public World getWorld()
このBehaviorが所属しているAgentが配置されているWorldを返します。

戻り値:
World このBehaviorが配置されていることになるWorld

getAgent

public Agent getAgent()
Behaviorを持つAgentを返します。

戻り値:
Agent Behaviorを持つAgent

getState

public abstract State getState()
現在の状態を取得します.

戻り値:

getActiveChannel

public Channel getActiveChannel()
Behavior自身が開いているChannelを返します


getAllChannels

public java.util.List getAllChannels()
すべての経路を取得します


run

protected abstract void run()
状態機械を開始するためのメソッドです。 AgentにBehaviorを追加するときに呼ばれます。


stop

protected abstract void stop()
状態機械を停止するためのメソッドです。 AgentからBehaviorを削除する前に呼ばれます。


isReceivableEvent

protected abstract boolean isReceivableEvent(Event e)
RelationからChannelの開設に関して許可を求めるメソッドです。 OpenChannelEventから情報を取得して、booleanで返してください。

パラメータ:
e - 開設を求めるChannelの情報を含むEvent
戻り値:
boolean 開設するかの真偽

receiveEvent

protected abstract void receiveEvent(Event e)
Channelや、Agentから送られたEventを受け取るメソッドです。 現在は、TimeEvent,ChannelEvent,KillEventの3種類のイベントを受け取ります。

パラメータ:
e - 送られたイベントhy

sendGoods

public final void sendGoods(Goods goods)
財を送信します 既に開かれているChannelを利用します 開かれているChannelがない場合、Exceptionを投げます


sendGoods

public final void sendGoods(Relation relation,
                            BehaviorType behaviorType,
                            Goods goods,
                            boolean keep)
財を送信します 関係を指定します(自動的にChannelを開きます)


sendGoods

protected final void sendGoods(Relation relation,
                               BehaviorType behaviorType,
                               Goods goods)
財を送信します 関係を指定します(自動的にkeep=falseなChannelを開きます)


sendInformation

public final void sendInformation(Information information)
情報を送信します。 現在開かれているChannelを利用します


sendInformation

public final void sendInformation(Relation relation,
                                  BehaviorType behaviorType,
                                  Information information,
                                  boolean keep)
情報を送信します。 関係を指定します(自動的にChannelを開きます)


sendInformation

public final void sendInformation(Relation relation,
                                  BehaviorType behaviorType,
                                  Information information)
情報を送信します。 関係を指定します(自動的にkeep=falseなChannelを開きます)


sendInformation

public final int sendInformation(RelationType relationType,
                                 BehaviorType behaviorType,
                                 Information information)
情報を送信します。 関係のタイプを指定します(自動的にkeep=falseなChannelを開きます)


sendInformation

public final int sendInformation(RelationType relationType,
                                 BehaviorType behaviorType,
                                 Information information,
                                 boolean keep)
情報を送信します。 関係のタイプを指定します(自動的にChannelを開きます)


sendInformation

public final void sendInformation(InformationType key,
                                  Information information)
タイプを指定して,情報を送信します。


sendInformation

public final int sendInformation(RelationType relationType,
                                 BehaviorType behaviorType,
                                 InformationType key,
                                 Information information,
                                 boolean keep)
タイプを指定して,情報を送信します。


sendGoods

protected final int sendGoods(RelationType relationType,
                              BehaviorType behaviorType,
                              GoodsType goodsType,
                              double goodsQuantity,
                              boolean createGoods)
財を送信します


sendGoods

protected final int sendGoods(RelationType relationType,
                              BehaviorType behaviorType,
                              GoodsType goodsType,
                              double goodsQuantity,
                              boolean createGoods,
                              boolean keep)
財を送信します


keepReceivedGoods

public void keepReceivedGoods()
財関連 受け取った財を保管しておくしくみ


setReceivedGoods

public void setReceivedGoods(ChannelEvent event)

getReceivedGoods

public Goods getReceivedGoods()

getReceivedInformation

public Information getReceivedInformation()
情報だけを受け取るための便利メソッド


receivedInformationEquals

public boolean receivedInformationEquals(InformationType type)
受け取った財に付随する情報が引数で与えられたInformationTypeと同じかどうか調べる。


receivedGoodsEquals

public boolean receivedGoodsEquals(GoodsType type)
受け取った財が引数で与えられたGoodsTypeと同じかどうか調べる。


firePrepareTimeEventReceive

public void firePrepareTimeEventReceive(UpdateBehaviorEvent e)
for event


fireTimeEventReceived

public void fireTimeEventReceived(UpdateBehaviorEvent e)

fireStateChanged

public void fireStateChanged(UpdateBehaviorEvent e)

fireTransitionStarted

public void fireTransitionStarted(UpdateBehaviorEvent e)