org.boxed_economy.besp.model
クラス ModelThread

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

public class ModelThread
extends java.lang.Object
implements java.lang.Runnable

Worldに配置されたClock、Agentに対しTimeEventを発信することでモデルを駆動するクラスです。

バージョン:
$Id: ModelThread.java,v 1.3 2004/05/06 17:48:24 macchan Exp $
作成者:
rx78g

フィールドの概要
static int RUNNING
           
protected  java.util.Vector simulationStateListeners
          状態イベント配信関連
static int STOPPED
           
static int STOPPING
           
 
コンストラクタの概要
ModelThread(ModelContainer modelContainer)
          コンストラクタです。
 
メソッドの概要
 void addSimulationStateListener(SimulationStateListener l)
           
 void deliverTimeEvent(World world)
          TimeEventをClockとAgentに対して配信するメソッドです。
protected  void firePresentationComponentStarted(SimulationStateEvent e)
           
protected  void firePresentationComponentStopped(SimulationStateEvent e)
           
protected  void firePresentationComponentStopping(SimulationStateEvent e)
           
 long getEventDispatchInterval()
          eventDispatchIntervalを返します。
protected  LimitedTimeRunSetting getLimitedRunSetting()
          現在設定されている実行設定を返します。
 int getState()
          現在の状態を取得します
 void removeSimulationStateListener(SimulationStateListener l)
           
 void run()
          run() Runnable interfaceの実装です。
 void setEventDispatchInterval(long interval)
          配信間隔を変更します。
protected  void setLimitedRunSetting(LimitedTimeRunSetting setting)
          実行設定を設定します。
 void start()
          Threadをスタートさせ、シミュレーションを進めます stopメソッドが呼ばれるまで、シミュレーションを動かしつづけます。
 void start(long step)
          引数で指定した回数だけシミュレーション実行を行ないます。
 void stop()
          シミュレーション(イベントの配信)を停止します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

STOPPED

public static final int STOPPED
関連項目:
定数フィールド値

STOPPING

public static final int STOPPING
関連項目:
定数フィールド値

RUNNING

public static final int RUNNING
関連項目:
定数フィールド値

simulationStateListeners

protected java.util.Vector simulationStateListeners
状態イベント配信関連

コンストラクタの詳細

ModelThread

public ModelThread(ModelContainer modelContainer)
コンストラクタです。

メソッドの詳細

getState

public int getState()
現在の状態を取得します

戻り値:
このthreadのstate

start

public void start()
           throws java.lang.Exception
Threadをスタートさせ、シミュレーションを進めます stopメソッドが呼ばれるまで、シミュレーションを動かしつづけます。 ただし、無限のhourではなく、long型の最大valueの回数で動かします。

例外:
java.lang.Exception

start

public void start(long step)
           throws java.lang.Exception
引数で指定した回数だけシミュレーション実行を行ないます。

パラメータ:
step - 実行する回数
例外:
java.lang.Exception

stop

public void stop()
シミュレーション(イベントの配信)を停止します。


run

public void run()
run() Runnable interfaceの実装です。

定義:
インタフェース java.lang.Runnable 内の run

getLimitedRunSetting

protected LimitedTimeRunSetting getLimitedRunSetting()
現在設定されている実行設定を返します。デフォルトは1ステップ実行です

戻り値:
LimitedTimeRunSetting

setLimitedRunSetting

protected void setLimitedRunSetting(LimitedTimeRunSetting setting)
実行設定を設定します。


deliverTimeEvent

public void deliverTimeEvent(World world)
TimeEventをClockとAgentに対して配信するメソッドです。


getEventDispatchInterval

public long getEventDispatchInterval()
eventDispatchIntervalを返します。

戻り値:
このthreadのeventDispatchInterval

setEventDispatchInterval

public void setEventDispatchInterval(long interval)
配信間隔を変更します。 必ず、stopstateで行なう必要があります。 stopstateでない場合、変更されません。Warningを発行します。 0以下が設定された場合、最低valueの1が設定されます。


addSimulationStateListener

public void addSimulationStateListener(SimulationStateListener l)

removeSimulationStateListener

public void removeSimulationStateListener(SimulationStateListener l)

firePresentationComponentStarted

protected void firePresentationComponentStarted(SimulationStateEvent e)

firePresentationComponentStopping

protected void firePresentationComponentStopping(SimulationStateEvent e)

firePresentationComponentStopped

protected void firePresentationComponentStopped(SimulationStateEvent e)