# Class ConeMatcher

java.lang.Object
uk.ac.starlink.ttools.cone.ConeMatcher

public class ConeMatcher extends Object
TableProducer which does the work for a multiple cone search-type sky crossmatch operation.

Since:
  31 Aug 2007
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`ConeMatcher.ConeWorker`
Object which produces the result table.

## Constructor Summary

Constructors
Constructor
Description
`ConeMatcher(ConeSearcher coneSearcher, ConeErrorPolicy errAct, TableProducer inProd, QuerySequenceFactory qsFact, boolean bestOnly)`
Convenience constructor which selects default values for most options.
`ConeMatcher(ConeSearcher coneSearcher, ConeErrorPolicy errAct, TableProducer inProd, QuerySequenceFactory qsFact, boolean bestOnly, Coverage coverage, boolean includeBlanks, boolean distFilter, int parallelism, String copyColIdList, String distanceCol, uk.ac.starlink.table.JoinFixAction inFixAct, uk.ac.starlink.table.JoinFixAction coneFixAct)`
Full-functioned constructor.

## Method Summary

Modifier and Type
Method
Description
`ConeMatcher.ConeWorker`
`createConeWorker()`
Returns an object which can compute the multi-cone result.
`static uk.ac.starlink.table.StarTable`
`getConeResult(ConeSearcher coneSearcher, ConeErrorPolicy errAct, boolean bestOnly, boolean distFilter, String distanceCol, double ra0, double dec0, double sr)`
Performs a cone search and returns the resulting table with appropriate filtering operations applied.
`void`
`setStreamOutput(boolean streamOutput)`
Determines whether this object's `createConeWorker()` method will produce a one-read-only table or not.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ConeMatcher

public ConeMatcher(ConeSearcher coneSearcher, ConeErrorPolicy errAct, TableProducer inProd, QuerySequenceFactory qsFact, boolean bestOnly)
Convenience constructor which selects default values for most options.

Parameters:
  `coneSearcher` - cone search implementation
  `errAct` - defines action on cone search invocation error
  `inProd` - source of input table (containing each crossmatch specification)
  `qsFact` - object which can produce a ConeQueryRowSequence
  `bestOnly` - true iff only the best match for each input table row is required, false for all matches within radius

### ConeMatcher

public ConeMatcher(ConeSearcher coneSearcher, ConeErrorPolicy errAct, TableProducer inProd, QuerySequenceFactory qsFact, boolean bestOnly, Coverage coverage, boolean includeBlanks, boolean distFilter, int parallelism, String copyColIdList, String distanceCol, uk.ac.starlink.table.JoinFixAction inFixAct, uk.ac.starlink.table.JoinFixAction coneFixAct)
Full-functioned constructor.

Parameters:
  `coneSearcher` - cone search implementation
  `errAct` - defines action on cone search invocation error
  `inProd` - source of input table (containing each crossmatch specification)
  `qsFact` - object which can produce a ConeQueryRowSequence
  `bestOnly` - true iff only the best match for each input table row is required, false for all matches within radius
  `coverage` - coverage for cone searcher, or null
  `includeBlanks` - true iff a row is to be output for input rows for which the cone search has no matches
  `distFilter` - true to perform post-query filtering on results based on the distance between the query position and the result row position
  `parallelism` - number of threads to concurrently execute matches - only >1 if coneSearcher is thread-safe
  `copyColIdList` - space-separated list of column identifiers for columns to be copied to the output table, "*" for all columns
  `distanceCol` - name of column to hold position separation values, or null for no separation column
  `inFixAct` - column name deduplication action for input table
  `coneFixAct` - column name deduplication action for result of cone searches

## Method Details

### setStreamOutput

public void setStreamOutput(boolean streamOutput)
Determines whether this object's `createConeWorker()` method will produce a one-read-only table or not. If set true, then the output table is good for only a single read (`getRowSequence` may be called only once). The default is false.

Parameters:
  `streamOutput` - whether output is streamed

### createConeWorker

public ConeMatcher.ConeWorker createConeWorker() throws IOException, uk.ac.starlink.task.TaskException
Returns an object which can compute the multi-cone result. The result is a join between the input table and the table on which the cone searches are defined. See the `ConeWorker` documentation for how to use the returned object.

Note

: if the `streamOut` attribute of this ConeMatcher has been set the table produced by the returned worker will be one-read-only, designed for streaming.

Returns:
  cone worker which can produce the result table
Throws:
  `IOException`
  `uk.ac.starlink.task.TaskException`

### getConeResult

public static uk.ac.starlink.table.StarTable getConeResult(ConeSearcher coneSearcher, ConeErrorPolicy errAct, boolean bestOnly, boolean distFilter, String distanceCol, double ra0, double dec0, double sr) throws IOException
Performs a cone search and returns the resulting table with appropriate filtering operations applied. The resulting table may contain fewer rows than the output of the actual query; if `bestOnly` is true, only the best match will be included, and if `distFilter` is true, then only those rows whose sky position falls strictly within the specified search radius will be included.

If a non-null `distanceCol` parameter is supplied, the final column in the table will contain the angle in degrees between the region centre and the position described in the row.

If no records in the cone are found, the return value may either be null or (preferably) an empty table with the correct columns.

Parameters:
  `coneSearcher` - cone search implementation
  `errAct` - defines action on cone search invocation error
  `bestOnly` - true iff only the best match for each input table row is required, false for all matches within radius
  `distFilter` - true to perform post-query filtering on results based on the distance between the query position and the result row position
  `distanceCol` - name of column to hold distance information int output table, or null
  `ra0` - right ascension in degrees of region centre
  `dec0` - declination in degrees of region centre
  `sr` - search radius in degrees
Returns:
  filtered result table, or null
Throws:
  `IOException`