edu.nrao.sss.measure
Class Wave

java.lang.Object
  extended by edu.nrao.sss.measure.Wave

public class Wave
extends Object

A wave with properties of velocity, wavelength, and frequency.

Version Info:

$Revision: 1490 $
$Date: 2008-08-13 16:38:27 -0600 (Wed, 13 Aug 2008) $
$Author: dharland $

Since:
2006-12-05
Author:
David M. Harland

Field Summary
static BigDecimal LIGHT_SPEED_VACUUM_KM_PER_SEC
          The speed of light in a vacuum, expressed in kilometers per second.
 
Constructor Summary
Wave()
          Creates a new wave with velocity equal to that of light in a vacuum.
Wave(LinearVelocity speedOfWave)
          Creates a new wave with the given velocity.
 
Method Summary
 Frequency getFrequency()
          Returns a copy of this wave's frequency.
 BigDecimal getFrequencyValueIn(FrequencyUnits units)
          Returns the frequency of this wave in the given units.
 LinearVelocity getVelocity()
          Returns a copy of the velocity of this wave.
 BigDecimal getVelocityValueIn(LinearVelocityUnits units)
          Returns the velocity of this wave in the given units.
 Distance getWavelength()
          Returns a copy of this wave's wavelength.
 BigDecimal getWavelengthValueIn(DistanceUnits units)
          Returns the wavelength of this wave in the given units.
 Wave setFrequency(Frequency newFrequency)
          Sets this wave's frequency so that it is equal to newFrequency.
 Wave setVelocity(LinearVelocity newVelocity)
          Sets this wave's velocity so that it is equal to newVelocity.
 Wave setWavelength(Distance newWavelength)
          Sets this wave's wavelength so that it is equal to newWavelength.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LIGHT_SPEED_VACUUM_KM_PER_SEC

public static final BigDecimal LIGHT_SPEED_VACUUM_KM_PER_SEC
The speed of light in a vacuum, expressed in kilometers per second. The value used is 299,792.458 km/s.

Constructor Detail

Wave

public Wave()
Creates a new wave with velocity equal to that of light in a vacuum. The default frequency of this wave is one gigahertz.


Wave

public Wave(LinearVelocity speedOfWave)
Creates a new wave with the given velocity. The default frequency of this wave is one gigahertz.

Parameters:
speedOfWave - the velocity of this wave.
Throws:
IllegalArgumentException - if speedOfWave is null or has a non-positive value.
Method Detail

setVelocity

public Wave setVelocity(LinearVelocity newVelocity)
Sets this wave's velocity so that it is equal to newVelocity. Changing this wave's velocity will force a corresponding change in its wavelength while its frequency will be held constant.

Parameters:
newVelocity - a new velocity for this wave.
Returns:
this wave
Throws:
IllegalArgumentException - if newVelocity is null or has a non-positive value.

getVelocity

public LinearVelocity getVelocity()
Returns a copy of the velocity of this wave.

Returns:
a copy of the velocity of this wave.

getVelocityValueIn

public BigDecimal getVelocityValueIn(LinearVelocityUnits units)
Returns the velocity of this wave in the given units. This method will be faster than calling getVelocity().toUnits(units) because getVelocity() makes a copy of this wave's velocity, while this method does not.

Parameters:
units - units of velocity.
Returns:
the velocity of this wave in the given units.

setFrequency

public Wave setFrequency(Frequency newFrequency)
Sets this wave's frequency so that it is equal to newFrequency. Changing this wave's frequency will result in a corresponding change in its wavelength while its velocity will be held constant.

Parameters:
newFrequency - a new frequency for this wave.
Returns:
this wave.
Throws:
IllegalArgumentException - if newFrequency is null or has a non-positive value.

getFrequency

public Frequency getFrequency()
Returns a copy of this wave's frequency.

Returns:
a copy of this wave's frequency.

getFrequencyValueIn

public BigDecimal getFrequencyValueIn(FrequencyUnits units)
Returns the frequency of this wave in the given units. This method will be faster than calling getFrequency().asUnitsOf(units) because getFrequency() makes a copy of this wave's frequency, while this method does not.

Parameters:
units - units of frequency.
Returns:
the frequency of this wave in the given units.

setWavelength

public Wave setWavelength(Distance newWavelength)
Sets this wave's wavelength so that it is equal to newWavelength. Changing this wave's wavelength will result in a corresponding change in its frequency while its velocity will be held constant.

Parameters:
newWavelength - a new wavelength for this wave.
Returns:
this wave.
Throws:
IllegalArgumentException - if newWavelength is null or has a non-positive length.

getWavelength

public Distance getWavelength()
Returns a copy of this wave's wavelength.

Returns:
a copy of this wave's wavelength.

getWavelengthValueIn

public BigDecimal getWavelengthValueIn(DistanceUnits units)
Returns the wavelength of this wave in the given units. This method will be faster than calling getWavelength().toUnits(units) because getWavelength() makes a copy of this wave's wavelength, while this method does not.

Parameters:
units - units of wavelength.
Returns:
the wavelength of this wave in the given units.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009. All Rights Reserved.