Hijri representation (HijriDate):
- Override Date toString() to replace 'Jan' with Dhu'l-Hijja and other values. - PDate returns instances of HijriDate that return Hijri Strings. Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
d4be36ebf8
commit
a0d4fdf9f6
18
src/HijriDate.java
Normal file
18
src/HijriDate.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to be used in Hajj-sim. Overrides toString()
|
||||||
|
* Incomplete.
|
||||||
|
*/
|
||||||
|
class HijriDate extends Date {
|
||||||
|
|
||||||
|
public HijriDate(long timeInMillis) {
|
||||||
|
super(timeInMillis);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return super.toString().replaceAll("Jan","Dhu'l-Hijja")
|
||||||
|
.replaceAll("AST", "");
|
||||||
|
}
|
||||||
|
}
|
@ -13,13 +13,13 @@ public class MakkahCity {
|
|||||||
private static Date allArrivedToHotelsTime;
|
private static Date allArrivedToHotelsTime;
|
||||||
|
|
||||||
private static final PDate firstDayTimeMan = new PDate(
|
private static final PDate firstDayTimeMan = new PDate(
|
||||||
new GregorianCalendar(2020, Calendar.JANUARY, 1, 4, 0, 0),
|
new GregorianCalendar(1442, Calendar.JANUARY, 9, 4, 0, 0),
|
||||||
new GregorianCalendar(2020, Calendar.JANUARY, 1, 18, 0, 0)
|
new GregorianCalendar(1442, Calendar.JANUARY, 9, 18, 0, 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
private static final PDate lastDayTimeMan = new PDate(
|
private static final PDate lastDayTimeMan = new PDate(
|
||||||
new GregorianCalendar(2020, Calendar.JANUARY, 4, 12, 0, 0),
|
new GregorianCalendar(1442, Calendar.JANUARY, 12, 12, 0, 0),
|
||||||
new GregorianCalendar(2020, Calendar.JANUARY, 4, 22, 0, 0)
|
new GregorianCalendar(1442, Calendar.JANUARY, 12, 22, 0, 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
private static PDate currenttimeManager = firstDayTimeMan;
|
private static PDate currenttimeManager = firstDayTimeMan;
|
||||||
|
@ -35,15 +35,15 @@ public class PDate extends Calendar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Date getStartTime() {
|
public Date getStartTime() {
|
||||||
return startCalendar.getTime();
|
return new HijriDate(startCalendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getEndTime(){
|
public Date getEndTime(){
|
||||||
return endCalendar.getTime();
|
return new HijriDate(endCalendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCurrentTime() {
|
public Date getCurrentTime() {
|
||||||
return currentCalendar.getTime();
|
return new HijriDate(currentCalendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void step(int key, int value){
|
public void step(int key, int value){
|
||||||
|
Loading…
Reference in New Issue
Block a user