commit | author | age
|
66d68b
|
1 |
/* |
U |
2 |
Zeitrechnung - a class library to determine calendar events |
|
3 |
Copyright (c) 1984-2023 Ulrich Hilger, http://uhilger.de |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.zeitrechnung.ereignis; |
|
19 |
|
|
20 |
import de.uhilger.zeitrechnung.Definition; |
|
21 |
|
|
22 |
|
|
23 |
/** |
|
24 |
* Abstrakte Basisklasse fuer alle Ereignis-Klassen |
|
25 |
* |
|
26 |
* @author Ulrich Hilger |
|
27 |
*/ |
|
28 |
public abstract class EreignisBasis implements Ereignis { |
|
29 |
|
|
30 |
private static final String[] klassen = { |
|
31 |
DatumEreignis.class.getName(), TagWocheMonatEreignis.class.getName(), |
|
32 |
TagDatumEreignis.class.getName(), OsterEreignis.class.getName(), |
|
33 |
JahreszeitEreignis.class.getName(), HebraeischesEreignis.class.getName(), |
|
34 |
EinzelEreignis.class.getName(), MuslimischesEreignis.class.getName() |
|
35 |
}; |
|
36 |
|
|
37 |
/** |
|
38 |
* Das Objekt, das das konkrete Ereignis definiert |
|
39 |
*/ |
|
40 |
protected Definition definition; |
|
41 |
|
|
42 |
/** |
|
43 |
* Die Definition des Ereignisses ermitteln |
|
44 |
* @return das Definitionsobjekt fuer dieses Ereignis |
|
45 |
*/ |
|
46 |
@Override |
|
47 |
public Definition getDefinition() { |
|
48 |
return definition; |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* Die Definition dieses Ereignisses angeben |
|
53 |
* @param definition das Definitionsobjekt dieses Ereignisses |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
public void setDefinition(Definition definition) { |
|
57 |
this.definition = definition; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Den Namen der Klasse ermitteln, der einem bestimmten Ereignistyp |
|
62 |
* entspricht. |
|
63 |
* |
|
64 |
* @param typ der Ereignistyp, Ereignis.TYP_DATUM, Ereignis.TYP_OSTERN, usw. |
|
65 |
* @return der Name der Klasse fuer den angegebenen Ereignistyp |
|
66 |
*/ |
|
67 |
public static String getKlassenname(int typ) { |
|
68 |
if(typ <= klassen.length) { |
|
69 |
return klassen[typ-1]; |
|
70 |
} else { |
|
71 |
return null; |
|
72 |
} |
|
73 |
} |
|
74 |
} |