heasarc.w3browse
Class HeasarcQuery

java.lang.Object
  |
  +--heasarc.w3browse.HeasarcQuery
All Implemented Interfaces:
java.lang.Runnable

public class HeasarcQuery
extends java.lang.Object
implements java.lang.Runnable

This class queries the HEASARC database. Results are returned as an array of columns. The query is run in a separate thread. The object tries to parse header information from the query quickly so that column information is available even before all data has been read in. However no actual query results are returned until the entire query has been parsed.


Constructor Summary
HeasarcQuery(java.lang.String fullUrl)
          The constructor starts the query.
 
Method Summary
 Column getColumn(int col)
          Get a column.
 Column getColumn(java.lang.String colname)
          Get a column.
 Column[] getColumns()
          Get all columns
 boolean[] getIsNumeric(boolean wait)
          Get flags indicating numeric columns.
 java.lang.String[] getNames(boolean wait)
          Get the column names.
 int getNcol()
          Get the number of columns.
 int getNrow()
           
 Column[] getNumericColumns()
          Get numeric columns
 java.lang.String[] getNumericNames()
          Get numeric column names
 java.lang.String[] getTypes(boolean wait)
          Get the column types.
 boolean isFail()
          Did the query fail?
 void run()
          Read and parse the query data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeasarcQuery

public HeasarcQuery(java.lang.String fullUrl)
             throws java.io.IOException
The constructor starts the query.
Method Detail

run

public void run()
Read and parse the query data. This is run in a separate thread to allow a program to do other things while a query is processed.
Specified by:
run in interface java.lang.Runnable

getNcol

public int getNcol()
            throws heasarc.w3browse.BadDataException
Get the number of columns. This routine will return as soon as the header is parsed.

getColumn

public Column getColumn(int col)
                 throws heasarc.w3browse.BadDataException
Get a column. This routine will return after the entire query has been parsed.
Parameters:
col - The index of the desired column

getColumn

public Column getColumn(java.lang.String colname)
                 throws heasarc.w3browse.BadDataException
Get a column. This routine will return after the entire query has been parsed.
Parameters:
col - The name of the desired column

getNames

public java.lang.String[] getNames(boolean wait)
                            throws heasarc.w3browse.BadDataException
Get the column names. This routine will return valid data as soon as header parsing is complete.
Parameters:
wait - Wait for the results?

getTypes

public java.lang.String[] getTypes(boolean wait)
                            throws heasarc.w3browse.BadDataException
Get the column types. This routine can return valid results as soon as header parsing is complete.
Parameters:
wait - Wait for results?

getIsNumeric

public boolean[] getIsNumeric(boolean wait)
                       throws heasarc.w3browse.BadDataException
Get flags indicating numeric columns. This routine can return valid data as soon as header parsing is complete.
Parameters:
wait - Wait for results?

isFail

public boolean isFail()
Did the query fail?

getNrow

public int getNrow()
            throws heasarc.w3browse.BadDataException

getColumns

public Column[] getColumns()
                    throws heasarc.w3browse.BadDataException
Get all columns

getNumericColumns

public Column[] getNumericColumns()
                           throws heasarc.w3browse.BadDataException
Get numeric columns

getNumericNames

public java.lang.String[] getNumericNames()
                                   throws heasarc.w3browse.BadDataException
Get numeric column names