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

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

public class BehaviorManager
extends java.lang.Object
implements java.io.Serializable

Agentの持つbehaviorを管理します。(概念的にはエージェントに含まれます。) BehaviorをTypeごとに分類して格納します。(同じタイプの異なるBehaviorObjectも別々に格納します。) behaviorを開始・終了・検索するインターフェースを持ちます。

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

コンストラクタの概要
protected BehaviorManager(Agent agent)
          コンストラクタです。
 
メソッドの概要
 void addBehavior(Behavior behavior)
          Behaviorを開始して追加します。
 java.util.List getAllBehaviors()
          Returns All Behaviors.
 Behavior getBehavior(BehaviorType type)
          引数のTypeであるBehaviorを返します。
 java.util.Collection getBehaviors(BehaviorType type)
          引数のTypeであるBehaviorをリストとして全て返します。
 java.util.Collection getBehaviorsRecursively(BehaviorType type)
          引数のType及びその子タイプであるrelationをリストとして全て返します。
 Behavior receiveOpenChannelEvent(OpenChannelEvent e)
          Channelを開設するためにChannelOpenEventを受け取るメソッドです。
 void receiveTimeEvent(TimeEvent e)
          TimeEventを受け取るためのメソッドです。
 void removeAllBehaviors()
          全てのBehaviorを削除します。
 void removeBehavior(Behavior behavior)
          Behaviorを終了して削除します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

BehaviorManager

protected BehaviorManager(Agent agent)
コンストラクタです。Behavior追加時に必要なAgentを与えます。

メソッドの詳細

addBehavior

public void addBehavior(Behavior behavior)
Behaviorを開始して追加します。この際に、BehaviorにAgentをセットします。


removeBehavior

public void removeBehavior(Behavior behavior)
Behaviorを終了して削除します。


getBehavior

public Behavior getBehavior(BehaviorType type)
引数のTypeであるBehaviorを返します。(複数存在していた場合、最初の1つを返します。) もし、存在しなければExceptionが投げられます。

パラメータ:
type - 検索対象のType
戻り値:
Collection 該当するBehaviorのリスト

getBehaviors

public java.util.Collection getBehaviors(BehaviorType type)
引数のTypeであるBehaviorをリストとして全て返します。 もし、存在しなければ空のリストが返されます。

パラメータ:
type - 検索対象のType
戻り値:
List 該当するRelationのリスト

getBehaviorsRecursively

public java.util.Collection getBehaviorsRecursively(BehaviorType type)
引数のType及びその子タイプであるrelationをリストとして全て返します。 もし、存在しなければ空のリストが返されます。

パラメータ:
type - 検索対象のType
戻り値:
List 該当するBehaviorのリスト

getAllBehaviors

public java.util.List getAllBehaviors()
Returns All Behaviors.

戻り値:
Collection The collection which has all behaviors.

receiveOpenChannelEvent

public Behavior receiveOpenChannelEvent(OpenChannelEvent e)
Channelを開設するためにChannelOpenEventを受け取るメソッドです。 ChannelEventを受け取るBehaviorを最終的に返します。

パラメータ:
e - Channel開設に必要なChannelOpenEvent

receiveTimeEvent

public void receiveTimeEvent(TimeEvent e)
TimeEventを受け取るためのメソッドです。 このTimeEventをBehaviorへブロードキャストします。 (いずれは、Agent内でのBehaviorの優先順位なども実装できますが、 現在はそこまでは行いません)

パラメータ:
e - TimeEvent

removeAllBehaviors

public void removeAllBehaviors()
全てのBehaviorを削除します。Agent削除時にAgentから呼ばれます。