astro
Class VizierStar

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by astro.VizierStar
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class VizierStar
extends PropertyBundles

This class converts a net.cds.Vizier.Table into a list of StarDescriptions. It uses ExpressionNodes and an ExpressionParser to evaluate the StarDescription fields from the net.cds.Vizier.Table. For this to work, the appropriate keys should point to String-expression that are then filled with data from the table at run-time. Keys that are empty mean that this info is not available in the VizieR catalog. The name of the star must always translate to a single field in the table. Its value is converted to a string. Values for the UCAC V2 release, its bright supplement, the hipparchos table, the guides-star catalog V 2.2. It is a pain in the ass if field names use normal parenthesis in their names, because those are reserved for arithemtics. There is no good solution for this. If you ever encounter field names with normal parenthesis, replace them with "[", parenthesis like "<" should be replaced with "{". A minus '-' can be expressed as a '.'.


Nested Class Summary
static class VizierStar.HipparchosUcac2
          This class compares the hipparchos main catalogue with the UCAC2 catalogue.
static class VizierStar.Retrieve
          Mainly for testing the class.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFDECALC
          The default de-expression for the UCAC2 catalog.
private static String DEFEPOCHCALC
          The default epoch expression.
private static String DEFEQUINOXCALC
          The default equinox expression.
private static String DEFNAMESEPARATE
          The default name separator is the empty string.
private static String DEFRACALC
          The default ra-expression for the UCAC2 catalog.
static String KEY_COLORCALC
          The key linked to the color expression.
static String KEY_DECALC
          The key linked to the declination expression.
static String KEY_EPOCHCALC
          The key linked to the epoch expression.
static String KEY_EQUINOXCALC
          The key linked to the equinox expression.
static String KEY_IDCALC
          The key linked to the id expression.
static String KEY_MAGCALC
          The key linked to the magnitude expression.
static String KEY_MIXEDID
          For mixed cataloges, this points to the mixed identifier.
static String KEY_MIXEDVALID
          This is a comma-separated list of star entries in mixed cataloges.
static String KEY_NAME
          The key linked to the Table field that is the name.
static String KEY_NAMEPREPEND
          The key linked to the static part of the name that prepends it.
static String KEY_NAMESEPARATE
          The key linked to the name separator in case of multiple fields.
static String KEY_PMDECALC
          The key linked to the proper motion in de expression.
static String KEY_PMRACALC
          The key linked to the proper motion in ra expression.
static String KEY_RACALC
          The key linked to the right ascension expression.
static String KEY_TABLEID
          The VizieR catalog ID.
static String KEY_TABLETEXT
          The Vizier table text.
private  List<String> mix
          A list of valid star identifiers or null for non-mixed cataloges.
private  List<String> nameid
          A list of name-identifier fields, normally only a single entry.
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
VizierStar(Map<String,String> prop)
          Constructs a new vizier-star conversion object.
 
Method Summary
private static Object evaluate(String node, Map data)
          Evaluates a single expression.
private static Object evaluate(String node, Map data, Class to)
          Evaluates a single expression.
private static Object evaluateSingle(String node, Map data, Class to)
          Evaluates a single expression.
 List<StarDescription> getFieldOfView(double centerra, double centerde, double radius)
          Retrieves a list of StarDescription objects utilizing the Vizier class.
 List<StarDescription> getFieldOfView(String centerobject, double radius)
          Retrieves a list of StarDescription objects utilizing the Vizier class.
 List<StarDescription> getFieldOfView(VizierTable tab)
          Parses a list of StarDescription objects utilizing the net.cds.Vizier.Table handed over.
private  StarDescription getOneStar(Map<String,Object> vizier)
          Converts a single net.cds.Vizier.Table data entry into a StarDescription.
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_TABLEID

public static final String KEY_TABLEID
The VizieR catalog ID.

See Also:
Constant Field Values

KEY_TABLETEXT

public static final String KEY_TABLETEXT
The Vizier table text.

See Also:
Constant Field Values

KEY_NAMEPREPEND

public static final String KEY_NAMEPREPEND
The key linked to the static part of the name that prepends it.

See Also:
Constant Field Values

KEY_NAME

public static final String KEY_NAME
The key linked to the Table field that is the name.

See Also:
Constant Field Values

KEY_NAMESEPARATE

public static final String KEY_NAMESEPARATE
The key linked to the name separator in case of multiple fields.

See Also:
Constant Field Values

KEY_IDCALC

public static final String KEY_IDCALC
The key linked to the id expression.

See Also:
Constant Field Values

KEY_RACALC

public static final String KEY_RACALC
The key linked to the right ascension expression.

See Also:
Constant Field Values

KEY_DECALC

public static final String KEY_DECALC
The key linked to the declination expression.

See Also:
Constant Field Values

KEY_PMRACALC

public static final String KEY_PMRACALC
The key linked to the proper motion in ra expression.

See Also:
Constant Field Values

KEY_PMDECALC

public static final String KEY_PMDECALC
The key linked to the proper motion in de expression.

See Also:
Constant Field Values

KEY_MAGCALC

