stella.parameter
Class SnapshotParameter
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.SnapshotParameter
- All Implemented Interfaces:
- Cloneable, ErrorDependingParameter, Parameter, ParameterDepending, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying
- Direct Known Subclasses:
- SnapshotValue
public class SnapshotParameter
- extends AbstractParameter
- implements ParameterDepending, ErrorDependingParameter, Reloadable
A snapshot parameter records the value of an other parameter at a certain
time. As unpredicted points-in-time are asociated with errors, this
value-fixation should be triggered by an error received in the main
ParameterClustering instance.
|
Field Summary |
static String |
KEY_ERROR
The class name of the error that serves as a snapshot-trigger. |
static String |
KEY_PARAMETER
The name of the parameter which value should be recorded on error. |
private Object |
record
The value of the asociated parameter at time of snapshot. |
private Parameter |
snapshot
The asociated parameter. |
| Methods inherited from class stella.parameter.AbstractParameter |
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, register, setName, toString |
| 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, setObject, setProperties, setProperty, stringProperties |
| 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 |
KEY_PARAMETER
public static final String KEY_PARAMETER
- The name of the parameter which value should be recorded on error.
- See Also:
- Constant Field Values
KEY_ERROR
public static final String KEY_ERROR
- The class name of the error that serves as a snapshot-trigger.
- See Also:
- Constant Field Values
snapshot
private Parameter snapshot
- The asociated parameter.
record
private Object record
- The value of the asociated parameter at time of snapshot.
SnapshotParameter
public SnapshotParameter(Map prop)
- Constructs a new snapshot parameter.
rescanned
public double rescanned(String key,
String old,
String newval)
- As any parameter depending instance we fail if the parameter we depend
on is now a different one.
- Specified by:
rescanned in interface Reloadable- Overrides:
rescanned in class AbstractParameter
registerParameter
public void registerParameter(Parameter watch)
- Registers the asociated parameter which value should be recorded.
Checks the name of the parameter handed over against
KEY_PARAMETER
- Specified by:
registerParameter in interface ParameterDepending
getForError
public Object getForError(ErrorEvent err)
- Checks if the error received is of the type specified in the
KEY_ERROR property. If so, the current value of the observed
parameter is returned, otherwise null is returned.
- Specified by:
getForError in interface ErrorDependingParameter
registerError
public void registerError(ErrorEvent err)
- Registers the error. If the error is recognized, i.e. the
#getFor method return a non-null value, the value of this
parameter is adjusted to reflect the value of the served parameter at
the time this error was registered.
- Specified by:
registerError in interface ErrorDependingParameter
myError
private boolean myError(ErrorEvent err)
- Returns true if we act on this error.
get
public Object get()
- Gets the last snapshot value. If a no error specified in
KEY_ERROR was received since the watched parameter
registration, null is returned.
- Specified by:
get in interface Parameter
set
public Object set(Object newval)
- Sets the snapshot value. Not allowed.
- Specified by:
set in interface Parameter
- Returns:
- The previous value of this parameter.