edu.nrao.sss.model.project.scan
Class ScanTimeSpecification

java.lang.Object
  extended by edu.nrao.sss.model.project.scan.ScanTimeSpecification
All Implemented Interfaces:
Cloneable

public class ScanTimeSpecification
extends Object
implements Cloneable

Specification for the timing of a Scan.

Version Info:

$Revision: 1709 $
$Date: 2008-11-14 11:22:37 -0700 (Fri, 14 Nov 2008) $
$Author: dharland $ (last person to modify)

Since:
2008-08-05
Author:
David M. Harland

Constructor Summary
ScanTimeSpecification()
          Creates a new time specification.
 
Method Summary
 ScanTimeSpecification clone()
          Returns a copy of this specification.
 boolean equals(Object o)
          Returns true if o is equal to this specification.
 TimeDuration getDuration()
          Returns the specified duration, provided the type of this specification is a duration.
 TimeOfDay getLst()
          Returns the specified local sidereal time of day, provided the type of this specification is an LST.
 Date getTime()
          Returns the specified UT date and time, provided the type of this specification is a UT point in time.
 String getTimeText()
          Returns a text representation of the duration or point in time held by this specification.
 ScanTimeType getTimeType()
          Returns the type of time held by this specification.
 int hashCode()
          Returns a hash code value for this specification.
 boolean isLengthOfTime()
          Returns true if this specification is a duration (as opposed to a point in time).
 boolean isOnSourceDuration()
          Returns true if this specification is a time-on-source duration.
 boolean isPointInTime()
          Returns true if this specification is a point in time (as opposed to a duration).
 boolean isSiderealTime()
          Returns true if this specification is expressed in sidereal units.
 boolean isStartTime()
          Returns true if this specification is a start time.
 boolean isStopTime()
          Returns true if this specification is a stop time.
 boolean isTotalDuration()
          Returns true if this specification is a total duration.
 boolean isUniversalTime()
          Returns true if this specification is expressed in SI units.
 void reset()
          Returns this object to the same state as a newly created specification.
 void set(ScanTimeType newType, Date newDateTime)
          Specifies the universal date and time for a scan.
 void set(ScanTimeType newType, LocalSiderealTime newLst)
          Specifies the local sidereal time for a scan.
 void set(ScanTimeType newType, String newTimeText)
          Specifies the timing for a scan.
 void set(ScanTimeType newType, TimeDuration newDuration)
          Specifies the duration for a scan.
 void set(ScanTimeType newType, TimeOfDay newLst)
          Specifies the local sidereal time for a scan.
 String toString()
          Returns a text representation of this specification.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScanTimeSpecification

public ScanTimeSpecification()
Creates a new time specification.

Method Detail

reset

public void reset()
Returns this object to the same state as a newly created specification.


set

public void set(ScanTimeType newType,
                String newTimeText)
Specifies the timing for a scan.

The values of the two parameters must make sense together. If they do not, an IllegalArgumentException is thrown. These are the rules for the parameters:

Parameters:
newType - the kind of time that newTimeText represents.
newTimeText - a text representation of a duration or point in time, depending on the value of newType.
Throws:
IllegalArgumentException - if the parameters do not make sense as a pair, or if newTimeText cannot be parsed.
See Also:
set(ScanTimeType, Date), set(ScanTimeType, LocalSiderealTime), set(ScanTimeType, TimeDuration), set(ScanTimeType, TimeOfDay)

set

public void set(ScanTimeType newType,
                TimeDuration newDuration)
Specifies the duration for a scan.

Parameters:
newType - must be a duration type. If it is not, an IllegalArgumentException will be thrown.
newDuration - the new duration for this specification. May not be null.
Throws:
IllegalArgumentException - if newType is not a duration or if newDuration is null.

set

public void set(ScanTimeType newType,
                TimeOfDay newLst)
Specifies the local sidereal time for a scan.

Parameters:
newType - must be both a point-in-time and a sidereal time. If it is not, an IllegalArgumentException will be thrown. At this time this was written, the only legal values were: ScanTimeType.START_LST and ScanTimeType.STOP_LST.
newLst - the new LST for this specification. May not be null.
Throws:
IllegalArgumentException - if the specifications above are not met.