public static final String KEY_MAGCALC
The key linked to the magnitude expression.

See Also:
Constant Field Values

KEY_COLORCALC

public static final String KEY_COLORCALC
The key linked to the color expression.

See Also:
Constant Field Values

KEY_EPOCHCALC

public static final String KEY_EPOCHCALC
The key linked to the epoch expression.

See Also:
Constant Field Values

KEY_EQUINOXCALC

public static final String KEY_EQUINOXCALC
The key linked to the equinox expression.

See Also:
Constant Field Values

KEY_MIXEDID

public static final String KEY_MIXEDID
For mixed cataloges, this points to the mixed identifier.

See Also:
Constant Field Values

KEY_MIXEDVALID

public static final String KEY_MIXEDVALID
This is a comma-separated list of star entries in mixed cataloges.

See Also:
Constant Field Values

DEFNAMESEPARATE

private static final String DEFNAMESEPARATE
The default name separator is the empty string.

See Also:
Constant Field Values

DEFRACALC

private static final String DEFRACALC
The default ra-expression for the UCAC2 catalog. '[' is replaced.

See Also:
Constant Field Values

DEFDECALC

private static final String DEFDECALC
The default de-expression for the UCAC2 catalog. '[' is replaced.

See Also:
Constant Field Values

DEFEQUINOXCALC

private static final String DEFEQUINOXCALC
The default equinox expression.

See Also:
Constant Field Values

DEFEPOCHCALC

private static final String DEFEPOCHCALC
The default epoch expression.

See Also:
Constant Field Values

nameid

private List<String> nameid
A list of name-identifier fields, normally only a single entry.


mix

private List<String> mix
A list of valid star identifiers or null for non-mixed cataloges.

Constructor Detail

VizierStar

public VizierStar(Map<String,String> prop)
Constructs a new vizier-star conversion object. This is a living reference because we want to have different properties on different converters. This constructor only defaults ra and de fields and the epoch and equinox.

Method Detail

getFieldOfView

public List<StarDescription> getFieldOfView(double centerra,
                                            double centerde,
                                            double radius)
Retrieves a list of StarDescription objects utilizing the Vizier class. From all tables retrieved, only the one matching KEY_TABLEID is kept. Thisnet.cds.Vizier.Table returned from the vizier call is converted into StarDescription objects by parsing and evaluating the appropriate expressions found in the vizier-star properties.

Parameters:
centerra - Center of the field, right ascension, in degrees.
centerde - Center of the field, declination, in degrees.
radius - Circular size of the FoV, degrees.

getFieldOfView

public List<StarDescription> getFieldOfView(String centerobject,
                                            double radius)
Retrieves a list of StarDescription objects utilizing the Vizier class. From all tables retrieved, only the one matching KEY_TABLEID is kept. This net.cds.Vizier.Table returned from the vizier call is converted into StarDescription objects by parsing and evaluating the appropriate expressions found in the vizier-star properties.

Parameters:
centerobject - The Simbad-resolvable name of the object in center.
radius - Circular size of the FoV, degrees.
Returns:
A list of StarDescriptions or null.

getFieldOfView

public List<StarDescription> getFieldOfView(VizierTable tab)
Parses a list of StarDescription objects utilizing the net.cds.Vizier.Table handed over. Entries are converted into StarDescription objects by parsing and evaluating the appropriate expressions found in the vizier-star properties.

Parameters:
tab - The table from the Vizier or the servlet.
Returns:
A list of StarDescriptions or null.

getOneStar

private StarDescription getOneStar(Map<String,Object> vizier)
Converts a single net.cds.Vizier.Table data entry into a StarDescription. The star data is parsed and evaluated using the expressions in the vizier-star properties. The names of the variables are the keys in the map, the numerical values are the values in the map.


evaluate

private static Object evaluate(String node,
                               Map data)
Evaluates a single expression. The data in the map is treated as a link from variable names to variable values. Note that variable names that contain characters also used in numerical expresseion, like parenthesis, must be stated in the expression with this chars replaced by the following table: If the expression is null or the parsing fails, Double.NaN is returned which is interpreted as integer zero. Implementation note: If the parsing turns out to be too slow, one can have a single ExpressionNode for each star-description field and only replace the variables in this method.


evaluate

private static Object evaluate(String node,
                               Map data,
                               Class to)
Evaluates a single expression. The data in the map is treated as a link from variable names to variable values. Note that variable names that contain characters also used in numerical expresseion, like parenthesis, must be stated in the expression with this chars replaced by the following table: Each entry in the node separated by '|' also means that parsing is done step-by-step until one of the expression is valid.

If the expression is null or the parsing fails, Double.NaN is returned which is interpreted as integer zero. Implementation note: If the parsing turns out to be too slow, one can have a single ExpressionNode for each star-description field and only replace the variables in this method.


evaluateSingle

private static Object evaluateSingle(String node,
                                     Map data,
                                     Class to)
Evaluates a single expression. The data in the map is treated as a link from variable names to variable values. Note that variable names that contain characters also used in numerical expresseion, like parenthesis, must be stated in the expression with this chars replaced by the following table: