com.bbn.openmap.time
Class TimerRateHolder

java.lang.Object
  extended by com.bbn.openmap.time.TimerRateHolder
All Implemented Interfaces:
PropertyConsumer, java.io.Serializable

public class TimerRateHolder
extends java.lang.Object
implements PropertyConsumer, java.io.Serializable

A convenience class that keeps track of a relationship between real-time changes and scenario-time changes.

See Also:
Serialized Form

Field Summary
protected  long clockInterval
          The number of milliseconds that the timer should wait between updates.
static java.lang.String ClockIntervalProperty
          Clock that describes how often the pace value is applied to the time value (clockIntervalMillis).
static java.lang.String DEFAULT_PACE_BASELINE_VALUE
          The string used for the default pace baseline ("00:00:00").
static java.lang.String DEFAULT_PACE_FORMAT
          The string used for the default pace format ("HH:mm:ss").
protected  java.lang.String label
          Display label for this Timer rate.
protected  long pace
          The pace is the amount of time that should pass, in simulation time, when the timer gets updated.
static java.lang.String PaceBaselineProperty
          PaceBaselineProperty represents the property used for baselining the pace value (paceBaseline).
protected  java.text.SimpleDateFormat paceFormat
          The format used in the properties to note the pace.
static java.lang.String PaceFormatProperty
          PaceFormatProperty represents the property used for describing the pace format (paceFormat).
static java.lang.String PaceProperty
          The property used for the pace setting (pace).
protected  java.lang.String paceZero
          The baseline used to normalize the pace setting.
protected  java.lang.String propPrefix
          The prefix used to set the properties, saved in case the properties are retrieved.
static java.lang.String TimerRatesProperty
          Property used to describe a list of properties for TimerRateHolders (timerRates)
protected  boolean valid
          Flag that denotes whether the TimerRateHolder has be successfully set.
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
TimerRateHolder()
          Create a TimerRateHolder with the default pace format and value (00:00:00).
TimerRateHolder(java.text.SimpleDateFormat simpleDateFormat, java.lang.String dpz)
          Create a TimerRateHolder with a date format, and a baseline time.
 
Method Summary
 long getClockInterval()
           
 java.lang.String getLabel()
           
 long getPace()
           
 java.util.Properties getProperties(java.util.Properties props)
          Method to fill in a Properties object, reflecting the current values of the PropertyConsumer.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 java.lang.String getPropertyPrefix()
          Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
static java.util.List<TimerRateHolder> getTimerRateHolders(java.lang.String prefix, java.util.Properties properties)
           
 void setClockInterval(long cli)
           
 void setLabel(java.lang.String lab)
           
 void setPace(long pace)
           
 void setProperties(java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
 void setPropertyPrefix(java.lang.String p)
          Set the property key prefix that should be used by the PropertyConsumer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PACE_BASELINE_VALUE

public static final java.lang.String DEFAULT_PACE_BASELINE_VALUE
The string used for the default pace baseline ("00:00:00"). Needs to match the pace format.

See Also:
Constant Field Values

DEFAULT_PACE_FORMAT

public static final java.lang.String DEFAULT_PACE_FORMAT
The string used for the default pace format ("HH:mm:ss").

See Also:
Constant Field Values

TimerRatesProperty

public static final java.lang.String TimerRatesProperty
Property used to describe a list of properties for TimerRateHolders (timerRates)

See Also:
Constant Field Values

PaceFormatProperty

public static final java.lang.String PaceFormatProperty
PaceFormatProperty represents the property used for describing the pace format (paceFormat).

See Also:
Constant Field Values

PaceBaselineProperty

public static final java.lang.String PaceBaselineProperty
PaceBaselineProperty represents the property used for baselining the pace value (paceBaseline).

See Also:
Constant Field Values

ClockIntervalProperty

public static final java.lang.String ClockIntervalProperty
Clock that describes how often the pace value is applied to the time value (clockIntervalMillis).

See Also:
Constant Field Values

PaceProperty

public static final java.lang.String PaceProperty
The property used for the pace setting (pace).

See Also:
Constant Field Values

label

protected java.lang.String label
Display label for this Timer rate.


clockInterval

protected long clockInterval
The number of milliseconds that the timer should wait between updates.


pace

protected long pace
The pace is the amount of time that should pass, in simulation time, when the timer gets updated. If the clock is updating every second, and you have the pace set for 1 hour, then the situation controlled by the application's clock will be updated 1 hour every second.


paceFormat

protected java.text.SimpleDateFormat paceFormat
The format used in the properties to note the pace. Kept in order to write out the format if that's needed.


paceZero

protected java.lang.String paceZero
The baseline used to normalize the pace setting. Defaults to "OO:OO:OO".


valid

protected boolean valid
Flag that denotes whether the TimerRateHolder has be successfully set.


propPrefix

protected java.lang.String propPrefix
The prefix used to set the properties, saved in case the properties are retrieved.

Constructor Detail

TimerRateHolder

public TimerRateHolder()
Create a TimerRateHolder with the default pace format and value (00:00:00).


TimerRateHolder

public TimerRateHolder(java.text.SimpleDateFormat simpleDateFormat,
                       java.lang.String dpz)
Create a TimerRateHolder with a date format, and a baseline time. The default baseline time is "00:00:00", so if you need to change that, use this constructor. The pace for this TimerRateHolder should be a relative amount of time, and that relativity, taking into account the locale offset to GMT, is given by the baseline time. The baseline time should match the format given.

Method Detail

setLabel

public void setLabel(java.lang.String lab)

getLabel

public java.lang.String getLabel()

setPace

public void setPace(long pace)

getPace

public long getPace()

setClockInterval

public void setClockInterval(long cli)

getClockInterval

public long getClockInterval()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setProperties

public void setProperties(java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to set the properties in the PropertyConsumer. It is assumed that the properties do not have a prefix associated with them, or that the prefix has already been set.

Specified by:
setProperties in interface PropertyConsumer
Parameters:
props - a properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to set the properties in the PropertyConsumer. The prefix is a string that should be prepended to each property key (in addition to a separating '.') in order for the PropertyConsumer to uniquely identify properties meant for it, in the midst of of Properties meant for several objects.

Specified by:
setProperties in interface PropertyConsumer
Parameters:
prefix - a String used by the PropertyConsumer to prepend to each property value it wants to look up - setList.getProperty(prefix.propertyKey). If the prefix had already been set, then the prefix passed in should replace that previous value.
props - a Properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. If the PropertyConsumer has a prefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.).

Specified by:
getPropertyInfo in interface PropertyConsumer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyPrefix

public java.lang.String getPropertyPrefix()
Description copied from interface: PropertyConsumer
Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

Specified by:
getPropertyPrefix in interface PropertyConsumer
Returns:
the prefix string

setPropertyPrefix

public void setPropertyPrefix(java.lang.String p)
Description copied from interface: PropertyConsumer
Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

Specified by:
setPropertyPrefix in interface PropertyConsumer
Parameters:
p - the prefix String.

getTimerRateHolders

public static java.util.List<TimerRateHolder> getTimerRateHolders(java.lang.String prefix,
                                                                  java.util.Properties properties)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details