/*
|
Zeitrechnung - a class library to determine calendar events
|
Copyright (c) 1984-2023 Ulrich Hilger, http://uhilger.de
|
|
This program is free software: you can redistribute it and/or modify
|
it under the terms of the GNU Affero General Public License as published by
|
the Free Software Foundation, either version 3 of the License, or
|
(at your option) any later version.
|
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU Affero General Public License for more details.
|
|
You should have received a copy of the GNU Affero General Public License
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
*/
|
package de.uhilger.zeitrechnung.ereignis;
|
|
import de.uhilger.zeitrechnung.Datum;
|
import de.uhilger.zeitrechnung.Definition;
|
import de.uhilger.zeitrechnung.kalender.HebraeischerKalender;
|
import de.uhilger.zeitrechnung.kalender.ISOKalender;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* Ein Ereignis, das durch ein Datum im hebraeischen Kalender
|
* definiert ist.
|
*
|
* <p>
|
* Die Ereignis-Definition lautet:<br>
|
* HebraeischesEreignis.getDefinition.setp1(Monat des hebraeischen Kalenders);<br>
|
* HebraeischesEreignis.getDefinition.setp2(Tag im Monat des hebraeischen Kalenders);<br>
|
* wobei Monat einer Ganzzahl aus
|
* [HebraeischerKalender.NISAN .. HebraeischerKalender.ADAR]
|
* entspricht.
|
* </p>
|
*
|
* @author Ulrich Hilger
|
*/
|
public class HebraeischesEreignis extends EreignisBasis {
|
|
@Override
|
public int getTyp() {
|
return EreignisBasis.TYP_HEBRAEISCH;
|
}
|
|
@Override
|
public List<Datum> getZeitpunkte(long isoJahr) {
|
ISOKalender w = new ISOKalender();
|
long start = w.zuTagen(isoJahr, Definition.JANUAR, 1);
|
long end = w.zuTagen(isoJahr, Definition.DEZEMBER, 31);
|
|
HebraeischerKalender j = new HebraeischerKalender();
|
Datum hStart = j.vonTagen(start);
|
long hStartJahr = hStart.getJahr();
|
Datum hEnd = j.vonTagen(end);
|
long hEndJahr = hEnd.getJahr();
|
long anzahlJahre = (hEndJahr - hStartJahr) + (long) 1;
|
|
Definition def = getDefinition();
|
List daten = new ArrayList();
|
for (long y = 0; y < anzahlJahre; y++) {
|
long fixedDate = j.zuTagen(hStartJahr + y, (int) def.getp1(), (int) def.getp2());
|
if (fixedDate >= start && fixedDate <= end) {
|
Datum d = w.vonTagen(fixedDate);
|
daten.add(d);
|
}
|
}
|
return daten;
|
}
|
|
}
|