astro
Class StarDescription

java.lang.Object
  extended by astro.StarDescription
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
PastelStar, StarSextractor, TargetSql.StarSql

public class StarDescription
extends Object
implements Cloneable, Serializable

A helper class containing general information on a star. This class expands the HashMap class and provides access to the following properties.

Additional to the Object returns of the simple properties lookup defined above, this class allows retrieving and setting of the following properties as primitive data types. Note that retrieving the the double values is not costly because an internal copy of the appropriate values is asociated with instances of this class. On the other hand, no validity checks are performed on retrieving values from this object. It is in the users responsibility to handle this class correctly.

See Also:
Serialized Form

Nested Class Summary
static class StarDescription.StarComparator<T extends StarDescription>
          Gets a star definition comparator linked to the named property of the star.
 
Field Summary
private  Map<String,Object> addon
          A mapping of additinal properties of the stars to their values.
private  Float color
          The color of the star.
static String COLOR
          The color index shortcut.
private  Double de
          The declination of the star.
static String DEC
          The declination of the star shortcut.
static float DEFCOLOR
          The default color of the star (0.0).
static float DEFEPOCH
          The default epoch (2000.0).
static float DEFEQUINOX
          The default equinox (2000.0).
static int DEFID
          The default star id (0=undefined).
static double DEFPROPDEC
          The default proper motion in dec (0.0).
static double DEFPROPRA
          The default proper motion in ra (0.0).
private  Float epoch
          Epoch.
static String EPOCH
          The epoch shortcut.
private  Float equinox
          Equinox of ra de.
static String EQUINOX
          The equinox shortcut.
private  Integer id
          Integer id of the star.
static String ID
          The identifier of the star shortcut.
private  Float mag
          The magnitude of the star.
static String MAG
          The magnitude shortcut.
private  String name
          Name of the star.
static String NAME
          The name of the star shortcut.
private  Double pmde
          Proper motion in de, in milli arc-sec per year.
private  Double pmra
          Proper motion in ra, in milli arc-sec per year, divided by cosine dec.
static String PROPDEC
          The declination of the star shortcut.
static String PROPRA
          The proper motion in right ascension of the star shortcut.
private  Double ra
          The right ascension of the star.
static String RA
          The right ascension of the star shortcut.
private static long serialVersionUID
           
static StarDescription SOL
           
private static String SOLNAME
           
static String UNKNOWN
          Unknown star names.
 
Constructor Summary
StarDescription()
          Constructs a new empty star description.
StarDescription(StarDescription copy)
          Constructs a new star description from the source object.
StarDescription(String name)
          Constructs a new empty star description.
StarDescription(String name, String ras, String decs, String mags)
          Constructs a new star description with the minimal information.
StarDescription(String name, String id, String ras, String decs, String mags, String color)
          Constructs a new star description.
StarDescription(String name, String id, String ras, String decs, String pra, String pdec, String mags, String color)
          Constructs a new star description.
StarDescription(String name, String id, String ras, String decs, String pra, String pdec, String ep, String eq, String mags, String color)
          Constructs a new full star description.
 
Method Summary
 boolean equals(Object other)
          Two stars are equal if they have the same name, or if their separation is zero.
static Map<Integer,StarDescription> exportIdMap(List<StarDescription> l)
          Exports a list of stas as a mapping of star names to stars.
static Map<String,StarDescription> exportNameMap(List<StarDescription> l)
          Exports a list of stas as a mapping of star names to stars.
 void fillMissing(StarDescription fill)
          Fills missing data in this star description from the target source.
