edu.nrao.sss.model.resource
Class CorrelatorSubbandAbs

java.lang.Object
  extended by edu.nrao.sss.model.resource.CorrelatorSubbandAbs
All Implemented Interfaces:
CorrelatorSubband, HasBandwidth, Identifiable, Cloneable
Direct Known Subclasses:
VlaSubband, WidarSubband

public abstract class CorrelatorSubbandAbs
extends Object
implements CorrelatorSubband

A partial implementation of a CorrelatorSubband.

Version Info:

$Revision: 2289 $
$Date: 2009-05-07 16:13:41 -0600 (Thu, 07 May 2009) $
$Author: dharland $ (last person to modify)

Since:
2008-03-11
Author:
David M. Harland

Field Summary
protected  FrequencyRange freqRange
           
protected  String name
           
protected  List<CorrelationProductGroupAbs> productGroups
           
protected  int requantizationBits
           
 
Fields inherited from interface edu.nrao.sss.util.Identifiable
UNIDENTIFIED
 
Constructor Summary
protected CorrelatorSubbandAbs()
          Helps create a new correlator subband.
 
Method Summary
 CorrelationProductGroupAbs addNewCorrelationProductGroup()
          Creates a new correlation product group, adds it to this subband, and returns it.
 void clearId()
          Resets this instance's ID, and the IDs of all its components, to a value that represents the unidentified state.
 CorrelatorSubbandAbs clone()
          Returns a copy of this subband.
protected  void createdProdGrpsFromPersistentStore()
          Called after product groups were created from a persistent store, such as a database or XMl file.
 boolean equals(Object o)
          Returns true if o is equal to this subband.
 Frequency getAllowableBandwidthClosestTo(Frequency frequency)
          Returns the allowable frequency that is closest to the parameter.
 Frequency getAllowableBandwidthFor(Frequency frequency)
          Returns the smallest allowable bandwidth that is greater than desiredWidth.
 Frequency getBandwidth()
          Returns this object's bandwidth.
 CorrelatorBaseband getBaseband()
          Returns the baseband to which this subband belongs.
 Frequency getCentralFrequency()
          Returns the central frequency of this subband.
protected  CorrelatorBasebandAbs getContainer()
          Primarily for use by persistence mechanism.
 List<CorrelationProductGroup> getCorrelationProductGroups()
          Returns this subband's collection of correlation product groups.
 FrequencyRange getFrequencyRange()
          Returns the frequency range covered by this subband.
 Long getId()
           
 Frequency getMaximumCentralFrequency()
          Returns the largest allowable central frequency for this subband.
 Frequency getMinimumCentralFrequency()
          Returns the smallest allowable central frequency for this subband.
 String getName()
          Returns the name of this subband.
 FrequencyRange getProxiedRange()
          Returns the portion of frequency space for which this subband is a proxy.
 int getRequantization()
          Returns the number of bits to which the data in this subband will be requantized.
 int hashCode()
          Returns a hash code value for this subband.
protected abstract  CorrelationProductGroupAbs makeCorrelationProductGroup()
          Creates and returns a new product group that could be used with this subband.
 void removeCorrelationProductGroup(CorrelationProductGroup unwantedGroup)
          Removes a correlation product group from this subband.
 void setBandwidth(Frequency newWidth)
          Sets the bandwidth of this subband.
 void setCentralFrequency(Frequency newCenter)
          Sets the central frequency of this subband.
 void setCentralProxiedFrequency(Frequency newSkyCenter)
          Modifies this subband so that its new center is a proxy for newSkyCenter.
protected  void setContainer(CorrelatorBasebandAbs newContainer)
          Primarily for use by persistence mechanism.
 void setName(String newName)
          Sets the (optional) name of this subband.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.nrao.sss.model.resource.CorrelatorSubband
getAllowableRequantizations, setRequantization
 
Methods inherited from interface edu.nrao.sss.model.resource.HasBandwidth
getAllowableBandwidths, getMaximumBandwidth, getMinimumBandwidth, hasDiscreteBandwidths
 

Field Detail

name

protected String name

freqRange

protected FrequencyRange freqRange

requantizationBits

protected int requantizationBits

productGroups

protected List<CorrelationProductGroupAbs> productGroups
Constructor Detail

CorrelatorSubbandAbs

protected CorrelatorSubbandAbs()
Helps create a new correlator subband.

Method Detail

getId

public Long getId()
Specified by:
getId in interface Identifiable

clearId

public void clearId()
Description copied from interface: CorrelatorSubband
Resets this instance's ID, and the IDs of all its components, to a value that represents the unidentified state.