set

public void set(ScanTimeType newType,
                LocalSiderealTime newLst)
Specifies the local sidereal time for a scan.

Parameters:
newType - must be both a point-in-time and a sidereal time. If it is not, an IllegalArgumentException will be thrown. At this time this was written, the only legal values were: ScanTimeType.START_LST and ScanTimeType.STOP_LST.
newLst - the new LST for this specification. May not be null. The LocalSiderealTime class is a date/time class, but only the time-of-day portion of this parameter will be used here.
Throws:
IllegalArgumentException - if the specifications above are not met.

set

public void set(ScanTimeType newType,
                Date newDateTime)
Specifies the universal date and time for a scan.

Parameters:
newType - must be both a point-in-time and a universal time. If it is not, an IllegalArgumentException will be thrown. At this time this was written, the only legal values were: ScanTimeType.START_UT and ScanTimeType.STOP_UT.
newDateTime - the new date and time for this specification. May not be null.
Throws:
IllegalArgumentException - if the specifications above are not met.

getTimeType

public ScanTimeType getTimeType()
Returns the type of time held by this specification.

Returns:
the type of time held by this specification.

getTimeText

public String getTimeText()
Returns a text representation of the duration or point in time held by this specification.

Returns:
a text representation of the time held by this specification.

getDuration

public TimeDuration getDuration()
Returns the specified duration, provided the type of this specification is a duration. Otherwise returns null.

The type of duration returned can be determined by calling getTimeType(), or by using the isXxx boolean methods.

The object returned is not the one held internally by this specification, so any changes made to it will not affect this specification.

Returns:
the specified duration, or null if this specification represents a point in time.

getLst

public TimeOfDay getLst()
Returns the specified local sidereal time of day, provided the type of this specification is an LST. Otherwise returns null.

Whether the returned time is a start or stop time can be determined by calling getTimeType(), isStartTime(), or isStopTime().

The object returned is not the one held internally by this specification, so any changes made to it will not affect this specification.

Returns:
the specified LST, or null if this specification represents a duration or UT point in time.

getTime

public Date getTime()
Returns the specified UT date and time, provided the type of this specification is a UT point in time. Otherwise returns null.

Whether the returned time is a start or stop time can be determined by calling getTimeType(), isStartTime(), or isStopTime().

The object returned is not the one held internally by this specification, so any changes made to it will not affect this specification.

Returns:
the specified UT date and time, or null if this specification represents a duration or local sidereal time.

isLengthOfTime

public boolean isLengthOfTime()
Returns true if this specification is a duration (as opposed to a point in time).

Returns:
true if this specification is a duration.

isPointInTime

public boolean isPointInTime()
Returns true if this specification is a point in time (as opposed to a duration).

Returns:
true if this specification is a point in time.

isOnSourceDuration

public boolean isOnSourceDuration()
Returns true if this specification is a time-on-source duration.

Returns:
true if this specification is a time-on-source duration.

isTotalDuration

public boolean isTotalDuration()
Returns true if this specification is a total duration.

Returns:
true if this specification is a total duration.

isStartTime

public boolean isStartTime()
Returns true if this specification is a start time.

Returns:
true if this specification is a start time.

isStopTime

public boolean isStopTime()
Returns true if this specification is a stop time.

Returns:
true if this specification is a stop time.

isUniversalTime

public boolean isUniversalTime()
Returns true if this specification is expressed in SI units.

Returns:
true if this specification is expressed in SI units.

isSiderealTime

public boolean isSiderealTime()
Returns true if this specification is expressed in sidereal units.

Returns:
true if this specification is expressed in sidereal units.

toString

public String toString()
Returns a text representation of this specification.

Overrides:
toString in class Object

clone

public ScanTimeSpecification clone()
Returns a copy of this specification.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Overrides:
clone in class Object

equals

public boolean equals(Object o)
Returns true if o is equal to this specification.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for this specification.

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.