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

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

public class SwitchSetting
extends Object
implements Cloneable

A switch setting used by a SwitchingScan.

Version Info:

$Revision: 2190 $
$Date: 2009-04-13 15:15:03 -0600 (Mon, 13 Apr 2009) $
$Author: dharland $ (last person to modify)

Since:
2006-07-10
Author:
David M. Harland

Constructor Summary
SwitchSetting()
          Creates a new instance.
 
Method Summary
 SwitchSetting clone()
          Returns a setting that is a copy of this one.
 boolean equals(Object o)
          Returns true if o is equal to this setting.
 ScanTimeType getDurationType()
          Returns the type of duration used by this setting.
 Resource getResource()
          Returns the resource to use for this scan, or null if one cannot be found.
 Source getSource()
          Returns the source to use at the current time.
 Source getSource(Date dateTime)
          Returns the source to use at the given time.
 SourceCatalogEntry getSourceCatalogEntry()
          Returns either the Source or SourceLookupTable that is the used for this setting.
 TimeDuration getTimeAtSetting()
          Returns the amount of time that should be spent at this setting.
 ScanTimeSpecification getTimeSpec()
          A convenience method for fetching the time spent at this setting.
 boolean getUseForAutophasing()
          Returns true if the source in this setting should be used for autophasing.
 int hashCode()
          Returns a hash code value for this setting.
 void setDurationType(ScanTimeType newType)
          Sets a new duration type for this setting.
 void setResource(Resource newResource)
          Sets the resource to be used for this scan.
 void setSourceCatalogEntry(SourceCatalogEntry sourceOrTable)
          Sets either the Source or SourceLookupTable to use for this setting.
 void setTimeAtSetting(TimeDuration duration)
          Sets the amount of time that should be spent at this setting.
 void setTimeSpec(ScanTimeSpecification newSpec)
          A convenience method for setting the time spent at this setting.
 void setUseForAutophasing(boolean use)
          Determines whether or not the source in this switch setting should be used for autophasing.
 String toString()
          Returns a text representation of this pointing position.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwitchSetting

public SwitchSetting()
Creates a new instance.

Method Detail

setSourceCatalogEntry

public void setSourceCatalogEntry(SourceCatalogEntry sourceOrTable)
Sets either the Source or SourceLookupTable to use for this setting.

Parameters:
sourceOrTable - the Source or SourceLookupTable to use for this setting.

getSourceCatalogEntry

public SourceCatalogEntry getSourceCatalogEntry()
Returns either the Source or SourceLookupTable that is the used for this setting. The returned value may be null.

Returns:
the Source or SourceLookupTable used for this scan, or null if this setting has neither.

getSource

public Source getSource()
Returns the source to use at the current time. If this setting has no such source, null is returned.

Returns:
the source to use at the current time, or null if there is no such source.

getSource

public Source getSource(Date dateTime)
Returns the source to use at the given time. If this setting has no such source, null is returned.

Parameters:
dateTime - the time for which the source is needed.
Returns:
the source to use at the given time, or null if there is no such source.

setResource

public void setResource(Resource newResource)
Sets the resource to be used for this scan. This method will accept a value of null.

Parameters:
newResource - the resource to be used for this scan.

getResource

public Resource getResource()
Returns the resource to use for this scan, or null if one cannot be found.

Returns:
the resource to use for this scan, or null if one cannot be found.

setTimeAtSetting

public void setTimeAtSetting(TimeDuration duration)
Sets the amount of time that should be spent at this setting.

If duration is null, it will be treated as an non-null duration of size zero.

Parameters:
duration - the amount of time that should be spent at this setting.

getTimeAtSetting

public TimeDuration getTimeAtSetting()
Returns the amount of time that should be spent at this setting.

The returned value is guaranteed to be non-null. It is also the duration that is held internally by this position, so any changes made to the returned duration will be reflected in this object.

Returns:
the amount of time that should be spent at this setting.

setDurationType

public void setDurationType(ScanTimeType newType)
Sets a new duration type for this setting.

Parameters:
newType - the new duration type for this setting. If this value is null, the default duration type of ON_SOURCE_SIDEREAL will be used. This value must have its isDuration() method return true. If it does not, an IllegalArgumentException is thrown.
Throws:
IllegalArgumentException - if newType is not a duration type.

getDurationType

public ScanTimeType getDurationType()
Returns the type of duration used by this setting. This method helps clients interpret the value returned by getTimeAtSetting().

The returned type will be non-null and its isDuration() method will always return true.

Returns:
the type of duration used by this setting.

setUseForAutophasing

public void setUseForAutophasing(boolean use)
Determines whether or not the source in this switch setting should be used for autophasing.

Parameters:
use - true if the source in this setting should be used for autophasing.

getUseForAutophasing

public boolean getUseForAutophasing()
Returns true if the source in this setting should be used for autophasing.

Returns:
true if the source in this setting should be used for autophasing.

setTimeSpec

public void setTimeSpec(ScanTimeSpecification newSpec)
A convenience method for setting the time spent at this setting. This setting will not hold a reference to newSpec. Instead, this method will use its getTimeType() and getDuration() methods to set the time at setting and duration type of this object.

Parameters:
newSpec - the provider of the time at setting and duration type values for this setting. A value of null will result in a NullPointerException.
Throws:
IllegalArgumentException - if the time type held by newSpec is not a duration type.

getTimeSpec

public ScanTimeSpecification getTimeSpec()
A convenience method for fetching the time spent at this setting. The returned object is guaranteed to be non-null. It is not referenced internally by this setting, so any changes made to it by clients will not affect this object.

Returns:
the time at setting and duration type of this offset.

toString

public String toString()
Returns a text representation of this pointing position. The returned string is of the form source.name,resource.name, timeAtSetting,useForAutophasing.

Overrides:
toString in class Object

clone

public SwitchSetting clone()
Returns a setting that is a copy of this one.

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 setting.

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.