This method is useful for preparing an instance for storage in a database. The ID property (as of now, though this may change in the future) is used by our persistence mechanism to identify objects. If you are persisting this instance for the first time, you may need to call this method before performing a save. This is especially true if you have created this instance from XML, as the XML unmarshalling brings along the ID property.

Specified by:
clearId in interface CorrelatorSubband

setName

public void setName(String newName)
Description copied from interface: CorrelatorSubband
Sets the (optional) name of this subband. The default state is to have no name.

Specified by:
setName in interface CorrelatorSubband
Parameters:
newName - the new name for this subband. A value of null may be used to make this an unnamed subband, which is its default state.

getName

public String getName()
Description copied from interface: CorrelatorSubband
Returns the name of this subband. If this subband has no name, the empty string ("") is returned.

Specified by:
getName in interface CorrelatorSubband
Returns:
the name of this subband or the empty string if it has no name.

getAllowableBandwidthFor

public Frequency getAllowableBandwidthFor(Frequency frequency)
Description copied from interface: HasBandwidth
Returns the smallest allowable bandwidth that is greater than desiredWidth. If no allowable bandwidth is greater than desiredWidth, the maximum allowable bandwidth is returned.

Specified by:
getAllowableBandwidthFor in interface HasBandwidth
Parameters:
frequency - a desired bandwidth for which an allowable bandwidth is sought.
Returns:
the smallest allowable bandwidth that is greater than desiredWidth.

getAllowableBandwidthClosestTo

public Frequency getAllowableBandwidthClosestTo(Frequency frequency)
Description copied from interface: HasBandwidth
Returns the allowable frequency that is closest to the parameter.

Specified by:
getAllowableBandwidthClosestTo in interface HasBandwidth
Parameters:
frequency - a bandwidth for which the closest allowable bandwidth is desired. If this value is below the minimum, the minimum allowable value is returned. If it is above the maximum, the maximum is returned. If this value is null, the minimum value is returned.
Returns:
the allowable bandwidth of this baseband that is closest to desiredWidth.

setBandwidth

public void setBandwidth(Frequency newWidth)
Description copied from interface: CorrelatorSubband
Sets the bandwidth of this subband.

An attempt to set the bandwidth to a value lower than this subband's minimum will result in a bandwidth equal to the lowest allowable, and likewise for exceeding this subband's maximum.

If this subband has a discrete set of allowable bandwidths, then this method will set the bandwidth to that which is closest to newWidth. If the newWidth is not an allowable bandwidth and is equally distant from two allowable values, this subband's bandwidth will be set to the smaller of those values.

When changing the bandwidth, this method will attempt to leave this subband's center where it is. However, if doing so would result in a frequency range whose low value is less than zero, the center will be reset to be half of the bandwidth.

Specified by:
setBandwidth in interface CorrelatorSubband
Parameters:
newWidth - the new bandwidth of this subband.

getBandwidth

public Frequency getBandwidth()
Description copied from interface: HasBandwidth
Returns this object's bandwidth.

Specified by:
getBandwidth in interface HasBandwidth
Returns:
this object's bandwidth.

setCentralFrequency

public void setCentralFrequency(Frequency newCenter)
Description copied from interface: CorrelatorSubband
Sets the central frequency of this subband.

When moving the center, this method will always leave the bandwidth unchanged. If an attempt is made to move the center in such a way that the low end of this subband's range would be negative, the center will be moved to the lowest value that would not force this subband to contain negative frequencies. This value is equal to one half the bandwidth. Likewise, if this subband belongs to a baseband, this method will not move the center frequency such that any part of this subband extends beyond the high end of its baseband.

Specified by:
setCentralFrequency in interface CorrelatorSubband
Parameters:
newCenter - the central frequency of this subband.

getCentralFrequency

public Frequency getCentralFrequency()
Description copied from interface: CorrelatorSubband
Returns the central frequency of this subband.

Specified by:
getCentralFrequency in interface CorrelatorSubband
Returns:
the central frequency of this subband.

getMinimumCentralFrequency

public Frequency getMinimumCentralFrequency()
Description copied from interface: CorrelatorSubband
Returns the smallest allowable central frequency for this subband. The returned value will be equal to half of this subband's bandwidth.

Specified by:
getMinimumCentralFrequency in interface CorrelatorSubband
Returns:
the smallest allowable central frequency for this subband.

getMaximumCentralFrequency

public Frequency getMaximumCentralFrequency()
Description copied from interface: CorrelatorSubband
Returns the largest allowable central frequency for this subband. If this subband belongs to no baseband, the returned value is infinite. Otherwise it is equal to the bandwidth of the baseband less one half the bandwidth of this subband.