static StarDescription fillMissing(StarDescription main, StarDescription fill)
          Adds all data that is missing from the first star entry, but present in the second into the first and returns it.
 Object get(String key)
          Returns the queried value in its string representation of addintional info.
 float getColor()
          Returns the color of the star as a float.
 double getDec()
          Returns the declination of the star as a double.
 float getEpoch()
          Returns the epoch of the position coordinate system as a float.
 float getEquinox()
          Returns the equinox of the position coordinate system as a float.
 int getID()
          Returns the star id as an int.
 float getMag()
          Returns the magnitude of the star as a float.
 String getName()
          Returns the target name.
 double getPropDec()
          Returns the proper motion in declination of the star as a double.
 String getProperty(String key)
          Returns the queried value in its string representation of addintional info.
 double getPropRa()
          Returns the proper motion in ra of the star as a double.
 double getRa()
          Returns the right ascension of the star as a double.
 double getSeparation(double ra2, double de2)
          Returns the distance in degrees of this star description to the argument one.
static double getSeparation(double ra1, double ra2, double de1, double de2)
          Returns the distance of two stars, in degrees.
 double getSeparation(StarDescription other)
          Returns the distance in degrees of this star description to the argument one.
static double getSeparation(StarDescription s1, StarDescription s2)
          Returns the distance of two stars, in degrees.
 boolean isFullyValid()
          Checks if ra, de, mag, color, pmra, and pmde are defined.
 boolean isMarginallyValid()
          Checks if at least the right ascension and the declination is valid.
static boolean isSexagesimal(String dms)
          We try to infer if a specified string is in sexagesimal format, which we define by twice occurance of ':'.
 boolean isValid()
          Checks if ra, de, and mag of the star is defined.
 boolean isVeryValid()
          Checks if ra, de, mag, and color is defined.
 boolean matches(StarDescription s2, double maxdist, float magoff)
          Tries to match two stars.
static double parseSexagesimal(String dms)
          We convert a string given as dd:mm:ss.sss into a normal double.
 Object set(String key, Object to)
          Sets the object.
 Object setColor(float bv)
          Sets the color of the star.
 Object setDec(double dec)
          Sets the declination of the star.
 Object setEpoch(float ep)
          Sets the epoch of the position coordinate system.
 Object setEquinox(float eq)
          Sets the equinox of the position coordinate system.
 Object setID(int id)
          Sets the star id.
 Object setMag(float v)
          Sets the brightness of the star.
 Object setName(String name)
          Sets the target name.
 Object setPropDec(double pdec)
          Sets the proper motion in dec of the star.
 Object setProperty(String key, String val)
          Scans the key for recognized keywords.
 Object setPropRa(double pra)
          Sets the proper motion in ra of the star.
 Object setRa(double ra)
          Sets the right ascension of the star.
 String toString()
          Converts the star description name, ra, dec, mag and color into a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

UNKNOWN

public static final String UNKNOWN
Unknown star names.

See Also:
Constant Field Values

NAME

public static final String NAME
The name of the star shortcut.

See Also:
Constant Field Values

ID

public static final String ID
The identifier of the star shortcut. Should be a parsable integer.

See Also:
Constant Field Values

RA

public static final String RA
The right ascension of the star shortcut.

See Also:
Constant Field Values

DEC

public static final String DEC
The declination of the star shortcut.

See Also:
Constant Field Values

PROPRA

public static final String PROPRA
The proper motion in right ascension of the star shortcut.

See Also:
Constant Field Values

PROPDEC

public static final String PROPDEC
The declination of the star shortcut.

See Also:
Constant Field Values

EPOCH

public static final String EPOCH
The epoch shortcut.

See Also:
Constant Field Values

EQUINOX

public static final String EQUINOX
The equinox shortcut.

See Also:
Constant Field Values

MAG

public static final String MAG
The magnitude shortcut.

See Also:
Constant Field Values

COLOR

public static final String COLOR
The color index shortcut.

See Also:
Constant Field Values

DEFEPOCH

public static final float DEFEPOCH
The default epoch (2000.0).

See Also:
Constant Field Values

DEFEQUINOX

public static final float DEFEQUINOX
The default equinox (2000.0).

See Also:
Constant Field Values

DEFPROPRA

public static final double DEFPROPRA
The default proper motion in ra (0.0).

See Also:
Constant Field Values

DEFPROPDEC

