Package uk.ac.starlink.ttools.filter
Class FixNamesFilter
- java.lang.Object
-
- uk.ac.starlink.ttools.filter.BasicFilter
-
- uk.ac.starlink.ttools.filter.FixNamesFilter
-
- All Implemented Interfaces:
ProcessingFilter
,ProcessingStep
public class FixNamesFilter extends BasicFilter implements ProcessingStep
Filter to normalise syntax of column and parameter names so they are legal java identifiers.- Since:
- 18 Dec 2009
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description FixNamesFilter()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessingStep
createStep(java.util.Iterator<java.lang.String> argIt)
Creates a new ProcessingStep based on a sequence of command-line arguments.java.lang.String
fixName(java.lang.String name)
Performs the name unmunging.java.lang.String[]
getDescriptionLines()
java.lang.String
uniqueName(java.lang.String name, java.util.Set<java.lang.String> lcNames)
Returns a name based on the supplied one, but which is guaranteed different (case-insensitively) from all the names in a supplied set.uk.ac.starlink.table.StarTable
wrap(uk.ac.starlink.table.StarTable base)
Performs a table filtering step.-
Methods inherited from class uk.ac.starlink.ttools.filter.BasicFilter
explainSyntax, getDescription, getName, getUsage
-
-
-
-
Method Detail
-
getDescriptionLines
public java.lang.String[] getDescriptionLines()
- Specified by:
getDescriptionLines
in classBasicFilter
-
createStep
public ProcessingStep createStep(java.util.Iterator<java.lang.String> argIt)
Description copied from interface:ProcessingFilter
Creates a new ProcessingStep based on a sequence of command-line arguments. The argIt argument is an iterator over the command-line arguments positioned just before any arguments intended for this filter. If legal, any that can be comprehended by this filter should be read (iterated over) and removed, and a ProcessingStep should accordingly be returned. In the case of a successful return, it is essential that no arguments other than the ones intended for this filter are read from the iterator.If the argument list is badly-formed as far as this filter is concerned, an
ArgException
should be thrown.- Specified by:
createStep
in interfaceProcessingFilter
- Parameters:
argIt
- iterator over command-line arguments positioned at the first one
-
wrap
public uk.ac.starlink.table.StarTable wrap(uk.ac.starlink.table.StarTable base)
Description copied from interface:ProcessingStep
Performs a table filtering step.- Specified by:
wrap
in interfaceProcessingStep
- Parameters:
base
- input table- Returns:
- output table
-
fixName
public java.lang.String fixName(java.lang.String name)
Performs the name unmunging.- Parameters:
name
- input name- Returns:
- string like name which is a valid java identifier
-
uniqueName
public java.lang.String uniqueName(java.lang.String name, java.util.Set<java.lang.String> lcNames)
Returns a name based on the supplied one, but which is guaranteed different (case-insensitively) from all the names in a supplied set. If the supplied name is already distinct from the members of the set, it will be returned unchanged.- Parameters:
name
- base namelcNames
- set of lower-case values from which the output must differ case-insensitively; not to be modified- Returns:
- distinct string based on name
-
-