public abstract class CoordSpotter extends Object
Some implementations are also provided. They are not bulletproof (what they are trying to do is really an AI task) but will probably do the right thing often enough to be useful rather than annoying.
Modifier | Constructor and Description |
---|---|
protected |
CoordSpotter(int ntype)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static CoordSpotter |
createNamePrefixSpotter(String[] alphaPrefixes,
boolean isPrefix)
Returns a CoordSpotter instance that looks at info name prefixes
or suffixes.
|
static CoordSpotter |
createUcdSpotter(String root,
String[] tails,
boolean allowSuffix)
Returns a CoordSpotter instance that looks at UCDs.
|
static CoordSpotter |
createVectorSpotter(int leng)
Returns a CoordSpotter that looks for a single 1-dimensional array.
|
uk.ac.starlink.table.ValueInfo[] |
findCoordGroups(int npos,
uk.ac.starlink.table.ValueInfo[] infos)
Tries to find a number of, ideally matching, entries in a list
of ValueInfos that corresponds to a fixed number of coordinate tuples,
using this spotter's coordinate identification criteria.
|
static uk.ac.starlink.table.ValueInfo[] |
findCoordGroups(int npos,
uk.ac.starlink.table.ValueInfo[] infos,
CoordSpotter[] spotters)
Tries to find a number of, ideally matching, entries in a list
of ValueInfos that corresponds to a fixed number of coordinate tuples,
using this coordinate identification criteria from a number of
different spotter instances.
|
abstract int |
getCoordType(uk.ac.starlink.table.ValueInfo info)
Returns an index indicating which coordinate type known by this spotter,
if any, the given value info corresponds to.
|
int |
getTypeCount()
Returns the number of entries in the tuples found by this object.
|
protected CoordSpotter(int ntype)
ntype
- number of entries per tuplepublic int getTypeCount()
public abstract int getCoordType(uk.ac.starlink.table.ValueInfo info)
info
- metadata item to testntype
if info is recognised, -1 if notpublic uk.ac.starlink.table.ValueInfo[] findCoordGroups(int npos, uk.ac.starlink.table.ValueInfo[] infos)
npos
- number of tuples requiredinfos
- list of available metadata itemspublic static uk.ac.starlink.table.ValueInfo[] findCoordGroups(int npos, uk.ac.starlink.table.ValueInfo[] infos, CoordSpotter[] spotters)
npos
- number of tuples requiredinfos
- list of available metadata itemsspotters
- list of spotter implementations to trypublic static CoordSpotter createNamePrefixSpotter(String[] alphaPrefixes, boolean isPrefix)
alphaPrefixes
- list of case-insensitive alphabetic column name
prefixes/suffixes, one to identify
each element of a coordinate
group tupleisPrefix
- true to look for prefixes, false for suffixespublic static CoordSpotter createUcdSpotter(String root, String[] tails, boolean allowSuffix)
root
- UCD root (do not include trailing ".")tails
- list of strings to append to the root+"." to make
a UCD for each tuple element to be identifiedallowSuffix
- if false, UCD matching must be exact
(apart from case); if true, trailing text after
the matched part is allowedpublic static CoordSpotter createVectorSpotter(int leng)
leng
- declared length of a 1-d array;
if -1, only arrays of indeterminate length
will be identifiedCopyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.