stella.util
Class PointingScheduler

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.AbstractScheduler
                  extended by stella.xml.XMLScheduler
                      extended by stella.util.PointingScheduler
All Implemented Interfaces:
Cloneable, Scheduling, ExitCleaning, Initializable, LocalizedSupplying, Preserving, PropertySupplying, ResourceSupplying, StatusProviding

public class PointingScheduler
extends XMLScheduler
implements StatusProviding, Preserving

A class that should be used as a scheduler during automatic pointing model deriving.


Nested Class Summary
private  class PointingScheduler.HeightConstraint
          A height constraint.
private  class PointingScheduler.SolarConstraint
          A solar height constraint.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static Object ACQUIRE
           
private static String DEFALTITUDENAME
          The default name of the azimuth parameter.
private static String DEFAZIMUTHNAME
          The default name of the azimuth parameter.
private static double DEFCOMPLETIONLIMIT
          The default completion limit.
private static double DEFHEIGHT
          The default minimum height for pointing points.
private static int DEFMAXTILEFAILURE
          The default maximum allowed failures per tile.
private static int DEFMAXTILEOBSERVE
          The default maximum required observations per tile.
private static double DEFOVERRULEMERIT
          The default merit when we do not pointing.
private static int DEFPOINTS
          The default number of pointing points.
private static double DEFSOLHEIGHT
          The default maximum solar height height for pointing points.
private  List<ErrorListener> errlist
          This error handlers are notified on pointing model completion.
static String KEY_ALTITUDENAME
          The name of the altitude parameter.
static String KEY_AZIMUTHNAME
          The name of the azimuth parameter.
static String KEY_COMPLETIONLIMIT
          The fraction of successes needed.
static String KEY_HEIGHT
          The minimum height where pointing should start.
static String KEY_MAXTILEFAILURE
          The maximum allowed failures per tile.
static String KEY_MAXTILEOBSERVE
          The maximum required successful observations per tile.
static String KEY_OVERRULEMERIT
          Targets with a merit higher than this are always returned.
static String KEY_POINTS
          The number of pointings in the sky.
static String KEY_PRESERVE
          My preserve file.
static String KEY_SOLHEIGHT
          The maximum solar height where pointing should start.
private  TargetDefinition lasttarget
          The last target that was selected.
private  Integer lasttile
          The last tile index that was selected.
private static Object POINTING
          Pointing targets must have a type equal to this.
private  SphereTiles skynet
          The helper class that tiles the available sky into equal-sized tiles.
private  Map<Integer,Integer> success
          A mapping of tile numbers to successful acquires.
 
Fields inherited from class stella.xml.XMLScheduler
KEY_GLOBALCONSTRAINT, KEY_GLOBALMERIT, KEY_GLOBALWATCH
 
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
PointingScheduler(Map<String,String> prop)
          Constructs a new pointing scheduler.
 
Method Summary
 void addErrorListener(ErrorListener ear)
          Registers an error event listener to this property container.
private  boolean errorOnComplete()
          We check if we have enough observations for the pointing model as requested.
 void exit()
          On exit, we try to preserve our look-up table of tile numbers to successes.
 TargetDefinition getHighestTarget(ParameterClustering set, Collection<TargetDefinition> targets)
          The highest target is constructed in the following way: The azimuth and altitude of the target is extracted. The tile number it corresponds to is evaluated. If this tile has been observed more often then the currently most prominent tile, the target is discarded. If this tile has been observed less then the currently most prominent tile, this tile gets the most prominent one, the target's distance to the center gets the encounter distance and the target is kept as the possible promise. If this tile has been observed the same number of times then the currently most prominent tile, this target is kept if it is closer to it's tile center.
 void init()
          During init, we construct a global constraint from the target height.
private  boolean isComplete()
          We check if we have enough observations for the pointing model as requested.
 boolean preserve()
          If a preserve file is given via the KEY_PRESERVE key, we serialize the surrent lookup table of sky tile numbers to successes into this file and return true.
 Object provideStatus()
          Returns a string describing the progress of the pointing model.
 void removeErrorListener(ErrorListener ear)
          Deregisters an error event listener from this property container.
 boolean restore()
          Tries to restore the success lookup table from the KEY_PRESERVE file.
 
Methods inherited from class stella.xml.XMLScheduler
addMeritTrace, highestFromAll, removeMeritTrace
 
Methods inherited from class stella.AbstractScheduler
addGlobalConstraint, checkGlobalConstraints, createScheduler, getGlobalConstraints, getObservableTargets, registerMonitor, removeAllGlobalConstraints, removeGlobalConstraint, wakeUp
 
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_PRESERVE

public static final String KEY_PRESERVE
My preserve file.

See Also:
Constant Field Values

KEY_OVERRULEMERIT

public static final String KEY_OVERRULEMERIT
Targets with a merit higher than this are always returned.

