public class ObservableList extends AbstractTargetValue implements ParameterDepending, TargetProviderDepending, ErrorDependingParameter
AbstractTargetValue.set(java.lang.Object) method expects a list of TargetDefinitions,
preferrably Appointables,
which is stored in an internal Map
along with the target's merit. Whenever the set method is called, all
targets already present are checked for their last merit. The current merit
is stored if it exceeds the last one, allowing retrieval of a map of
target definitions to merits using the parameter's AbstractTargetValue.get() method.
Additionally, as this parameter is also relevant for scheduling simulation,
the parameter hosts a mapping of targets to all positive merits of the
target, which are stored as date and merit at that date. This mapping of
target definitions to a list of 2-element objects (Long, Double) can be
retrieved with a call to getMeritCourse(target.TargetDefinition).
This parameter is exit cleaning, meaning that depending on the keys
KEY_DUMPOBSERVE and KEY_DUMPCOURSE the map of
target definitions to highest merits is dumped as target names to highest
merits and the dates (as longs) with the particular merits is dumped. In
the current version, KEY_DUMPOBSERVE points to an ascii-file
name and KEY_DUMPCOURSE points to a directory.
| Modifier and Type | Class and Description |
|---|---|
private static class |
ObservableList.DateMerit
A combination of a date and a merit.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private Map<TargetDefinition,Shelf<ObservableList.DateMerit>> |
course
A map of parsed targets to merit course.
|
private TargetDefinition |
current
If a target/error was registered.
|
private static int |
DEFMAXENTRIES
The default size of the date-merit list.
|
static String |
DEFNAME
The default name of the target list.
|
private static String |
DEFTARGETMERIT
The default name of the target list.
|
private static String |
DEFTIME
The default name of the target list.
|
static String |
KEY_DUMPCOURSE
The directory into which the per-target merit course is writtn to.
|
static String |
KEY_DUMPOBSERVE
The file name where the target names vs.
|
static String |
KEY_IGNORE
The key to the comma-list of unwanted targets.
|
static String |
KEY_MAXENTRIES
The file name where the target names vs.
|
static String |
KEY_ONLY
The key to the comma-list of only wanted targets.
|
static String |
KEY_TARGETMERIT
The name of the parameter that hold the target merit.
|
static String |
KEY_TIME
The name of the parameter that holds the time.
|
private TargetDependingParameter |
merit
The target depending parameter giving the merit of the target.
|
private Map<TargetDefinition,Float> |
targets
A map of parsed targets to highest merit.
|
private CurrentTime |
time
The current time.
|
KEY_INDEXKEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
ObservableList(Map<String,String> sprop)
Constructs a new observable targets list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearObservables()
Clears the list of observable targets.
|
void |
exit()
Exits this parameter.
|
Object |
getForError(ErrorEvent ee)
Picks the highest-ever recorded merit for the target delivered with
this error.
|
Number |
getForTarget(TargetDefinition td)
Picks the highest-ever recorded merit for this target.
|
List<ObservableList.DateMerit> |
getMeritCourse(TargetDefinition key)
Returns the course of this target merits.
|
Number |
getValue()
Returns the same object as
Parameter.get() but already cast into
a Number. |
void |
init()
Transforms the
KEY_IGNORE property into a list of target names
that should be discarded. |
void |
registerError(ErrorEvent ee)
Registers a target-picked error.
|
void |
registerParameter(Parameter possmerit)
Registers the target merit parameter used to deduce the highest
merit during an observing period.
|
void |
registerProvider(TargetProviding<? extends TargetDefinition> list)
On target registering, we create a new mapping of targets to highest
merits and the linking of targets to the merit course.
|
void |
registerTarget(TargetDefinition td)
Target picked is the error that issues an update.
|
Number |
setValue(Number list)
Whenever this method is called with a collection of
TargetDefinitions as its argument, the internal list of
observable targets is updated:
Targets present in the KEY_IGNORE list are discarded.
All targets not present in targets are added with their
current merit.
All targets already present are checked for their current merit. |
private void |
update(TargetDefinition td)
/**
Tries to get the merit of the target from the associated target merit.
|
get, setgetAsStar, getConstant, getFormattedFor, getSetupcreateParameter, delivers, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, overrideDefaultName, register, rescanned, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, 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, stringPropertiesgetFormattedForpublic static final String KEY_TIME
public static final String KEY_TARGETMERIT
public static final String KEY_IGNORE
public static final String KEY_ONLY
public static final String KEY_MAXENTRIES
public static final String KEY_DUMPOBSERVE
public static final String KEY_DUMPCOURSE
public static final String DEFNAME
private static final int DEFMAXENTRIES
private static final String DEFTIME
private static final String DEFTARGETMERIT
private Map<TargetDefinition,Float> targets
private Map<TargetDefinition,Shelf<ObservableList.DateMerit>> course
private TargetDependingParameter merit
private CurrentTime time
private TargetDefinition current
public void init()
throws InitException
KEY_IGNORE property into a list of target names
that should be discarded. Set the time zone to GMT on the date
formatter.init in interface Initializableinit in class AbstractParameterInitExceptionpublic void exit()
KEY_DUMPOBSERVE or
KEY_DUMPCOURSE is set, the mapping of targets to their highest
merits is writtn to KEY_DUMPOBSERVE, or the course of
the particular target's merit is writtn as a file named after the
target into the directory KEY_DUMPCOURSE.exit in interface ExitCleaningexit in class AbstractParameterpublic void registerParameter(Parameter possmerit)
registerParameter in interface ParameterDependingpublic Number setValue(Number list)
TargetDefinitions as its argument, the internal list of
observable targets is updated:
KEY_IGNORE list are discarded.targets are added with their
current merit.public void registerProvider(TargetProviding<? extends TargetDefinition> list)
registerProvider in interface TargetProviderDependingpublic void registerTarget(TargetDefinition td)
registerTarget in interface TargetDependingpublic Number getForTarget(TargetDefinition td)
getForTarget in interface TargetDependingParametergetForTarget in interface TargetDependingValuepublic Object getForError(ErrorEvent ee)
getFor with
the target definition in the errorgetForError in interface ErrorDependingParameterpublic Number getValue()
ValueParameter.get() but already cast into
a Number. Primitive data types can directly be extracted from
this number without any further explicit casting.public void registerError(ErrorEvent ee)
registerError in interface ErrorDependingParameterprivate void update(TargetDefinition td)
public List<ObservableList.DateMerit> getMeritCourse(TargetDefinition key)
key - A target definition.public void clearObservables()