uk.ac.starlink.ttools.plot2.task
Class LayerTypeParameter

java.lang.Object
  extended by uk.ac.starlink.task.Parameter<T>
      extended by uk.ac.starlink.task.ChoiceParameter<LayerType>
          extended by uk.ac.starlink.ttools.plot2.task.LayerTypeParameter
All Implemented Interfaces:
ExtraParameter

public class LayerTypeParameter
extends ChoiceParameter<LayerType>
implements ExtraParameter

Parameter that specifies a LayerType to be used for a plot layer. LayerTypes in some cases correspond to Plotters, and in some cases to families of Plotters.

Most of the complication here is generating the auto-documentation. It's not 100% obvious that code belongs here, but I can't think of a better place to put it.

Since:
3 Sep 2014
Author:
Mark Taylor

Field Summary
 
Fields inherited from class uk.ac.starlink.task.Parameter
BY_NAME
 
Constructor Summary
LayerTypeParameter(String prefix, String suffix, PlotContext context)
          Constructor.
 
Method Summary
static Parameter[] getConfigParams(ConfigKey[] configKeys, String suffix, boolean fullDetail)
          Gets parameters used for speciyfing ConfigKey-based values for a plot.
static Parameter[] getCoordParams(Coord[] coords, String suffix, boolean fullDetail)
          Gets parameters used for specifying coordinate values for a plot.
 String getExtraUsage(TableEnvironment env)
          Returns an extended usage message.
static Parameter[] getInputParams(String suffix)
          Gets parameters used for specifying a table with input data for a plot.
static LayerType[] getLayerTypes(Plotter[] plotters)
          Returns the list of LayerTypes represented by a given list of Plotters.
 String stringifyOption(LayerType ltype)
          Determines how an option will be represented as a string value of this parameter if no name has explicitly been supplied.
static String usageWord(Parameter param)
          Returns a "name=<usage>" string for a parameter.
static List<String> usageWords(Parameter[] params)
          List of name=usage strings for a given set of parameters.
 
Methods inherited from class uk.ac.starlink.task.ChoiceParameter
addOption, addOption, clearOptions, getName, getOption, getOptionNames, getOptions, getOptionValueList, getUsage, objectToString, setDefaultOption, setUsage, stringToObject
 
Methods inherited from class uk.ac.starlink.task.Parameter
clearValue, getDescription, getName, getPosition, getPreferExplicit, getPrompt, getStringDefault, getValueClass, isNullPermitted, objectValue, setDescription, setDescription, setName, setNullPermitted, setPosition, setPreferExplicit, setPrompt, setStringDefault, setValue, setValueFromObject, setValueFromString, stringValue, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayerTypeParameter

public LayerTypeParameter(String prefix,
                          String suffix,
                          PlotContext context)
Constructor.

Parameters:
prefix - non-suffix part of this parameter's name
suffix - layer-specific part of this parameter's name
context - plot context
Method Detail

stringifyOption

public String stringifyOption(LayerType ltype)
Description copied from class: ChoiceParameter
Determines how an option will be represented as a string value of this parameter if no name has explicitly been supplied. The default implementation is String.valueOf(option), but this may be overrridden.

Overrides:
stringifyOption in class ChoiceParameter<LayerType>
Parameters:
ltype - option value
Returns:
string representation of option

getExtraUsage

public String getExtraUsage(TableEnvironment env)
Description copied from interface: ExtraParameter
Returns an extended usage message. This should not repeat the content of the normal usage message. It should be preformatted, that is it should contain newlines to keep the line length down to less than 80 characters.

Specified by:
getExtraUsage in interface ExtraParameter
Parameters:
env - execution envrionment
Returns:
extended usage message

getInputParams

public static Parameter[] getInputParams(String suffix)
Gets parameters used for specifying a table with input data for a plot.

Parameters:
suffix - layer suffix
Returns:
input table parameters

getCoordParams

public static Parameter[] getCoordParams(Coord[] coords,
                                         String suffix,
                                         boolean fullDetail)
Gets parameters used for specifying coordinate values for a plot.

Parameters:
coords - coordinates required
suffix - layer suffix
fullDetail - if true, extra detail is appended to the parameter descriptions
Returns:
coord parameters

getConfigParams

public static Parameter[] getConfigParams(ConfigKey[] configKeys,
                                          String suffix,
                                          boolean fullDetail)
Gets parameters used for speciyfing ConfigKey-based values for a plot.

Parameters:
configKeys - configuration keys
suffix - layer suffix
fullDetail - if true, extra detail is appended to the parameter descriptions
Returns:
config parameters

usageWords

public static List<String> usageWords(Parameter[] params)
List of name=usage strings for a given set of parameters.

Parameters:
params - parameter list
Returns:
list of name=usage strings, one for each param

usageWord

public static String usageWord(Parameter param)
Returns a "name=<usage>" string for a parameter.

Parameters:
param - parameter
Returns:
usage string

getLayerTypes

public static LayerType[] getLayerTypes(Plotter[] plotters)
Returns the list of LayerTypes represented by a given list of Plotters.

Parameters:
plotters - plotter list
Returns:
layer type list


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.