edu.nrao.sss.model.project
Class AbstractScheduleIterator

java.lang.Object
  extended by edu.nrao.sss.model.project.AbstractScheduleIterator
Direct Known Subclasses:
ObserveScriptBuilder

public class AbstractScheduleIterator
extends Object

This class provides a template method (iterateOverSchedulingBlock(edu.nrao.sss.model.project.SchedulingBlock)) that iterates over all the scans in a SB. The class provides protected variables that keep track of the current scan's start and stop MJD, currentScanNumber, totalDuration (so far), the slew time of this scan, and a boolean flag to indicate whether or not the passed in SB is scheduled dymanically. Clients of this class must create a subclass and override one or more of the following methods:

Subclasses may also toggle the validatesSchedulingBlock property. If this class is NOT validating its scheduling block, it is the client's responsibility to validate the SB before calling iterateOverSchedulingBlock. If a SB is found to be incomplete the iteration will stop. If a scan is found that has no source or no source position, a SourceNotFoundException will be thrown. A CoordinateConversionException will be thrown if there is a problem converting the source position to either RA/Dec or Az/El. If validation is turned off, there is no gauruntee that the protected variables this class provides during iteration will be correct.


Field Summary
protected  int currentScanNumber
           
protected  boolean dynamicSched
           
protected  JulianDate endMjd
           
protected static EarthPosition EVLA_LOCATION
           
protected static LocalSiderealTime EVLA_LST
           
protected  int scanCount
           
protected  EvlaTelescopeMotionSimulator sim
           
protected  TimeDuration slewTime
           
protected  JulianDate startMjd
           
protected static TimeDuration SUBREFLECTOR_SLEW
           
protected  TimeDuration totalDuration
           
 
Constructor Summary
AbstractScheduleIterator()
           
 
Method Summary
protected  void afterFirstScanAction(Scan scan)
           
protected  void afterLastScanAction(Scan scan)
           
protected  void afterScanAction(Scan scan)
           
protected  void afterScanLoopAction(ScanLoop scan)
           
protected  void beforeFirstScanAction(Scan scan)
           
protected  void beforeIteratingAction()
           
protected  void beforeLastScanAction(Scan scan)
           
protected  void beforeScanAction(Scan scan)
           
protected  void beforeScanLoopAction(ScanLoop scan)
           
protected  SkyPosition getEndPosition(Scan scan, Date dateTime)
          Returns the appropriate end SkyPosition object for scan at dateTime.
 TimeDuration getScheduleDuration()
          Returns the total time spent in this schedule so far.
protected  SkyPosition getStartPosition(Scan scan, Date dateTime)
          Returns the appropriate start SkyPosition object for scan at dateTime.
 boolean getValidatesSchedulingBlock()
           
 List<ValidationFailure> getValidationFailures()
          Returns a list of all warnings and errors that were found during the last call to iterateOverSchedulingBlock.
 boolean hasValidationErrors()
          Returns true if the last call of iterateOverSchedulingBlock had validation errors.
 boolean hasValidationWarnings()
          Returns true if the last call of iterateOverSchedulingBlock had validation warnings.
 void iterateOverSchedulingBlock(SchedulingBlock sb)
          See class comments.
protected  void scanAction(Scan scan)
           
 void setValidatesSchedulingBlock(boolean v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVLA_LOCATION

protected static final EarthPosition EVLA_LOCATION

EVLA_LST

protected static final LocalSiderealTime EVLA_LST

SUBREFLECTOR_SLEW

protected static final TimeDuration SUBREFLECTOR_SLEW

sim

protected EvlaTelescopeMotionSimulator sim

currentScanNumber

protected int currentScanNumber

scanCount

protected int scanCount

startMjd

protected JulianDate startMjd

endMjd

protected JulianDate endMjd

totalDuration

protected TimeDuration totalDuration

slewTime

protected TimeDuration slewTime

dynamicSched

protected boolean dynamicSched
Constructor Detail

AbstractScheduleIterator

public AbstractScheduleIterator()
Method Detail

hasValidationErrors

public boolean hasValidationErrors()
Returns true if the last call of iterateOverSchedulingBlock had validation errors.


hasValidationWarnings

public boolean hasValidationWarnings()
Returns true if the last call of iterateOverSchedulingBlock had validation warnings.


getValidationFailures

public List<ValidationFailure> getValidationFailures()
Returns a list of all warnings and errors that were found during the last call to iterateOverSchedulingBlock.


getValidatesSchedulingBlock

public boolean getValidatesSchedulingBlock()

setValidatesSchedulingBlock

public void setValidatesSchedulingBlock(boolean v)

getScheduleDuration

public TimeDuration getScheduleDuration()
Returns the total time spent in this schedule so far. The value that this method returns is updated before calling the beforeFirstScanAction, beforeScanAction and beforeLastScanAction methods. It is NOT updated before calling beforeScanLoopAction. The value returned is a clone of the real object held internally so changes to it will NOT be reflected in this class.


iterateOverSchedulingBlock

public void iterateOverSchedulingBlock(SchedulingBlock sb)
                                throws IllegalArgumentException,
                                       CoordinateConversionException,
                                       SourceNotFoundException
See class comments.

Throws:
IllegalArgumentException
CoordinateConversionException
SourceNotFoundException

getStartPosition

protected SkyPosition getStartPosition(Scan scan,
                                       Date dateTime)
                                throws SourceNotFoundException
Returns the appropriate start SkyPosition object for scan at dateTime. This method takes into account more complicated Scan modes that do not necessarily specify a Source object for the scan.

Throws:
SourceNotFoundException

getEndPosition

protected SkyPosition getEndPosition(Scan scan,
                                     Date dateTime)
                              throws SourceNotFoundException
Returns the appropriate end SkyPosition object for scan at dateTime. This method takes into account more complicated Scan modes that do not necessarily specify a Source object for the scan.

Throws:
SourceNotFoundException

beforeScanLoopAction

protected void beforeScanLoopAction(ScanLoop scan)

afterScanLoopAction

protected void afterScanLoopAction(ScanLoop scan)

beforeIteratingAction

protected void beforeIteratingAction()

beforeFirstScanAction

protected void beforeFirstScanAction(Scan scan)

afterFirstScanAction

protected void afterFirstScanAction(Scan scan)

beforeLastScanAction

protected void beforeLastScanAction(Scan scan)

afterLastScanAction

protected void afterLastScanAction(Scan scan)

beforeScanAction

protected void beforeScanAction(Scan scan)

scanAction

protected void scanAction(Scan scan)

afterScanAction

protected void afterScanAction(Scan scan)


Copyright © 2009. All Rights Reserved.