edu.nrao.sss.model.resource
Class SimpleReceiverSelector

java.lang.Object
  extended by edu.nrao.sss.model.resource.SimpleReceiverSelector
All Implemented Interfaces:
ReceiverSelector

public class SimpleReceiverSelector
extends Object

A very simple receiver selector.

This selector merely looks for overlaps between the frequency range of the specifications and the frequency ranges of the available receivers.

Version Info:

$Revision: 2294 $
$Date: 2009-05-11 15:11:56 -0600 (Mon, 11 May 2009) $
$Author: dharland $

Since:
2006-09-13
Author:
David M. Harland

Constructor Summary
SimpleReceiverSelector()
          Creates a new instance.
SimpleReceiverSelector(ReceiverProvider provider)
          Creates a new instance that uses provider as a source of receivers.
 
Method Summary
 ReceiverBand selectBestReceiverFor(FrequencyRange targetRange)
          Returns the best receiver to use for the given range of sky frequencies.
 List<ReceiverSelection> selectReceivers(FrequencyRange targetRange)
          Selects best combination of receivers to cover given frequency range.
 List<ReceiverSelection> selectReceivers(FrequencySpectrum targetSpectrum)
          Selects best combination of receivers to cover given frequency spectrum.
 List<ReceiverSelection> selectReceivers(ObservingMode mode, ResourceSpecification specs)
          Returns a list of one or more selections that satisfy the given portion of the given specs.
 List<ReceiverSelection> selectReceivers(PulsarSpecification specs)
          Returns a list of one or more selections that satisfy the given specs.
 List<ReceiverSelection> selectReceivers(ResourceSpecification specs)
          Returns a list of one or more selections that satisfy the given specs.
 List<ReceiverSelection> selectReceivers(SkyFrequencySpecification specs)
          Returns a list of one or more selections that satisfy the given specs.
 List<ReceiverSelection> selectReceivers(SpectralLineSpecification specs)
          Returns a list of one or more selections that satisfy the given specs.
 void setProvider(ReceiverProvider provider)
          Sets the universe of receivers from which selections will be made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleReceiverSelector

public SimpleReceiverSelector(ReceiverProvider provider)
Creates a new instance that uses provider as a source of receivers.

Parameters:
provider - the receiver container for this selector.

SimpleReceiverSelector

public SimpleReceiverSelector()
Creates a new instance.

Method Detail

selectReceivers

public List<ReceiverSelection> selectReceivers(FrequencyRange targetRange)
Selects best combination of receivers to cover given frequency range.

Parameters:
targetRange - the frequency range for which receiver coverage is desired.
Returns:
the best combination of receivers to cover given frequency range.

selectBestReceiverFor

public ReceiverBand selectBestReceiverFor(FrequencyRange targetRange)
Description copied from interface: ReceiverSelector
Returns the best receiver to use for the given range of sky frequencies.

This method returns a single receiver, even if multiple receivers cover the target range. If one receiver covers more of the target range than the others, it is the receiver returned. If multiple receivers cover the range equally well, the receiver returned is up to the implementing class. If no receiver overlaps the target range, the receiver that has the smallest distance between itself and the target range is returned. Note that this means the returned receiver may not be useful for the target it range at all, but is merely the best of the not-so-useful receivers.

This method may return null if any one or more of the following is true:

  1. This selector's receiver provider is null.
  2. This receiver provider of this selector has a null list of receivers.
  3. This receiver provider of this selector has an empty list of receivers.

Parameters:
targetRange - a sky frequency range for which the best receiver is sought.
Returns:
the best receiver to use for the given range of sky frequencies.

selectReceivers

public List<ReceiverSelection> selectReceivers(FrequencySpectrum targetSpectrum)
Selects best combination of receivers to cover given frequency spectrum.

Parameters:
targetSpectrum - the frequency spectrum for which receiver coverage is desired.
Returns:
the best combination of receivers to cover given frequency spectrum.