See Also:
Constant Field Values

KEY_POINTS

public static final String KEY_POINTS
The number of pointings in the sky.

See Also:
Constant Field Values

KEY_HEIGHT

public static final String KEY_HEIGHT
The minimum height where pointing should start.

See Also:
Constant Field Values

KEY_COMPLETIONLIMIT

public static final String KEY_COMPLETIONLIMIT
The fraction of successes needed.

See Also:
Constant Field Values

KEY_SOLHEIGHT

public static final String KEY_SOLHEIGHT
The maximum solar height where pointing should start.

See Also:
Constant Field Values

KEY_MAXTILEOBSERVE

public static final String KEY_MAXTILEOBSERVE
The maximum required successful observations per tile.

See Also:
Constant Field Values

KEY_MAXTILEFAILURE

public static final String KEY_MAXTILEFAILURE
The maximum allowed failures per tile.

See Also:
Constant Field Values

KEY_AZIMUTHNAME

public static final String KEY_AZIMUTHNAME
The name of the azimuth parameter.

See Also:
Constant Field Values

KEY_ALTITUDENAME

public static final String KEY_ALTITUDENAME
The name of the altitude parameter.

See Also:
Constant Field Values

DEFOVERRULEMERIT

private static final double DEFOVERRULEMERIT
The default merit when we do not pointing.

See Also:
Constant Field Values

DEFPOINTS

private static final int DEFPOINTS
The default number of pointing points.

See Also:
Constant Field Values

DEFCOMPLETIONLIMIT

private static final double DEFCOMPLETIONLIMIT
The default completion limit.

See Also:
Constant Field Values

DEFHEIGHT

private static final double DEFHEIGHT
The default minimum height for pointing points.

See Also:
Constant Field Values

DEFSOLHEIGHT

private static final double DEFSOLHEIGHT
The default maximum solar height height for pointing points.

See Also:
Constant Field Values

DEFMAXTILEOBSERVE

private static final int DEFMAXTILEOBSERVE
The default maximum required observations per tile.

See Also:
Constant Field Values

DEFMAXTILEFAILURE

private static final int DEFMAXTILEFAILURE
The default maximum allowed failures per tile.

See Also:
Constant Field Values

DEFAZIMUTHNAME

private static final String DEFAZIMUTHNAME
The default name of the azimuth parameter.

See Also:
Constant Field Values

DEFALTITUDENAME

private static final String DEFALTITUDENAME
The default name of the azimuth parameter.

See Also:
Constant Field Values

POINTING

private static final Object POINTING
Pointing targets must have a type equal to this.


ACQUIRE

private static final Object ACQUIRE

skynet

private SphereTiles skynet
The helper class that tiles the available sky into equal-sized tiles.


success

private Map<Integer,Integer> success
A mapping of tile numbers to successful acquires.


lasttarget

private TargetDefinition lasttarget
The last target that was selected.


lasttile

private Integer lasttile
The last tile index that was selected.


errlist

private List<ErrorListener> errlist
This error handlers are notified on pointing model completion.

Constructor Detail

PointingScheduler

public PointingScheduler(Map<String,String> prop)
Constructs a new pointing scheduler.

Method Detail

init

public void init()
During init, we construct a global constraint from the target height.

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

exit

public void exit()
On exit, we try to preserve our look-up table of tile numbers to successes.

Specified by:
exit in interface ExitCleaning

preserve

public boolean preserve()
If a preserve file is given via the KEY_PRESERVE key, we serialize the surrent lookup table of sky tile numbers to successes into this file and return true.

Specified by:
preserve in interface Preserving
Returns:
False, if either no file or saving to file failed.

restore

public boolean restore()
Tries to restore the success lookup table from the KEY_PRESERVE file. Return true only if success is *non-null*

Specified by:
restore in interface Preserving
Returns:
False, if restoring the value was not possible.

addErrorListener

public void addErrorListener(ErrorListener ear)
Registers an error event listener to this property container. This method is used to add an error handler to this scheduler, which is notified as soon as pointing model measurements have been completed.


removeErrorListener

public void removeErrorListener(ErrorListener ear)
Deregisters an error event listener from this property container. This method is used for local listeners.


getHighestTarget

public TargetDefinition getHighestTarget(ParameterClustering set,
                                         Collection<TargetDefinition> targets)
The highest target is constructed in the following way:

Specified by:
getHighestTarget in interface Scheduling
Overrides:
getHighestTarget in class XMLScheduler

provideStatus

public Object provideStatus()
Returns a string describing the progress of the pointing model.

Specified by:
provideStatus in interface StatusProviding

isComplete

private boolean isComplete()
We check if we have enough observations for the pointing model as requested. If so, we return true.


errorOnComplete

private boolean errorOnComplete()
We check if we have enough observations for the pointing model as requested. If so, we notify our listeners with a pointing model completion error.