com.ghasemkiani.util
Class PersianCalendarHelper1

java.lang.Object
  extended bycom.ghasemkiani.util.PersianCalendarHelper1

public class PersianCalendarHelper1
extends java.lang.Object

This class is an illustration of the algorithm used for calculation of leap years in the arithmetic version of the Persian calendar system. This class is not actually used by other classes, but it can poractically substitute the PersianCalendarHelper class. The difference is that this class does not use algebraic formulas, but instead creates a table of year start days according to the algorithm. I have tested this class and it seems to be equivalent to the PersianCalendarHelper class, but its performance is lower.

This class is kept here just as an illustration of the algorithm. Please see the source file for more information.

Version:
2.1
Author:
Ghasem Kiani

Constructor Summary
PersianCalendarHelper1()
           
 
Method Summary
static boolean isLeapYear(long year)
          Determines if the specified year is a leap year in the Persian calendar.
static long jp(long j)
          Returns the date in the Persian calendar corresponding to the specified Julian day.
static long pj(long y, int m, int d)
          Returns the Julian day corresponding to the specified day in the Persian calendar.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersianCalendarHelper1

public PersianCalendarHelper1()
Method Detail

isLeapYear

public static boolean isLeapYear(long year)
Determines if the specified year is a leap year in the Persian calendar.

Parameters:
year - the "Persian" year.
Returns:
true if year is a leap year, false otherwise.

pj

public static long pj(long y,
                      int m,
                      int d)
Returns the Julian day corresponding to the specified day in the Persian calendar.

Parameters:
y - the Persian year.
m - the Persian month.
d - the Persian day.
Returns:
the Julian day corresponding to the specified date in the Persian calendar.

jp

public static long jp(long j)
Returns the date in the Persian calendar corresponding to the specified Julian day. The date fields (year, month, and day) are packed into a long value. See PersianCalendarUtils class for extraction of fields from the packed long value.

Parameters:
j - the Julian day.
Returns:
a packed long value containing the corresponding Persian year, month, and day.