Package uk.ac.starlink.ttools.task
Class StiltsCommand
java.lang.Object
uk.ac.starlink.ttools.task.StiltsCommand
- Direct Known Subclasses:
PlotStiltsCommand
Represents an abstract model of a STILTS command line.
A list of parameter-value pairs along with basic parameter
grouping information is represented.
There is no guarantee that the contents of this object
will correspond to a STILTS command that can actually be executed,
so care must be taken in assembling it.
Use a CommandFormatter
instance to export this object
into a useful external form, such as a shell command line.
- Since:
- 17 Sep 2024
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionStiltsCommand
(uk.ac.starlink.task.Task task, String taskName, SettingGroup[] groups) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic StiltsCommand
createCommand
(uk.ac.starlink.task.Task task, SettingGroup[] groups) Creates an instance of this class with an automatically determined task name.static Setting
createDefaultParamSetting
(uk.ac.starlink.task.Parameter<?> param) Creates a Setting corresponding to a given task parameter, set to its default value.createInputTableSettings
(AbstractInputTableParameter<?> inParam, uk.ac.starlink.table.StarTable table, TableNamer namer, FilterParameter filterParam, CredibleString selection) Returns settings associated with an InputTableParameter and table.static <T> Setting
createParamSetting
(uk.ac.starlink.task.Parameter<T> param, T tval) Creates a Setting corresponding to a given task parameter.static Setting
createProgressSetting
(FilterParameter filterParam) Returns a setting that corresponds to adding a progress filter to a filter parameter.Returns an array of objects that together contain all the parameter settings required to specify this task to stilts.static <T> uk.ac.starlink.task.Parameter
<T> getParameterByType
(uk.ac.starlink.task.Task task, Class<T> ptype) Returns unique parameter of given type.uk.ac.starlink.task.Task
getTask()
Returns the task corresponding to this object.Returns the name of this object's task, as used by the stilts command line.static List
<SettingGroup> Groups a list of settings into zero or more SettingGroups.toString()
-
Constructor Details
-
StiltsCommand
Constructor.- Parameters:
task
- tasktaskName
- name of the task as used by stilts command linegroups
- all name-value pairs specifying the configuration of the task, grouped for cosmetic purposes
-
-
Method Details
-
getTask
public uk.ac.starlink.task.Task getTask()Returns the task corresponding to this object.- Returns:
- task object
-
getTaskName
Returns the name of this object's task, as used by the stilts command line.- Returns:
- task name
-
getGroups
Returns an array of objects that together contain all the parameter settings required to specify this task to stilts. They are grouped for cosmetic purposes.- Returns:
- settings
-
toString
-
createCommand
Creates an instance of this class with an automatically determined task name.- Parameters:
task
- taskgroups
- all name-value pairs specifying the configuration of the task, grouped for cosmetic purposes
-
createInputTableSettings
public static List<Setting> createInputTableSettings(AbstractInputTableParameter<?> inParam, uk.ac.starlink.table.StarTable table, TableNamer namer, FilterParameter filterParam, CredibleString selection) Returns settings associated with an InputTableParameter and table.- Parameters:
inParam
- input table parametertable
- table associated with this parameternamer
- table namer capable of naming the supplied tableselection
- row selection expression, or null- Returns:
- list of settings associated with table input
-
createParamSetting
Creates a Setting corresponding to a given task parameter.- Parameters:
param
- task parametertval
- typed value for parameter- Returns:
- setting object
-
createDefaultParamSetting
Creates a Setting corresponding to a given task parameter, set to its default value.- Parameters:
param
- task parameter- Returns:
- setting object
-
createProgressSetting
Returns a setting that corresponds to adding a progress filter to a filter parameter.- Parameters:
filterParam
- filter parameter- Returns:
- setting that adds this parameter-less filter
-
getParameterByType
public static <T> uk.ac.starlink.task.Parameter<T> getParameterByType(uk.ac.starlink.task.Task task, Class<T> ptype) Returns unique parameter of given type. -
toGroups
Groups a list of settings into zero or more SettingGroups. A group is created for each non-empty run of Settings in the input list that does not contain a null value; nulls are effectively recognised as group terminators.- Parameters:
level
- level for all returned groupssettings
- input list of settings- Returns:
- list of groups containing all the input settings
-