skyview.request
Class SourceCoordinates

java.lang.Object
  extended by skyview.request.SourceCoordinates
All Implemented Interfaces:
java.lang.Runnable

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

Converts user input to coordinates and stores coordinates in decimal and sexigesimal formats. The class attempts to handle most coordinate strings locally, but object name requests are sent to the HEASARC Object name resolver. Some more exotic coordinate strings may also be handled there.


Constructor Summary
SourceCoordinates(double d1, double d2)
           
SourceCoordinates(java.lang.String s, java.lang.String csn, double equinox, java.lang.String resolver)
          Constructor
 
Method Summary
 boolean convertToCoords()
          convert user input string to coords
 boolean equals(java.lang.Object arg)
          Determines is this object is equal to another object.
 java.lang.String getCtype()
          returns coordinate system of center coordinates
 java.lang.String getEnteredText()
          get coordinates in hh mm ss format
 double getEquinox()
          returns equinox of center coordinates
 java.lang.String getObjectName()
          returns center object name
 java.lang.String getResolver()
          returns name resolver
 boolean getSpecialEpoch()
          returns special epoch of center coordinates
 double getX()
          get center coordinates in XXX.XX (decimal) format
 java.lang.String getXhhmmss()
          returns center coordinate in hh mm ss format
 double getY()
          get center coordinate in XXX.XX (decimal) format
 java.lang.String getYhhmmss()
          get center coordinate in hh mm ss format
 int hashCode()
          Overiding hashCode and equals methods to find equal requests in an attempt to increase efficiency.
 java.lang.String heasarcResolve()
          Set up and send query to resolve source name
static void main(java.lang.String[] args)
          Test functionality.
 void parseCoords()
          extract coordinates that match coordinate system of user patch from query return
 void run()
          send query to resolve user input
 void setAllCoords(java.lang.String xh, java.lang.String yh, double x, double y, java.lang.String obj)
          Update center coordinates or object in decimal and HHMMSS forms.
protected  void setX(double x)
          Set the X value
protected  void setY(double x)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceCoordinates

public SourceCoordinates(double d1,
                         double d2)

SourceCoordinates

public SourceCoordinates(java.lang.String s,
                         java.lang.String csn,
                         double equinox,
                         java.lang.String resolver)
Constructor

Parameters:
s - text entered as coordinates or object name
csn - name of coordinate system
equinox - equinox of coordinate system
resolver - resolver to be used to resolve object name
Method Detail

hashCode

public int hashCode()
Overiding hashCode and equals methods to find equal requests in an attempt to increase efficiency.

Overrides:
hashCode in class java.lang.Object
Returns:
hashcode of object

equals

public boolean equals(java.lang.Object arg)
Determines is this object is equal to another object. if the coordinate system, epoch , sourcename are the same they are considered equal.

Overrides:
equals in class java.lang.Object

getEnteredText

public java.lang.String getEnteredText()
get coordinates in hh mm ss format


setAllCoords

public void setAllCoords(java.lang.String xh,
                         java.lang.String yh,
                         double x,
                         double y,
                         java.lang.String obj)
Update center coordinates or object in decimal and HHMMSS forms. Used when previously resolved coordinates are the same.

Parameters:
xh - center coordinates in HHMMSS format
yh - center coordinates in HHMMSS format
x - center coordinates in decimal format
y - center coordinates in decimal format
obj - center object name

getXhhmmss

public java.lang.String getXhhmmss()
returns center coordinate in hh mm ss format


getYhhmmss

public java.lang.String getYhhmmss()
get center coordinate in hh mm ss format


getX

public double getX()
get center coordinates in XXX.XX (decimal) format


getY

public double getY()
get center coordinate in XXX.XX (decimal) format


getObjectName

public java.lang.String getObjectName()
returns center object name

Returns:
object name or null if coordinates were entered

getEquinox

public double getEquinox()
returns equinox of center coordinates


getSpecialEpoch

public boolean getSpecialEpoch()
returns special epoch of center coordinates


getResolver

public java.lang.String getResolver()
returns name resolver


getCtype

public java.lang.String getCtype()
returns coordinate system of center coordinates


convertToCoords

public boolean convertToCoords()
convert user input string to coords

Returns:
true if coordinates were successfully resolved, false if not

stop

public void stop()

run

public void run()
send query to resolve user input

Specified by:
run in interface java.lang.Runnable

parseCoords

public void parseCoords()
extract coordinates that match coordinate system of user patch from query return


heasarcResolve

public java.lang.String heasarcResolve()
Set up and send query to resolve source name

Returns:
unparsed return from HEASARC query

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test functionality.

Throws:
java.lang.Exception

setX

protected void setX(double x)
Set the X value


setY

protected void setY(double x)