public static final double DEFPROPDEC
The default proper motion in dec (0.0).

See Also:
Constant Field Values

DEFCOLOR

public static final float DEFCOLOR
The default color of the star (0.0).

See Also:
Constant Field Values

DEFID

public static final int DEFID
The default star id (0=undefined).

See Also:
Constant Field Values

SOLNAME

private static final String SOLNAME
See Also:
Constant Field Values

name

private String name
Name of the star.


id

private Integer id
Integer id of the star. Unique number defining the star, like a HD #.


ra

private Double ra
The right ascension of the star.


de

private Double de
The declination of the star.


mag

private Float mag
The magnitude of the star. Color system unspecified, but mostly V.


color

private Float color
The color of the star. Filter difference unspecified, but mostly B-V.


epoch

private Float epoch
Epoch.


equinox

private Float equinox
Equinox of ra de.


pmra

private Double pmra
Proper motion in ra, in milli arc-sec per year, divided by cosine dec.


pmde

private Double pmde
Proper motion in de, in milli arc-sec per year.


addon

private Map<String,Object> addon
A mapping of additinal properties of the stars to their values.


SOL

public static StarDescription SOL
Constructor Detail

StarDescription

public StarDescription()
Constructs a new empty star description. Note that all fields are undefined.


StarDescription

public StarDescription(String name)
Constructs a new empty star description. Note that all fields are undefined.


StarDescription

public StarDescription(StarDescription copy)
Constructs a new star description from the source object. Does not copy the extra information, this is lost.


StarDescription

public StarDescription(String name,
                       String ras,
                       String decs,
                       String mags)
Constructs a new star description with the minimal information.

Parameters:
name - Name of the star.
ras - Right ascension of the star.
decs - Declination of the star.
mags - Brightness of the star.

StarDescription

public StarDescription(String name,
                       String id,
                       String ras,
                       String decs,
                       String mags,
                       String color)
Constructs a new star description.

Parameters:
name - Name of the star.
id - ID of the star.
ras - Right ascension of the star.
decs - Declination of the star.
mags - Brightness of the star.
color - Color index of the star.

StarDescription

public StarDescription(String name,
                       String id,
                       String ras,
                       String decs,
                       String pra,
                       String pdec,
                       String mags,
                       String color)
Constructs a new star description.

Parameters:
name - Name of the star.
id - ID of the star.
ras - Right ascension of the star.
decs - Declination of the star.
mags - Brightness of the star.
color - Color index of the star.

StarDescription

public StarDescription(String name,
                       String id,
                       String ras,
                       String decs,
                       String pra,
                       String pdec,
                       String ep,
                       String eq,
                       String mags,
                       String color)
Constructs a new full star description.

Parameters:
name - Name of the star.
id - ID of the star.
ras - Right ascension of the star.
decs - Declination of the star.
pra - Proper motion in ra of the star.
pdec - Proper motion in dec of the star.
ep - Epoch of the coordinate system.
eq - Equinox of the coordinate system.
mags - Brightness of the star.
color - Color index of the star.
Method Detail

get

public Object get(String key)
Returns the queried value in its string representation of addintional info.


getProperty

public String getProperty(String key)
Returns the queried value in its string representation of addintional info.


setProperty

public Object setProperty(String key,
                          String val)
Scans the key for recognized keywords. If the key is known, the appropriate set... method is called, otherwise the parent's class put method is invoked. If parsing fails the property in the underlying Hashtable is not changed.


set

public Object set(String key,
                  Object to)
Sets the object.


setName

public Object setName(String name)
Sets the target name.


getName

public String getName()
Returns the target name.


setID

public Object setID(int id)
Sets the star id.


getID

public int getID()
Returns the star id as an int.


setRa

public Object setRa(double ra)
Sets the right ascension of the star.


getRa

public double getRa()
Returns the right ascension of the star as a double.


setDec

public Object setDec(double dec)
Sets the declination of the star.


getDec

public double getDec()
Returns the declination of the star as a double.


setPropRa

