edu.nrao.sss.model.resource
Class CorrelatorBasebandAbs

java.lang.Object
  extended by edu.nrao.sss.model.resource.CorrelatorBasebandAbs
All Implemented Interfaces:
CorrelatorBaseband, HasBandwidth, Identifiable, Cloneable
Direct Known Subclasses:
VlaBasebandPair, WidarBaseband

public abstract class CorrelatorBasebandAbs
extends Object
implements CorrelatorBaseband

A partial implementation of a CorrelatorBaseband.

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-06
Author:
David M. Harland

Field Summary
protected  Frequency bandwidth
           
protected  List<CorrelatorSubbandAbs> subbands
           
 
Fields inherited from interface edu.nrao.sss.util.Identifiable
UNIDENTIFIED
 
Constructor Summary
protected CorrelatorBasebandAbs()
          Helps create a new correlator baseband.
 
Method Summary
protected  void addNewSubband(CorrelatorSubbandAbs newSubband)
          The CorrelatorBaseband.addSubband(CorrelatorSubband) method of classes that extend this one should call this method.
 void clearId()
          Resets this instance's ID, and the IDs of all its components, to a value that represents the unidentified state.
 CorrelatorBasebandAbs clone()
          Returns a copy of this baseband.
protected  void createdSubbandsFromPersistentStore()
          Called after subbands 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 baseband.
 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 a copy of the bandwidth of this baseband.
protected abstract  CorrelatorConfiguration getContainer()
          Returns the correlator configuration that holds this baseband.
 Long getId()
           
protected  FrequencyRange getProxiedRange(Signal signal)
          Returns the original frequency range represented by signal and the smaller of the signal's bandwidth and the bandwidth of this baseband.
 int getSubbandCount()
          Returns the number of subbands currently held by this baseband.
 List<CorrelatorSubband> getSubbands()
          Returns a list of this baseband's subbands.
 int hashCode()
          Returns a hash code value for this baseband.
 boolean isPair()
          Returns true if this is a paired baseband.
 int removeAllSubbands()
          Removes all subbands from this baseband.
protected  boolean removeOldSubband(CorrelatorSubbandAbs unwantedSubband)
           
 boolean removeSubband(CorrelatorSubband unwantedSubband)
          Removes the unwantedSubband from this baseband, if present.
 CorrelatorSubbandAbs removeSubbandAt(int index)
          Removes from this baseband the subband at the given index.
 void setBandwidth(Frequency newWidth)
          Sets the bandwidth of this baseband.
protected abstract  void setContainer(CorrelatorConfiguration newContainer)
          Sets the correlator configuration to which this baseband belongs.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.nrao.sss.model.resource.CorrelatorBaseband
addSubband, getInitialQuantization, getMaxSubbandCount, getName, getPolarization, getPolarizations, getProxiedRange, getSubbandGrid, isSinglet, makeNewSubband, proxiedRangeIsReversed
 
Methods inherited from interface edu.nrao.sss.model.resource.HasBandwidth
getAllowableBandwidths, getMaximumBandwidth, getMinimumBandwidth, hasDiscreteBandwidths
 

Field Detail

bandwidth

protected Frequency bandwidth

subbands

protected List<CorrelatorSubbandAbs> subbands
Constructor Detail

CorrelatorBasebandAbs

protected CorrelatorBasebandAbs()
Helps create a new correlator baseband.

Method Detail

getId

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

clearId

public void clearId()
Description copied from interface: CorrelatorBaseband
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 CorrelatorBaseband

isPair

public boolean isPair()
Description copied from interface: CorrelatorBaseband
Returns true if this is a paired baseband. If true, then the number of polarizations represented by this baseband should be two.

Either this method or CorrelatorBaseband.isSinglet(), but not both, should be true. Only single and paired basebands are anticipated.

Specified by:
isPair in interface CorrelatorBaseband
Returns:
true if this is a paired baseband.

getContainer

