public class ParsedTarget extends SporeTarget implements HistoryAware, Appointable, Observable, Comparable<ParsedTarget>
TargetDefinition can be
parsed from and to an xml-file, see TargetFragment, but has no
document specific elements in it. This class should be used in the STELLA
observations. It is fed and can be exported to xml-files. For details of the
xml-format, see DOMTarget.| Modifier and Type | Class and Description |
|---|---|
private class |
ParsedTarget.RateThread
A thread that waits for an expression to be fulfilled, then queries its
constraints and rates an observation as successful, if everthing is
fulfilled.
|
SporeTarget.Constraint, SporeTarget.DumpAbstractTarget.Aim, AbstractTarget.Allocation, AbstractTarget.ConstraintAdapter, AbstractTarget.FitsEntry, AbstractTarget.PickAdapter, AbstractTarget.Setup, AbstractTarget.TargetComparatorPropertyResources.Load, PropertyResources.URLResourceHistoryAware.PickAppointable.Constraint| Modifier and Type | Field and Description |
|---|---|
private boolean |
abort
A flag stating that the target should be aborted.
|
private Map<String,Appointable> |
daughters
Keys from xml-file, parsed on
resolveChildren(java.util.Collection<stella.Appointable>). |
private double |
daymerit
The daily high merit.
|
private long |
daytime
and its date.
|
private static double |
DEFACCELERATE
The default parameter name giving the remaining night-time.
|
private static int |
DEFDELAYMAX
Default number of delays.
|
private static long |
DEFDELAYTIME
Default time of delays.
|
private static double |
DEFMERITCAP
The default merit cap.
|
private static String |
DEFNIGHT
The default parameter name giving the remaining night-time.
|
private static boolean |
DEFOBSBAD
The default resources.
|
private static boolean |
DEFOBSGOOD
The default resources.
|
private static int |
DEFRATERETRY
The maximum number of retries to rate a target.
|
private static long |
DEFRATEWAIT
The wait time between individual rate attempts.
|
private static int |
DEFRETRYMAX
Default number of retries.
|
private int |
delaycount
The number of actual delays.
|
private static List<TimerTask> |
delays
The timer to allow re-enabling of the target.
|
private static Timer |
delaytimer
The timer to allow re-enabling of the target.
|
private boolean |
finished
Signals that this target has been finished.
|
private double |
himerit
The highest merit achieved.
|
private long |
hitime
The highest merit time.
|
private static HistorySql |
hsql
The history database.
|
static String |
KEY_ACCELERATE
The key to the optional acceleration.
|
static String |
KEY_CALCULATOR
The key to the properties of the exposure time calculator.
|
static String |
KEY_HISTORYDB
If special history-db properties are required.
|
static String |
KEY_NIGHT
The key to the parameter name of the remaining night-time.
|
static String |
KEY_OBSBAD
Defaults to false.
|
static String |
KEY_OBSGOOD
Defaults to false.
|
static String |
KEY_RATERETRY
The maximum number of retries to rate a target.
|
static String |
KEY_RATEWAIT
The wait time between individual rate attempts.
|
static String |
KEY_TASKDB
If special task-db properties are required.
|
private Appointable.Constraint |
lastfail
The constraint that made observing impossible.
|
private double |
lastmerit
The last merit achieved.
|
private Handable |
parent
The parent target.
|
private boolean |
picked
True when the target gets picked.
|
private static ThreadGroup |
rategroup
The rate thread groups.
|
private boolean |
retry
A flag stating that the target should be retried immediately.
|
private int |
retrycount
The number of actual retries.
|
private static long |
serialVersionUID
Sometimes this must be changed!.
|
private Appointable |
successor
The successor target.
|
private boolean |
triumph
True until an error signals unsuccessful target execution.
|
private static TaskSql |
tsql
The task database.
|
aborting, astronomy, blocking, canrate, constraints, daughternames, dbread, dbwrite, DEFIMAGETYPE, delaying, delaymax, delaytime, description, duration, email, enabled, fitsheader, gains, hdbread, hdbwrite, history, historymax, historyover, ignoring, imagetype, institution, KEY_IMAGETYPE, notify, proposal, rate, requires, retrying, retrymax, setup, submitted, successorname, targetfile, targetname, targettype, team, timeslots, title, userexpoKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
ParsedTarget() |
ParsedTarget(Map<String,String> prop)
Constructs a new xml target.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExecution(GlobalGrouping condition,
Date start,
long duration,
String unique,
String rem)
Adds a pick to this target.
|
private boolean |
checkConstraints(GlobalGrouping condition,
List<Appointable.Constraint> olimit)
Checks the constraints if any are over.
|
private boolean |
checkOver(GlobalGrouping condition,
List<?> merits)
Checks the list of merits for possible end point-defining merits.
|
int |
compareTo(ParsedTarget o)
Compares two parsed targets.
|
boolean |
equals(Object that)
Compares this target definition for equality.
|
void |
errorDaughter(ErrorEvent success,
ErrorFinalizing finish,
ParameterClustering set)
Signals that an error has occured in a daughter of this target.
|
void |
errorMain(ErrorEvent success,
ErrorFinalizing finish,
ParameterClustering set)
Signals that an error has occured in this target.
|
void |
errorSuccessor(ErrorEvent success,
ErrorFinalizing finish,
ParameterClustering set)
Signals that an error has occured in the successor to this target.
|
double |
getActualMerit(GlobalGrouping condition,
Collection<Appointable> oftargets,
long within)
Returns the actual value of the merit of this target.
|
Date |
getDailyDate()
The date of the high daily merit.
|
double |
getDailyMerit()
The highest merit in the last 24 hours.
|
Collection<Appointable> |
getDaughters()
Returns a list of daugther targets.
|
Date |
getHighestDate()
The date of the highest merit.
|
double |
getHighestMerit()
The highest merit ever achieved.
|
Appointable.Constraint |
getLastFail()
If anybody want to query why we have been unobservable, use this method.
|
double |
getLastMerit()
If anybody wants to query the last merit the target achieved and not want
to wander through the
TargetMerit parameter. |
long |
getObservingTime(GlobalGrouping set)
Returns an estimate of the observing time required for this target.
|
Handable |
getPrecursor()
Returns the parent target.
|
long |
getRemainingTime(GlobalGrouping set)
Returns the remaining time of the observation time for this target.
|
private long |
getRemainingTime(GlobalGrouping set,
boolean info)
Returns the remaining time of the observation time for this target.
|
Appointable |
getSuccessor()
Returns the successor target, if this target has one.
|
int |
hashCode()
For entries in hash-tables.
|
boolean |
isAbort(GlobalGrouping set)
Checks if the target should be aborted.
|
boolean |
isFinished()
Returns the finished flag.
|
boolean |
isNotify(UserProfile.Notifies condition)
Returns true if the condition passed over is found in the notification
list.
|
boolean |
isObservable(GlobalGrouping condition)
Determines if this target is currently observable.
|
boolean |
isPicked()
Returns true if this target is currently picked.
|
boolean |
isProgramOver(GlobalGrouping condition)
Checks if a target has completed is life-cycle within an observing
program.
|
boolean |
isRetry(GlobalGrouping set)
Checks if the target should be retried.
|
static ParsedTarget |
makeRunnable(String tel,
SporeTarget skel) |
private void |
processError(ErrorEvent success,
ErrorFinalizing finish,
ParameterClustering set,
List<String> blocklist,
List<String> delaylist,
Integer delmax,
Long deltime,
List<String> retrylist,
Integer retmax,
List<String> ignorelist,
List<String> abortlist)
Depending on the target the termination acts on, the different abort
sections are loaded.
|
boolean |
resolveChildren(Collection<Appointable> alltargets)
Resolve all children.
|
void |
setEnabled(boolean to)
Sets the access attribute to enabled.
|
void |
setFinished(boolean isready)
Sets the finished flag.
|
static void |
setHistorySql(HistorySql h)
Sets the history database.
|
void |
setLoggingForFailedConstraints(boolean to)
We set the volatile flag for extensive logging on reasons why this target
is not observable during night run.
|
void |
setLoggingForObservingTime(boolean to)
Announce interest on logging the target's remaining observing time
|
void |
setPicked(boolean ispicked)
Signals that this target has been selected for observing.
|
void |
setPrecursor(Handable anchestor)
Sets the parent target of this target.
|
void |
setProgramCompleted(boolean over)
Returns true if the observing program on this target is over.
|
static void |
setTaskSql(TaskSql t)
Sets the task database.
|
String |
toString()
Returns a string representation of the DOM-Target.
|
private static void |
trimHistory(List<? extends HistoryAware.Pick> history,
long notlater)
Trimming the histroy means removing any pick that is later than the
stated day.
|
addDaughterName, clearHistory, getAbortErrors, getAstronomicalData, getBlockErrors, getConstraints, getDatabaseRead, getDatabaseWrite, getDaughterNames, getDelayErrors, getDelays, getDelayTimes, getDescription, getDescriptionID, getDuration, getEmailAddresses, getEntireHistory, getFailure, getFailureCount, getFile, getFirstFailure, getFirstPick, getFirstSuccess, getFitsHeader, getGainMerits, getHistoryDatabaseRead, getHistoryDatabaseWrite, getHistoryMax, getIgnoreErrors, getImageType, getInstitution, getLastFailure, getLastPick, getLastSuccess, getName, getNotify, getPick, getPickCount, getRateConstraints, getRateRequires, getRequires, getRetries, getRetryErrors, getSetups, getSubmitted, getSuccess, getSuccessCount, getSuccessorName, getTargetResource, getTargetSpecific, getTeam, getTimeslotMerits, getTitle, getType, getUser, isEnabled, isProgramCompleted, setAstronomicalData, setConstraints, setDatabaseAccess, setDelayAndRetry, setDescription, setDuration, setEmailAddresses, setErrors, setFitsHeader, setHistory, setHistoryDatabaseAccess, setImageType, setInstitution, setMerits, setNotify, setRateConstraints, setRateRequires, setRequires, setSetups, setSubmitted, setSuccessorName, setTargetFile, setTargetName, setTargetType, setTeam, setTitle, setUser, sumExposuresclone, 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, rescanned, setObject, setProperties, setProperty, stringPropertiesfinalize, getClass, notify, notifyAll, wait, wait, waitgetEntireHistory, getFailure, getFailureCount, getFirstFailure, getFirstPick, getFirstSuccess, getLastFailure, getLastPick, getLastSuccess, getPick, getPickCount, getSubmitted, getSuccess, getSuccessCount, isProgramCompletedgetDescription, getDescriptionID, getEmailAddresses, getImageType, getInstitution, getName, getTargetResource, getTargetSpecific, getTeam, getTitle, getType, getUserdefaultBoolean, 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, stringPropertiesprivate static final long serialVersionUID
public static final String KEY_NIGHT
public static final String KEY_ACCELERATE
public static final String KEY_CALCULATOR
public static final String KEY_RATERETRY
public static final String KEY_RATEWAIT
public static final String KEY_HISTORYDB
public static final String KEY_TASKDB
public static final String KEY_OBSBAD
public static final String KEY_OBSGOOD
private static final int DEFRETRYMAX
private static final int DEFDELAYMAX
private static final long DEFDELAYTIME
private static final int DEFRATERETRY
private static final long DEFRATEWAIT
private static final String DEFNIGHT
private static final double DEFMERITCAP
private static final double DEFACCELERATE
private static final boolean DEFOBSBAD
private static final boolean DEFOBSGOOD
private boolean finished
private boolean picked
private boolean triumph
private boolean abort
private Appointable.Constraint lastfail
private double lastmerit
private double himerit
private long hitime
private double daymerit
private long daytime
private boolean retry
private int retrycount
private int delaycount
private Handable parent
private Appointable successor
resolveChildren(java.util.Collection<stella.Appointable>).private Map<String,Appointable> daughters
resolveChildren(java.util.Collection<stella.Appointable>).private static transient Timer delaytimer
private static transient List<TimerTask> delays
private static transient ThreadGroup rategroup
private static transient HistorySql hsql
private static transient TaskSql tsql
public static ParsedTarget makeRunnable(String tel, SporeTarget skel)
public void setLoggingForFailedConstraints(boolean to)
setLoggingForFailedConstraints in interface Observablepublic void setLoggingForObservingTime(boolean to)
ObservablesetLoggingForObservingTime in interface Observablepublic static void setHistorySql(HistorySql h)
public static void setTaskSql(TaskSql t)
public Handable getPrecursor()
getPrecursor in interface Handablepublic void setPrecursor(Handable anchestor)
setPrecursor in interface Handablepublic void setEnabled(boolean to)
setEnabled in interface HandablesetEnabled in class SporeTargetpublic void setFinished(boolean isready)
setFinished in interface Handablepublic boolean isFinished()
isFinished in interface Handablepublic void setPicked(boolean ispicked)
DTDConstants.PICK section when this method is called with a
false argument. Additionally, this method clears some flags:
setPicked in interface HandableHandable.errorMain(stella.ErrorEvent, stella.ErrorFinalizing, stella.ParameterClustering)public boolean isPicked()
setPicked(boolean) method.isPicked in interface HandableHandable.setPicked(boolean)public boolean isNotify(UserProfile.Notifies condition)
public void errorMain(ErrorEvent success, ErrorFinalizing finish, ParameterClustering set)
DTDConstants.IGNORE list, the
observation is considered successful, i.e. the error encounter is
spurious.DTDConstants.RETRY list and its
current retry-count has not reached the maximum retries, it is
rescheduled immediately, if it is still observable. If the maximum
retries are reached, the target is disabled.DTDConstants.DELAY list and its
current delay-count has not reached its maximum, the target is disabled
for the stated amount of time and may be picked afterwards. If the
maximum retries are reached, the target is disabled.DTDConstants.BLOCK list
or is unknown, further target picking is disabled.DTDConstants.ABORT section, the
abort flag is raised.errorMain in interface Handablesuccess - The ErrorEvent outcome of the last sequence.at - The target which was executed and produced the outcome.processError(stella.ErrorEvent, stella.ErrorFinalizing, stella.ParameterClustering, java.util.List<java.lang.String>, java.util.List<java.lang.String>, java.lang.Integer, java.lang.Long, java.util.List<java.lang.String>, java.lang.Integer, java.util.List<java.lang.String>, java.util.List<java.lang.String>)public void errorDaughter(ErrorEvent success, ErrorFinalizing finish, ParameterClustering set)
DTDConstants.IGNORE list, the
observation is considered successful, i.e. the error encounter is
spurious.DTDConstants.RETRY list and its
current retry-count has not reached the maximum retries, it is
rescheduled immediately, if it is still observable. If the maximum
retries are reached, the target is disabled.DTDConstants.DELAY list and its
current delay-count has not reached its maximum, the target is disabled
for the stated amount of time and may be picked afterwards. If the
maximum retries are reached, the target is disabled.DTDConstants.BLOCK list
or is unknown, further target picking is disabled.DTDConstants.ABORT section, the
abort flag is raised.errorDaughter in interface Handablesuccess - The ErrorEvent outcome of the last sequence.at - The target which was executed and produced the outcome.processError(stella.ErrorEvent, stella.ErrorFinalizing, stella.ParameterClustering, java.util.List<java.lang.String>, java.util.List<java.lang.String>, java.lang.Integer, java.lang.Long, java.util.List<java.lang.String>, java.lang.Integer, java.util.List<java.lang.String>, java.util.List<java.lang.String>)public void errorSuccessor(ErrorEvent success, ErrorFinalizing finish, ParameterClustering set)
DTDConstants.IGNORE list, the
observation is considered successful, i.e. the error encounter is
spurious.DTDConstants.RETRY list and its
current retry-count has not reached the maximum retries, it is
rescheduled immediately, if it is still observable. If the maximum
retries are reached, the target is disabled.DTDConstants.DELAY list and its
current delay-count has not reached its maximum, the target is disabled
for the stated amount of time and may be picked afterwards. If the
maximum retries are reached, the target is disabled.DTDConstants.BLOCK list
or is unknown, further target picking is disabled.DTDConstants.ABORT section, the
abort flag is raised.errorSuccessor in interface Handablesuccess - The ErrorEvent outcome of the last sequence.at - The target which was executed and produced the outcome.processError(stella.ErrorEvent, stella.ErrorFinalizing, stella.ParameterClustering, java.util.List<java.lang.String>, java.util.List<java.lang.String>, java.lang.Integer, java.lang.Long, java.util.List<java.lang.String>, java.lang.Integer, java.util.List<java.lang.String>, java.util.List<java.lang.String>)private void processError(ErrorEvent success, ErrorFinalizing finish, ParameterClustering set, List<String> blocklist, List<String> delaylist, Integer delmax, Long deltime, List<String> retrylist, Integer retmax, List<String> ignorelist, List<String> abortlist)
DTDConstants.EXCEPTION section handed over. In particular, this
method deals with the DTDConstants.DELAY and the
DTDConstants.RETRY and the DTDConstants.ABORT section.
Note that this method no longer adds a pick entry to the document, this
is done whenever the addExecution(globals.GlobalGrouping, java.util.Date, long, java.lang.String, java.lang.String) method is called.public void addExecution(GlobalGrouping condition, Date start, long duration, String unique, String rem)
setPicked(boolean) method with true and the call to this
method, either a successful or non-successful pick is added. If the
current size of the history is already at the maximum history, first the
one pick is removed from the list. The first successful and unsuccessful
pick is always retained, the pick removed is the oldest one that is not
the first successful or unsuccessful pick.addExecution in interface HistoryAwarestart - The actual observation start.duration - The duration of target observation, ms.rem - An optional comment.public Collection<Appointable> getDaughters()
AppointablegetDaughters in interface Appointablepublic boolean isObservable(GlobalGrouping condition)
DTDConstants.REQUIRES
section is true, evaluated according to the parameters found in the
parameter cluster handed over.DTDConstants.CONSTRAINTs are fullfilled.isObservable in interface Appointablecondition - The actual observing conditions. Conditions related to the
targetpublic double getActualMerit(GlobalGrouping condition, Collection<Appointable> oftargets, long within)
TargetFragment expansion, at least one DTDConstants.GAIN
and one DTDConstants.TIMESLOT Meriting instance is
described. During initialization of the target, the SporeTarget.timeslots
and SporeTarget.gains are initialized. To calculate the total merit, all
gains are added and then multiplied with the timeslot. The resulting
double is returned.getActualMerit in interface Appointablecondition - A set of actual observing conditionsoftargets - All targets relavant for this target.within - The timespan within the merit should be maximized.public Appointable.Constraint getLastFail()
getLastFail in interface Appointablepublic double getLastMerit()
TargetMerit parameter.getLastMerit in interface Appointablepublic double getHighestMerit()
getHighestMerit in interface Appointablepublic Date getHighestDate()
getHighestDate in interface Appointablepublic double getDailyMerit()
getDailyMerit in interface Appointablepublic Date getDailyDate()
getDailyDate in interface Appointablepublic boolean isProgramOver(GlobalGrouping condition)
EndpointDefining instance for completeness. As soon as a program
is over, also the HistoryAware implementation part toggles to
program over.isProgramOver in interface Appointableprivate boolean checkConstraints(GlobalGrouping condition, List<Appointable.Constraint> olimit)
condition - olimit - private boolean checkOver(GlobalGrouping condition, List<?> merits)
public long getRemainingTime(GlobalGrouping set)
DTDConstants.CONSTRAINT list and determines
for each DTDConstants.VARIABLE parameter a remaining time via the
parameter's Increasing or Decreasing property. Even if
the parameter neither implements one of this interfaces, it can still
deliver a remaining time of zero, if the current parameter reading is out
of bounds.getRemainingTime in interface Appointableprivate long getRemainingTime(GlobalGrouping set, boolean info)
DTDConstants.CONSTRAINT list and determines
for each DTDConstants.VARIABLE parameter a remaining time via the
parameter's Increasing or Decreasing property. Even if
the parameter neither implements one of this interfaces, it can still
deliver a remaining time of zero, if the current parameter reading is out
of bounds.public long getObservingTime(GlobalGrouping set)
DTDConstants.DURATION element is given, it is parsed and this
value is returned. If no such element is given, all the exposure times
found in the setup sections of this target are evaluated and added
together. If this is a parent target class without a setup section, zero
is returned.getObservingTime in interface Appointablepublic boolean isAbort(GlobalGrouping set)
isAbort in interface Appointablepublic boolean isRetry(GlobalGrouping set)
DTDConstants.RETRY clause
of the DTDConstants.EXCEPTION element, and the number of retries
have not reached the maximum retry count. Retry is also prohibited if the
current observation conditions block the target from observation.isRetry in interface Appointablepublic String toString()
toString in class PropertyContainerpublic boolean equals(Object that)
public int compareTo(ParsedTarget o)
compareTo in interface Comparable<ParsedTarget>public void setProgramCompleted(boolean over)
Appointable.isProgramOver(globals.GlobalGrouping) method in the sense
that a program completion is not bound to current observing
circumstances, thus the normal action is that an appointable target whose
program is over, may set this flag for fast replies.setProgramCompleted in class SporeTargetpublic Appointable getSuccessor()
getSuccessor in interface Handablepublic boolean resolveChildren(Collection<Appointable> alltargets)
SporeTarget.daughternames and
SporeTarget.successorname) into living target definition references.private static final void trimHistory(List<? extends HistoryAware.Pick> history, long notlater)