Specified by:
getMaximumCentralFrequency in interface CorrelatorSubband
Returns:
the largest allowable central frequency for this subband.

getFrequencyRange

public FrequencyRange getFrequencyRange()
Description copied from interface: CorrelatorSubband
Returns the frequency range covered by this subband.

Specified by:
getFrequencyRange in interface CorrelatorSubband
Returns:
the frequency range covered by this subband.

getProxiedRange

public FrequencyRange getProxiedRange()
Description copied from interface: CorrelatorSubband
Returns the portion of frequency space for which this subband is a proxy. If this subband belongs to no baseband, then the range returned is the same as the range returned by CorrelatorSubband.getFrequencyRange(). If, on the other hand, this subband belongs to a baseband, the range returned will follow this example:
   Let the baseband go from 0.0GHz to 2.0GHz.
   Let the above range represent sky frequencies from 41.5GHz to 43.5GHz.
   If this subband has a range from 0.4GHz to 1.1GHz, the range returned
   by this method will be 41.9GHz to 42.6GHz.
 

Specified by:
getProxiedRange in interface CorrelatorSubband
Returns:
the portion of frequency space for which this subband is a proxy.

setCentralProxiedFrequency

public void setCentralProxiedFrequency(Frequency newSkyCenter)
Description copied from interface: CorrelatorSubband
Modifies this subband so that its new center is a proxy for newSkyCenter. This subband may need to move its center in such a way that it no longer proxies newSkyCenter. This would be true if the calculated center frequency is outside of the bounds of this subband's baseband, or if there are certain restrictions for the placement of a subband within it baseband. Concrete implementations are expected to get the actual center as close as possible to the value that represents newSkyCenter.

Specified by:
setCentralProxiedFrequency in interface CorrelatorSubband
Parameters:
newSkyCenter - the new center sky, or proxied, frequency for this subband.

getRequantization

public int getRequantization()
Description copied from interface: CorrelatorSubband
Returns the number of bits to which the data in this subband will be requantized.

Specified by:
getRequantization in interface CorrelatorSubband
Returns:
the number of bits to which the data in this subband will be requantized.
See Also:
CorrelatorBaseband.getInitialQuantization()

makeCorrelationProductGroup

protected abstract CorrelationProductGroupAbs makeCorrelationProductGroup()
Creates and returns a new product group that could be used with this subband.


getCorrelationProductGroups

public List<CorrelationProductGroup> getCorrelationProductGroups()
Returns this subband's collection of correlation product groups.

The returned collection is guaranteed to be non-null, but it may be empty. The returned collection is a copy of the one held internally, so changes to the structure of the collection by clients will not impact this object. The members of the collection, however, are those referenced by this subband, so changes to them will be reflected herein.

Specified by:
getCorrelationProductGroups in interface CorrelatorSubband
Returns:
this subband's collection of correlation product groups.

addNewCorrelationProductGroup

public CorrelationProductGroupAbs addNewCorrelationProductGroup()
Creates a new correlation product group, adds it to this subband, and returns it.

Specified by:
addNewCorrelationProductGroup in interface CorrelatorSubband
Returns:
a new correlation product group of this subband.

removeCorrelationProductGroup

public void removeCorrelationProductGroup(CorrelationProductGroup unwantedGroup)
Removes a correlation product group from this subband.

Specified by:
removeCorrelationProductGroup in interface CorrelatorSubband
Parameters:
unwantedGroup - a correlation product group to be removed from this subband.

createdProdGrpsFromPersistentStore

protected void createdProdGrpsFromPersistentStore()
Called after product groups were created from a persistent store, such as a database or XMl file.


getBaseband

public CorrelatorBaseband getBaseband()
Description copied from interface: CorrelatorSubband
Returns the baseband to which this subband belongs.

Some implementations may allow for the creation of subbands apart from any baseband, with the idea that this subband would eventually be added to a baseband. Prior to being added to a baseband the return value from this method would be null.

Specified by:
getBaseband in interface CorrelatorSubband
Returns:
the baseband to which this subband belongs, or null if it belongs to no baseband.

setContainer

protected void setContainer(CorrelatorBasebandAbs newContainer)
Primarily for use by persistence mechanism.


getContainer

protected CorrelatorBasebandAbs getContainer()
Primarily for use by persistence mechanism.


clone

public CorrelatorSubbandAbs clone()
Returns a copy of this subband.

The returned subband is nearly, but not quite, a deep copy of this subband. Properties that are not copied:

  1. id - this is left in the UNDEFINED state.
  2. baseband - this value will be null.

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

Most, but not all, public attributes take place in the comparison Those that do not are:

  1. The ID.
  2. The containing baseband.

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.