Class LayerTypeParameter

  • All Implemented Interfaces:
    ExtraParameter

    public class LayerTypeParameter
    extends uk.ac.starlink.task.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

      Constructors 
      Constructor Description
      LayerTypeParameter​(java.lang.String prefix, java.lang.String suffix, PlotContext<?,​?> context)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static uk.ac.starlink.task.Parameter<?>[] getCoordParams​(Coord[] coords, java.lang.String suffix, boolean fullDetail)
      Gets parameters used for specifying coordinate values for a plot.
      java.lang.String getExtraUsage​(TableEnvironment env)
      Returns an extended usage message.
      static uk.ac.starlink.task.Parameter<?>[] getInputParams​(java.lang.String suffix)
      Gets parameters used for specifying a table with input data for a plot.
      static uk.ac.starlink.task.Parameter<?>[] getLayerConfigParams​(ConfigKey<?>[] configKeys, java.lang.String suffix, boolean fullDetail)
      Gets parameters used for speciyfing ConfigKey-based values for a plot.
      static LayerType[] getLayerTypes​(Plotter<?>[] plotters)
      Returns the list of LayerTypes represented by a given list of Plotters.
      java.lang.String stringifyOption​(LayerType ltype)  
      static java.lang.String usageWord​(uk.ac.starlink.task.Parameter<?> param)
      Returns a "name=<usage>" string for a parameter.
      static java.util.List<java.lang.String> usageWords​(uk.ac.starlink.task.Parameter<?>[] params)
      List of name=usage strings for a given set of parameters.
      • Methods inherited from class uk.ac.starlink.task.ChoiceParameter

        getUsage, objectToString, setDefaultOption, setUsage, stringToObject
      • Methods inherited from class uk.ac.starlink.task.AbstractChoiceParameter

        addOption, addOption, choiceToString, clearOptions, getName, getOption, getOptionNames, getOptions, getOptionValueList, stringToChoice
      • 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​(java.lang.String prefix,
                                  java.lang.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 java.lang.String stringifyOption​(LayerType ltype)
        Overrides:
        stringifyOption in class uk.ac.starlink.task.AbstractChoiceParameter<LayerType,​LayerType>
      • getExtraUsage

        public java.lang.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 uk.ac.starlink.task.Parameter<?>[] getInputParams​(java.lang.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 uk.ac.starlink.task.Parameter<?>[] getCoordParams​(Coord[] coords,
                                                                        java.lang.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
      • getLayerConfigParams

        public static uk.ac.starlink.task.Parameter<?>[] getLayerConfigParams​(ConfigKey<?>[] configKeys,
                                                                              java.lang.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 java.util.List<java.lang.String> usageWords​(uk.ac.starlink.task.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 java.lang.String usageWord​(uk.ac.starlink.task.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