net.sf.nachocalendar.components
Class MoonCalculation

java.lang.Object
  extended by net.sf.nachocalendar.components.MoonCalculation

public class MoonCalculation
extends java.lang.Object

File: MoonCalculation.java Author: Angus McIntyre Date: 31.05.96 Updated: 01.06.96 Java class to calculate the phase of the moon, given a date. The 'moonPhase' method is a Java port of some public domain C source which was apparently originally part of the Decus C distribution (whatever that was). Details of the algorithm are given below. To use this in a program, create an object of class 'MoonCalculation'. I'm not convinced that the algorithm is entirely accurate, but I don't know enough to confirm whether it is or not. HISTORY ------- 31.05.96 SLAM Converted from C 01.06.96 SLAM Added 'phaseName' to return the name of a phase. Fixed leap year test in 'daysInMonth'. LEGAL ----- This software is free. It can be used and modified in any way you choose. The author assumes no liability for any loss or damage you may incur through use of or inability to use this software. This disclaimer must appear on any modified or unmodified version of the software in which the name of the author also appears.


Constructor Summary
MoonCalculation()
           
 
Method Summary
 java.awt.Graphics drawMoon(java.awt.Graphics g, java.util.Date d, int posX, int posY, int size)
           
 boolean isLeapYearP(int year)
           
 int moonPhase(int year, int month, int day)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoonCalculation

public MoonCalculation()
Method Detail

moonPhase

public int moonPhase(int year,
                     int month,
                     int day)

isLeapYearP

public boolean isLeapYearP(int year)

drawMoon

public java.awt.Graphics drawMoon(java.awt.Graphics g,
                                  java.util.Date d,
                                  int posX,
                                  int posY,
                                  int size)