stella.xml
Class PerNightMerit

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.AbstractMerit
                  extended by stella.xml.PerNightMerit
All Implemented Interfaces:
Serializable, Cloneable, Meriting, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class PerNightMerit
extends AbstractMerit

A class defining a time-slot merit for a target that should be observed up to KEY_PERNIGHT times in a night, at least separated by KEY_TIMEOUT. The merit toggles between zero and one.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFNIGHTLENGTH
          Default time-span for successful observations.
private static int DEFPERNIGHT
          Default number of observations to force time-out.
private static String DEFTIME
          Default time parameter name.
private static long DEFTIMEOUT
          Default value for the time-out.
static String KEY_NIGHTLENGTH
          The key pointing to the name of the nightlength parameter.
static String KEY_PERNIGHT
          The number of targets that must be observed to force timeout.
static String KEY_TIME
          The key pointing to the name of the time parameter.
static String KEY_TIMEOUT
          The key linked to the time-out in milliseconds.
 
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.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
PerNightMerit(Map prop)
          Constructs a time-out merit.
 
Method Summary
 double getMerit(ParameterClustering set, TargetDefinition target, Collection ignore, long within)
          Calculates the actual time slot merit.
 
Methods inherited from class stella.AbstractMerit
createMerit, getInitializer, initMerit
 
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, init, 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.ResourceSupplying
getResource, getResourceAsStream, getResources
 
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.Initializable
init
 

Field Detail

KEY_TIMEOUT

public static final String KEY_TIMEOUT
The key linked to the time-out in milliseconds.

See Also:
Constant Field Values

KEY_PERNIGHT

public static final String KEY_PERNIGHT
The number of targets that must be observed to force timeout.

See Also:
Constant Field Values

KEY_TIME

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

See Also:
Constant Field Values

KEY_NIGHTLENGTH

public static final String KEY_NIGHTLENGTH
The key pointing to the name of the nightlength parameter.

See Also:
Constant Field Values

DEFTIMEOUT

private static final long DEFTIMEOUT
Default value for the time-out.

See Also:
Constant Field Values

DEFPERNIGHT

private static final int DEFPERNIGHT
Default number of observations to force time-out.

See Also:
Constant Field Values

DEFNIGHTLENGTH

private static final String DEFNIGHTLENGTH
Default time-span for successful observations.

See Also:
Constant Field Values

DEFTIME

private static final String DEFTIME
Default time parameter name.

See Also:
Constant Field Values
Constructor Detail

PerNightMerit

public PerNightMerit(Map prop)
Constructs a time-out merit. It defaults the KEY_TIMEOUT parameter. Proper creation should be done using the AbstractMerit.createMerit(java.util.Map) method. This create method also takes care of proper parameter overloading.

Method Detail

getMerit

public double getMerit(ParameterClustering set,
                       TargetDefinition target,
                       Collection ignore,
                       long within)
Calculates the actual time slot merit. If the time passed (in ms) since the last observation is less than KEY_TIMEOUT, a merit of zero is returned. If not, the succes being back KEY_PERNIGHT in time is looked at. If this date compared to the actual time is shorter than the night length, zero is returned, otherwise one is returned.
If the target definition is not history aware, one is returned.

Parameters:
set - Current observing conditions.
target - The actual target.
ignore - The list of targetes relevant to the actual target.
within - The relevant time span in ms.