protected abstract CorrelatorConfiguration getContainer()
Returns the correlator configuration that holds this baseband. It is possible for the returned value to be null.


setContainer

protected abstract void setContainer(CorrelatorConfiguration newContainer)
Sets the correlator configuration to which this baseband belongs. The newContainer is allowed to be null.


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: CorrelatorBaseband
Sets the bandwidth of this baseband.

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

If this baseband has a discrete set of allowable bandwidths, then this method will set the bandwidth to the smallest allowable value that is greater than newWidth.

Specified by:
setBandwidth in interface CorrelatorBaseband
Parameters:
newWidth - the new bandwidth of this baseband.

getBandwidth

public Frequency getBandwidth()
Returns a copy of the bandwidth of this baseband.

Specified by:
getBandwidth in interface HasBandwidth
Returns:
a copy of the bandwidth of this baseband.

getProxiedRange

protected FrequencyRange getProxiedRange(Signal signal)
Returns the original frequency range represented by signal and the smaller of the signal's bandwidth and the bandwidth of this baseband.

Parameters:
signal - a signal that may have been manipulated in such a way that its frequency range is no longer the same as it had been when the signal was created.
Returns:
the original frequency range represented by signal.

getSubbandCount

public int getSubbandCount()
Description copied from interface: CorrelatorBaseband
Returns the number of subbands currently held by this baseband.

Specified by:
getSubbandCount in interface CorrelatorBaseband
Returns:
the number of subbands currently held by this baseband.

getSubbands

public List<CorrelatorSubband> getSubbands()
Description copied from interface: CorrelatorBaseband
Returns a list of this baseband's subbands.

Specified by:
getSubbands in interface CorrelatorBaseband
Returns:
a list of this baseband's subbands.

addNewSubband

protected void addNewSubband(CorrelatorSubbandAbs newSubband)
The CorrelatorBaseband.addSubband(CorrelatorSubband) method of classes that extend this one should call this method. This method will:
  1. Ensure that this baseband does not yet hold its maximum number of subbands. If it does, an IllegalArgumentException is thrown.
  2. Remove newSubband from its former baseband, if any.
  3. Inform newSubband that this is its new baseband.
  4. Add newSubband to this baseband's collection of subbands.
The main duty of an extending class is to ensure that the type of subband passed to it is of an acceptable type. For example, an XyzBaseband may want to accept only XyzSubband instances.

Parameters:
newSubband - a new subband for this baseband.

removeSubband

public boolean removeSubband(CorrelatorSubband unwantedSubband)
Description copied from interface: CorrelatorBaseband
Removes the unwantedSubband from this baseband, if present. The unwanted subband will belong to no baseband after its removal.

Specified by:
removeSubband in interface CorrelatorBaseband
Parameters:
unwantedSubband - the subband to be removed from this baseband.
Returns:
true if this baseband contained newSubband.

removeOldSubband

protected boolean removeOldSubband(CorrelatorSubbandAbs unwantedSubband)

removeSubbandAt

public CorrelatorSubbandAbs removeSubbandAt(int index)
Description copied from interface: CorrelatorBaseband
Removes from this baseband the subband at the given index. The subband currently at this index is returned. If there is no subband at that index, null is returned.

Specified by:
removeSubbandAt in interface CorrelatorBaseband
Parameters:
index - the index of the unwanted subband in this baseband's list of subbands.
Returns:
the unwanted subband, or null if there was no subband at index.

removeAllSubbands

public int removeAllSubbands()
Description copied from interface: CorrelatorBaseband
Removes all subbands from this baseband.

Specified by:
removeAllSubbands in interface CorrelatorBaseband
Returns:
the number of subbands removed.

createdSubbandsFromPersistentStore

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


toString

public String toString()
Overrides:
toString in class Object

clone

public CorrelatorBasebandAbs clone()
Returns a copy of this baseband.

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

Specified by:
clone in interface CorrelatorBaseband
Overrides:
clone in class Object
Returns:
a copy of this baseband.

equals

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

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

  1. The ID.

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.