setProvider

public void setProvider(ReceiverProvider provider)
Description copied from interface: ReceiverSelector
Sets the universe of receivers from which selections will be made.

Specified by:
setProvider in interface ReceiverSelector
Parameters:
provider - a provider of receivers.

selectReceivers

public List<ReceiverSelection> selectReceivers(ResourceSpecification specs)
Description copied from interface: ReceiverSelector
Returns a list of one or more selections that satisfy the given specs. The first selection in the list will be the best match, the second selection the next best match, and so on. If a perfect match was found, the returned list will contain only that selection. If no receiver was even a partial match, the returned list will contain a single receiver that was nearest the frequencies needed by the specs.

Specified by:
selectReceivers in interface ReceiverSelector
Parameters:
specs - a resource specification, expressed in terms of science, as opposed to instrumentation.
Returns:
a list of one or more selections based on the specifications.

selectReceivers

public List<ReceiverSelection> selectReceivers(ObservingMode mode,
                                               ResourceSpecification specs)
Description copied from interface: ReceiverSelector
Returns a list of one or more selections that satisfy the given portion of the given specs. The first selection in the list will be the best match, the second selection the next best match, and so on. If a perfect match was found, the returned list will contain only that selection. If no receiver was even a partial match, the returned list will contain a single receiver that was nearest the frequencies needed by the specs.

The mode parameter is used to ignore the portions of specs that are of different modes. For example, calling mySelector.selectReceivers(ObservingMode.SPECTRAL_LINE, mySpecs) will cause this selector to consider only the spectral line specifications. Note that this is a little different than calling mySelector.selectReceivers(mySpecs.getSpectralLineSpecs().get(i)) because all the spectral line specifications in specs will be considered by this method.

Specified by:
selectReceivers in interface ReceiverSelector
Parameters:
mode - the portion of specs to which this method will limit its attention.
specs - a resource specification, expressed in terms of science, as opposed to instrumentation.
Returns:
a list of one or more selections based on the specifications.

selectReceivers

public List<ReceiverSelection> selectReceivers(SkyFrequencySpecification specs)
Description copied from interface: ReceiverSelector
Returns a list of one or more selections that satisfy the given specs. The first selection in the list will be the best match, the second selection the next best match, and so on. If a perfect match was found, the returned list will contain only that selection. If no receiver was even a partial match, the returned list will contain a single receiver that was nearest the frequencies needed by the specs.

Specified by:
selectReceivers in interface ReceiverSelector
Parameters:
specs - a resource specification, expressed in terms of science, as opposed to instrumentation.
Returns:
a list of one or more selections based on the specifications.

selectReceivers

public List<ReceiverSelection> selectReceivers(SpectralLineSpecification specs)
Description copied from interface: ReceiverSelector
Returns a list of one or more selections that satisfy the given specs. The first selection in the list will be the best match, the second selection the next best match, and so on. If a perfect match was found, the returned list will contain only that selection. If no receiver was even a partial match, the returned list will contain a single receiver that was nearest the frequencies needed by the specs.

Specified by:
selectReceivers in interface ReceiverSelector
Parameters:
specs - a resource specification, expressed in terms of science, as opposed to instrumentation.
Returns:
a list of one or more selections based on the specifications.

selectReceivers

public List<ReceiverSelection> selectReceivers(PulsarSpecification specs)
Description copied from interface: ReceiverSelector
Returns a list of one or more selections that satisfy the given specs. The first selection in the list will be the best match, the second selection the next best match, and so on. If a perfect match was found, the returned list will contain only that selection. If no receiver was even a partial match, the returned list will contain a single receiver that was nearest the frequencies needed by the specs.

Specified by:
selectReceivers in interface ReceiverSelector
Parameters:
specs - a resource specification, expressed in terms of science, as opposed to instrumentation.
Returns:
a list of one or more selections based on the specifications.


Copyright © 2009. All Rights Reserved.