uk.ac.starlink.ttools.cone
Class SequentialResultRowSequence

java.lang.Object
  extended by uk.ac.starlink.ttools.cone.SequentialResultRowSequence
All Implemented Interfaces:
RowSequence, ConeQueryRowSequence, ConeResultRowSequence

public class SequentialResultRowSequence
extends Object
implements ConeResultRowSequence

Straightforward implementation of ConeResultRowSequence based on a ConeQueryRowSequence.

Since:
16 Jan 2008
Author:
Mark Taylor

Constructor Summary
SequentialResultRowSequence(ConeQueryRowSequence querySeq, ConeSearcher coneSearcher, ConeErrorPolicy errAct, Coverage coverage, boolean bestOnly, boolean distFilter, String distanceCol)
          Constructor.
 
Method Summary
 void close()
          Indicates that this sequence will not be required any more.
 Object getCell(int icol)
          Returns the contents of a cell in the current row.
 StarTable getConeResult()
          Returns the result of the cone search for the current row of this sequence.
 double getDec()
          Get central declination for the current row's cone search request in degrees.
 long getIndex()
          Get the index in the underlying table to which the current row relates.
 double getRa()
          Get central right ascension for the current row's cone search request in degrees.
 double getRadius()
          Get search radius for the current row's cone search request in degrees.
 Object[] getRow()
          Returns the contents of the current table row, as an array with the same number of elements as there are columns in this table.
 boolean next()
          Attempts to advances the current row to the next one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequentialResultRowSequence

public SequentialResultRowSequence(ConeQueryRowSequence querySeq,
                                   ConeSearcher coneSearcher,
                                   ConeErrorPolicy errAct,
                                   Coverage coverage,
                                   boolean bestOnly,
                                   boolean distFilter,
                                   String distanceCol)
Constructor.

Parameters:
querySeq - sequence providing cone search query parameters
coneSearcher - cone search implementation
errAct - defines action on cone search invocation error
coverage - coverage for results, or null
bestOnly - whether all results or just best are required
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 in output table, or null
Method Detail

getConeResult

public StarTable getConeResult()
                        throws IOException
Description copied from interface: ConeResultRowSequence
Returns the result of the cone search for the current row of this sequence. The work will typically be done using ConeMatcher.getConeResult(uk.ac.starlink.ttools.cone.ConeSearcher, uk.ac.starlink.ttools.cone.ConeErrorPolicy, boolean, boolean, java.lang.String, double, double, double).

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

Specified by:
getConeResult in interface ConeResultRowSequence
Returns:
table giving rows strictly within the match criteria for the current row of this cone query sequence, or null
Throws:
IOException

next

public boolean next()
             throws IOException
Description copied from interface: RowSequence
Attempts to advances the current row to the next one. If true is returned the attempt has been successful, and if false is returned there are no more rows in this sequence. Since the initial position of a RowSequence is before the first row, this method must be called before current row data can be accessed using the RowSequence.getCell(int) or RowSequence.getRow() methods.

Specified by:
next in interface RowSequence
Returns:
true iff this sequence has been advanced to the next row
Throws:
IOException - if there is some error

getCell

public Object getCell(int icol)
               throws IOException
Description copied from interface: RowSequence
Returns the contents of a cell in the current row. The class of the returned object should be the same as, or a subclass of, the class returned by getColumnInfo(icol).getContentClass(). An unchecked exception will be thrown if there is no current row (next has not yet been called).

Specified by:
getCell in interface RowSequence
Returns:
the contents of cell icol in the current row
Throws:
IOException - if there is an error reading the data

getRow

public Object[] getRow()
                throws IOException
Description copied from interface: RowSequence
Returns the contents of the current table row, as an array with the same number of elements as there are columns in this table. An unchecked exception will be thrown if there is no current row (next has not yet been called).

Specified by:
getRow in interface RowSequence
Returns:
an array of the objects in each cell in row irow
Throws:
IOException - if there is an error reading the data

close

public void close()
           throws IOException
Description copied from interface: RowSequence
Indicates that this sequence will not be required any more. This should release resources associated with this object. The effect of calling any of the other methods following a close is undefined.

Specified by:
close in interface RowSequence
Throws:
IOException

getDec

public double getDec()
              throws IOException
Description copied from interface: ConeQueryRowSequence
Get central declination for the current row's cone search request in degrees.

Specified by:
getDec in interface ConeQueryRowSequence
Returns:
declination
Throws:
IOException

getRa

public double getRa()
             throws IOException
Description copied from interface: ConeQueryRowSequence
Get central right ascension for the current row's cone search request in degrees.

Specified by:
getRa in interface ConeQueryRowSequence
Returns:
right ascension
Throws:
IOException

getRadius

public double getRadius()
                 throws IOException
Description copied from interface: ConeQueryRowSequence
Get search radius for the current row's cone search request in degrees.

Specified by:
getRadius in interface ConeQueryRowSequence
Returns:
search radius
Throws:
IOException

getIndex

public long getIndex()
              throws IOException
Description copied from interface: ConeQueryRowSequence
Get the index in the underlying table to which the current row relates. The identity of this underlying table is not specified by this interface, but must be understood by the creator and user of instances. In particular, the return value does not necessarily increment by one for each call to next.

Specified by:
getIndex in interface ConeQueryRowSequence
Returns:
row index
Throws:
IOException


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.