net.aerith.misao.database
Class CatalogDBReader

java.lang.Object
  |
  +--net.aerith.misao.catalog.io.CatalogReader
        |
        +--net.aerith.misao.database.CatalogDBReader

public class CatalogDBReader
extends CatalogReader

The CatalogDBReader is a class to read catalog database. The open, readNext, close methods and the read method are available. This is for access to the catalog database as it were a catalog file.

The reader must return the stars within the square area represented by the specified field of view in definition. However, the CatalogDBReader returns the stars within the circular area, because it invokes the CatalogDBManager#getAccessor with a radius.

So in principle, the circular area must be the circumcircle of the square represented by the specified field of view. But actually, this is only used in identification to read stars on the image. Considering the rotation of the image, the field of view represents the square area which covers the circumcircle of the image. Therefore, in order to read all stars overlapping on the image, the radius for CatalogDBManager#getAccessor is the half of the specified field of view. That is, this returns the stars within the incscribed circle, not the circumcircle, of the square area represented by the specified field of view.


Field Summary
protected  CatalogDBAccessor accessor
          The accessor to the catalog database.
protected  boolean first_flag
          The first flag.
protected  CatalogDBManager manager
          The catalog database manager.
 
Fields inherited from class net.aerith.misao.catalog.io.CatalogReader
center_coor, date, limiting_mag, url_set
 
Constructor Summary
CatalogDBReader(CatalogDBManager manager)
          Construct a CatalogDBReader.
 
Method Summary
 void close()
          Closes a catalog.
 java.lang.String getName()
          Gets the catalog name.
 void open()
          Opens a catalog to read all star data.
 void open(Coor coor, double fov)
          Opens a catalog.
 CatalogStar readNext()
          Reads one star from the opened catalog.
 
Methods inherited from class net.aerith.misao.catalog.io.CatalogReader
addURL, getDateLimit, getDateLimitMessage, getFovLimit, getFovLimitMessage, getHelpMessage, getMaximumPositionErrorInArcsec, hasDateLimit, hasFovLimit, isDateDependent, isFile, isInDirectory, read, setDate, setDefaultURL, setLimitingMagnitude, supportsExamination
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

manager

protected CatalogDBManager manager
The catalog database manager.

accessor

protected CatalogDBAccessor accessor
The accessor to the catalog database.

first_flag

protected boolean first_flag
The first flag.
Constructor Detail

CatalogDBReader

public CatalogDBReader(CatalogDBManager manager)
Construct a CatalogDBReader.
Parameters:
manager - the catalog database manager.
Method Detail

getName

public java.lang.String getName()
Gets the catalog name. It must be unique among all subclasses.
Overrides:
getName in class CatalogReader
Returns:
the catalog name.

open

public void open()
          throws java.io.IOException,
                 java.io.FileNotFoundException,
                 CdromNotFoundException
Opens a catalog to read all star data. This method must be invoked at first.
Overrides:
open in class CatalogReader
Throws:
java.io.IOException - if a file cannot be accessed.
java.io.FileNotFoundException - if a file does not exists in any URL.
CdromNotFoundException - if this reader is to read data from CD-ROMs and a file does not exists in any URL.

open

public void open(Coor coor,
                 double fov)
          throws java.io.IOException,
                 java.io.FileNotFoundException,
                 CdromNotFoundException
Opens a catalog. This method must be invoked at first.
Overrides:
open in class CatalogReader
Parameters:
coor - the R.A. and Decl. of the center.
fov - the field of view to read in degree.
Throws:
java.io.IOException - if a file cannot be accessed.
java.io.FileNotFoundException - if a file does not exists in any URL.
CdromNotFoundException - if this reader is to read data from CD-ROMs and a file does not exists in any URL.

readNext

public CatalogStar readNext()
                     throws java.io.IOException,
                            java.io.FileNotFoundException,
                            CdromNotFoundException,
                            QueryFailException
Reads one star from the opened catalog. After this method is invoked, the cursor is promoted to tne next star. When every data is read, it returns null.
Overrides:
readNext in class CatalogReader
Returns:
a star data.
Throws:
java.io.IOException - if a file cannot be accessed.
java.io.FileNotFoundException - if a file does not exists in any URL.
CdromNotFoundException - if this reader is to read data from CD-ROMs and a file does not exists in any URL.
QueryFailException - if the query to the server is failed.

close

public void close()
Closes a catalog. This method must be invoked finally.
Overrides:
close in class CatalogReader
Throws:
java.io.IOException - if a file cannot be accessed.