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

java.lang.Object
  extended by edu.nrao.sss.model.project.scan.DelaySetting
All Implemented Interfaces:
Cloneable, Comparable<DelaySetting>

public class DelaySetting
extends Object
implements Cloneable, Comparable<DelaySetting>

A setting used in a DelayScan.

Version Info:

$Revision: 1494 $
$Date: 2008-08-14 13:51:17 -0600 (Thu, 14 Aug 2008) $
$Author: dharland $ (last person to modify)

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

Constructor Summary
DelaySetting()
          Creates a new instance.
 
Method Summary
 DelaySetting clone()
          Returns a setting that is a copy of this one.
 int compareTo(DelaySetting other)
          Compares this setting with other for order.
 boolean equals(Object o)
          Returns true if o is equal to this setting.
 ScanTimeType getDurationType()
          Returns the type of duration used by this setting.
 double getNanoseconds()
          Returns the nanosecond delay used in 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.
 int hashCode()
          Returns a hash code value for this setting.
 void setDurationType(ScanTimeType newType)
          Sets a new duration type for this setting.
 void setNanoseconds(double ns)
          Sets the nanosecond delay used in 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.
 String toString()
          Returns a text representation of this delay setting.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelaySetting

public DelaySetting()
Creates a new instance.

Method Detail

setNanoseconds

public void setNanoseconds(double ns)
Sets the nanosecond delay used in this setting. This value is allowed to be negative because it refers to a delay that is relative to the current setting.

Parameters:
ns - the nanosecond delay used in this setting.

getNanoseconds

public double getNanoseconds()
Returns the nanosecond delay used in this setting.

Returns:
the nanosecond delay used in this setting.
See Also:
setNanoseconds(double)

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.

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 delay setting. The returned string is of the form nanoseconds,timeAtSetting.

Overrides:
toString in class Object

compareTo

public int compareTo(DelaySetting other)
Compares this setting with other for order.

If this setting has a smaller delay than the other's, a negative value is returned; if larger, a positive value is returned. If both settings have the delay, a negative value is returned if this setting has a smaller time duration than the other. The duration type is not used for figuring out which time duration is larger or smaller. If the durations are equal in magnitude, though, a comparison of durations will be used to break the tie, but only in order to stay consistent with equals().

Specified by:
compareTo in interface Comparable<DelaySetting>

clone

public DelaySetting 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.