stella.util
Class SimulatorSequencer

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiCaster
                      extended by stella.CastingContainer
                          extended by stella.AbstractSequencer
                              extended by stella.util.SimulatorSequencer
All Implemented Interfaces:
Cloneable, Runnable, Remote, ClusterDepending, ReplySubscriber, Sequencing, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class SimulatorSequencer
extends AbstractSequencer
implements Initializable

This class is used as a Sequencing instanance for simulating the target load on STELLA. Consider the following points.

See Also:
SimulatorWeather

Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static double DEFADVANCE
          The default speeding parameter.
private static String DEFFALSE
          The default get-false triggers.
private static long DEFOVERHEAD
          The default overhead in ms.
private static String DEFTIME
          The default time parameter.
private static String DEFTRUE
          The default get-true triggers.
private  Map falsemap
          A map linking target names to get-false trigger name on run().
static String KEY_ADVANCE
          Multiply the expected observing time with this prior to time-advance.
static String KEY_FALSE
          The key linking target name to false-triggers.
static String KEY_OVERHEAD
          The key linked to the overhead-time, i.e.
static String KEY_TIME
          The key giving the name of the time parameter.
static String KEY_TRUE
          The key linking target names to true-triggers.
private  Thread mythread
          The thread this sequencer runs in for a glimpse.
private  TargetDefinition running
          The target that should run.
private  ParameterClustering set
          The parameter cluster hosting the time.
private  Map truemap
          A map linking target names to get-true trigger names on run().
 
Fields inherited from class util.rmi.AbstractRmiCaster
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
SimulatorSequencer(Map prop)
          Construct a new sequencer for load simulation.
 
Method Summary
 void abort(List dom)
          Ignore.
 void append(List dom)
          Ignore.
 void cancel()
          Does nothing.
 void forward(ReplyEvent rp)
          Ignore.
 Thread getAsociatedThread()
          Returns the thread the sequencer is running in.
 List getStepsForTarget(TargetDefinition target)
          We don't need any steps for any sequence, but returning an empty list here would refrain the sequencer from being executed.
 void init()
          Creates two maps that link target names to trigger names.
 boolean isCancel()
          Return false;
 void load(List dom)
          Ignore.
 long maxTimeToCancel()
          Maximum timer-out used on shut-down.
 void prepend(List dom)
          Ignore.
 void registerCluster(ParameterClustering globals)
          Needed for the time parameter.
 void registerLauncher(CommandLaunching[] launch)
          Not needed.
 void registerRender(CommandRendering chef)
          Not needed.
 void run()
          Advances the time for the calculated observing time of the target or wait for this period.
 Thread start()
          In principle, we simply advance the time for the calculated observing time.
 
Methods inherited from class stella.AbstractSequencer
createSequencer
 
Methods inherited from class stella.CastingContainer
addErrorListener, addRmiErrorListener, exit, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus
 
Methods inherited from class util.rmi.AbstractRmiCaster
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, getBindName, unbindFromRegistry, unbindFromRegistry
 
Methods inherited from class util.rmi.RmiPropertyContainer
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_TIME

public static final String KEY_TIME
The key giving the name of the time parameter.

See Also:
Constant Field Values

KEY_ADVANCE

public static final String KEY_ADVANCE
Multiply the expected observing time with this prior to time-advance.

See Also:
Constant Field Values

KEY_TRUE

public static final String KEY_TRUE
The key linking target names to true-triggers.

See Also:
Constant Field Values

KEY_FALSE

public static final String KEY_FALSE
The key linking target name to false-triggers.

See Also:
Constant Field Values

KEY_OVERHEAD

public static final String KEY_OVERHEAD
The key linked to the overhead-time, i.e. time for acquisition etc.

See Also:
Constant Field Values

DEFTIME

private static final String DEFTIME
The default time parameter.

See Also:
Constant Field Values

DEFADVANCE

private static final double DEFADVANCE
The default speeding parameter.

See Also:
Constant Field Values

DEFTRUE

private static final String DEFTRUE
The default get-true triggers.

See Also:
Constant Field Values

DEFFALSE

private static final String DEFFALSE
The default get-false triggers.

See Also:
Constant Field Values

DEFOVERHEAD

private static final long DEFOVERHEAD
The default overhead in ms.

See Also:
Constant Field Values

running

private TargetDefinition running
The target that should run. Used for calculating observing time.


set

private ParameterClustering set
The parameter cluster hosting the time.


mythread

private Thread mythread
The thread this sequencer runs in for a glimpse.


truemap

private Map truemap
A map linking target names to get-true trigger names on run().


falsemap

private Map falsemap
A map linking target names to get-false trigger name on run().

Constructor Detail

SimulatorSequencer

public SimulatorSequencer(Map prop)
Construct a new sequencer for load simulation.

Method Detail

init

public void init()
Creates two maps that link target names to trigger names. The first map, constructed from KEY_TRUE consists of target names that spark setting of the indicated triggers to true, as soon as the target run()s. The second map sets triggers to false.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

getStepsForTarget

public List getStepsForTarget(TargetDefinition target)
We don't need any steps for any sequence, but returning an empty list here would refrain the sequencer from being executed. Thus we return a singleton list here with a dummy entry. Additionally, we keep a reference to the target to allow calculation of expected observing time.

Specified by:
getStepsForTarget in interface Sequencing

load

public void load(List dom)
Ignore.

Specified by:
load in interface Sequencing

abort

public void abort(List dom)
Ignore.

Specified by:
abort in interface Sequencing

append

public void append(List dom)
Ignore.

Specified by:
append in interface Sequencing

prepend

public void prepend(List dom)
Ignore.

Specified by:
prepend in interface Sequencing

registerCluster

public void registerCluster(ParameterClustering globals)
Needed for the time parameter.

Specified by:
registerCluster in interface ClusterDepending

registerRender

public void registerRender(CommandRendering chef)
Not needed.

Specified by:
registerRender in interface Sequencing

registerLauncher

public void registerLauncher(CommandLaunching[] launch)
Not needed.

Specified by:
registerLauncher in interface Sequencing

start

public Thread start()
In principle, we simply advance the time for the calculated observing time. If the time parameter is not advancable, we wait for the observing time.

Specified by:
start in interface Sequencing
Returns:
The thread that has just been started

run

public void run()
Advances the time for the calculated observing time of the target or wait for this period.

Specified by:
run in interface Runnable

getAsociatedThread

public Thread getAsociatedThread()
Returns the thread the sequencer is running in. If the sequencer is not running, i.e. the sequencer's thread is not alive, this method returns null.

Specified by:
getAsociatedThread in interface CancelRunnable

maxTimeToCancel

public long maxTimeToCancel()
Maximum timer-out used on shut-down. We do not do a specific thread, thus return zero here.

Specified by:
maxTimeToCancel in interface CancelRunnable

cancel

public void cancel()
Does nothing.

Specified by:
cancel in interface CancelRunnable

forward

public void forward(ReplyEvent rp)
Ignore.

Specified by:
forward in interface ReplySubscriber

isCancel

public boolean isCancel()
Return false;

Specified by:
isCancel in interface Sequencing