public Object setPropRa(double pra)
Sets the proper motion in ra of the star.


getPropRa

public double getPropRa()
Returns the proper motion in ra of the star as a double.


setPropDec

public Object setPropDec(double pdec)
Sets the proper motion in dec of the star.


getPropDec

public double getPropDec()
Returns the proper motion in declination of the star as a double.


setEpoch

public Object setEpoch(float ep)
Sets the epoch of the position coordinate system.


getEpoch

public float getEpoch()
Returns the epoch of the position coordinate system as a float.


setEquinox

public Object setEquinox(float eq)
Sets the equinox of the position coordinate system.


getEquinox

public float getEquinox()
Returns the equinox of the position coordinate system as a float.


setMag

public Object setMag(float v)
Sets the brightness of the star.


getMag

public float getMag()
Returns the magnitude of the star as a float.


setColor

public Object setColor(float bv)
Sets the color of the star.


getColor

public float getColor()
Returns the color of the star as a float.


getSeparation

public double getSeparation(StarDescription other)
Returns the distance in degrees of this star description to the argument one. This method assumes the two stars to be in close vicinity.


getSeparation

public double getSeparation(double ra2,
                            double de2)
Returns the distance in degrees of this star description to the argument one. This method assumes the two stars to be in close vicinity.


getSeparation

public static final double getSeparation(StarDescription s1,
                                         StarDescription s2)
Returns the distance of two stars, in degrees. Does not check for equinox/epoch equality, this is assumed to be identical.

Returns:
The distance of the two stars in degrees.

getSeparation

public static final double getSeparation(double ra1,
                                         double ra2,
                                         double de1,
                                         double de2)
Returns the distance of two stars, in degrees. Does not check for equinox/epoch equality, this is assumed to be identical.

Returns:
The distance of the two positions in degrees.

equals

public boolean equals(Object other)
Two stars are equal if they have the same name, or if their separation is zero.

Overrides:
equals in class Object

matches

public boolean matches(StarDescription s2,
                       double maxdist,
                       float magoff)
Tries to match two stars. This method retuirn true, if the separation between the stars is within the maximum distiance and if their magnitudes match. Color is considered to be rather unreliable, therefore it is not matched. If either this stars or the target star has a non-defined magnitude, the magnitude comparison is supressed.


toString

public String toString()
Converts the star description name, ra, dec, mag and color into a string. String starinfo = (guide.getName() == null ? "N/N":guide.getName())+ " (RA: "+Convert.getSexagesimal(guide.getRa()/15.," "," ","",1)+ " DE: " +Convert.getSexagesimal(guide.getDec()," "," ","",0)+")";

Overrides:
toString in class Object

isSexagesimal

public static boolean isSexagesimal(String dms)
We try to infer if a specified string is in sexagesimal format, which we define by twice occurance of ':'.


parseSexagesimal

public static double parseSexagesimal(String dms)
We convert a string given as dd:mm:ss.sss into a normal double.


isMarginallyValid

public boolean isMarginallyValid()
Checks if at least the right ascension and the declination is valid.


isValid

public boolean isValid()
Checks if ra, de, and mag of the star is defined.


isVeryValid

public boolean isVeryValid()
Checks if ra, de, mag, and color is defined.


isFullyValid

public boolean isFullyValid()
Checks if ra, de, mag, color, pmra, and pmde are defined.


fillMissing

public void fillMissing(StarDescription fill)
Fills missing data in this star description from the target source.


fillMissing

public static StarDescription fillMissing(StarDescription main,
                                          StarDescription fill)
Adds all data that is missing from the first star entry, but present in the second into the first and returns it.


exportNameMap

public static Map<String,StarDescription> exportNameMap(List<StarDescription> l)
Exports a list of stas as a mapping of star names to stars. Null-names are ignored.


exportIdMap

public static Map<Integer,StarDescription> exportIdMap(List<StarDescription> l)
Exports a list of stas as a mapping of star names to stars. Null-id are overwritn in -1