|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--com.ibexconsulting.demonstration.SunCalculation
This class is used to calculate the sunrise, sunset, and day length for a given latitude. If told to support a graph it will generate these facts for the entire year at one time and store the values in an array of sun facts. This allows the graph to be painted more efficiently when requested. The class is designed so it can be used independently of the SunStuff applet sample. All latitudes are in degrees and converted internally to radians for calculations. Effects related to longitude, time zone, and daylight savings time are ignored as well as marginal effects related to the year not being exactly 365 days long.
| Constructor Summary | |
SunCalculation()
Creates a new sun calculation class. |
|
SunCalculation(double TrialLatitude)
Creates a new sun calculation class. |
|
SunCalculation(double TrialLatitude,
boolean SupportsGraph)
Creates a new sun calculation class. |
|
| Method Summary | |
java.util.Calendar |
getCalendarInstance()
|
java.lang.String |
getDate()
|
java.lang.String |
getDayLength()
|
int |
getDayofYear()
|
int |
getDayofYearMaximum()
|
java.awt.Image |
getGraphImage(javax.swing.JComponent Component)
Paints a graph of the total hours of sunlight for the entire year onto a swing component. |
double |
getLatitude()
|
java.lang.String |
getSunRise()
|
java.lang.String |
getSunSet()
|
void |
setDate(java.util.Date TrialDate)
Sets the trial date. |
void |
setDate(int DayofYear)
Sets the trial date. |
void |
setLatitude(double TrialLatitude)
Sets the trial latitude. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SunCalculation()
public SunCalculation(double TrialLatitude)
TrialLatitude - The initial latitude in degrees.
public SunCalculation(double TrialLatitude,
boolean SupportsGraph)
TrialLatitude - The initial latitude in degrees.SupportsGraph - Defines whether the class can be used to draw a graph inside a swing component.
If true is selected, the sunrise, sunset, and hours in the day are calculated for the entire year
whenever the latitude is changed. If false is selected than the getGraphImage will return a null
every call.getGraphImage(JComponent Component)| Method Detail |
public java.util.Calendar getCalendarInstance()
public java.lang.String getDate()
public java.lang.String getDayLength()
public int getDayofYear()
public int getDayofYearMaximum()
public double getLatitude()
public java.awt.Image getGraphImage(javax.swing.JComponent Component)
The - swing JComponent objectSunCalculation(double TrialLatitude, boolean SupportsGraph)public java.lang.String getSunRise()
public java.lang.String getSunSet()
public void setDate(int DayofYear)
The - day number of the current year.public void setDate(java.util.Date TrialDate)
Date - object.
public void setLatitude(double TrialLatitude)
throws java.lang.Exception
Latitude - in degreesjava.lang.Exception - if TrialLatitude is not in the range of -90 to +90 degrees.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||