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(), |
2f6b9a
|
34 |
EinzelEreignis.class.getName(), MuslimischesEreignis.class.getName(), |
d20d98
|
35 |
JulianischesEreignis.class.getName(), ChinesischesEreignis.class.getName() |
66d68b
|
36 |
}; |
U |
37 |
|
|
38 |
/** |
|
39 |
* Das Objekt, das das konkrete Ereignis definiert |
|
40 |
*/ |
|
41 |
protected Definition definition; |
|
42 |
|
|
43 |
/** |
|
44 |
* Die Definition des Ereignisses ermitteln |
|
45 |
* @return das Definitionsobjekt fuer dieses Ereignis |
|
46 |
*/ |
|
47 |
@Override |
|
48 |
public Definition getDefinition() { |
|
49 |
return definition; |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Die Definition dieses Ereignisses angeben |
|
54 |
* @param definition das Definitionsobjekt dieses Ereignisses |
|
55 |
*/ |
|
56 |
@Override |
|
57 |
public void setDefinition(Definition definition) { |
|
58 |
this.definition = definition; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Den Namen der Klasse ermitteln, der einem bestimmten Ereignistyp |
|
63 |
* entspricht. |
|
64 |
* |
|
65 |
* @param typ der Ereignistyp, Ereignis.TYP_DATUM, Ereignis.TYP_OSTERN, usw. |
|
66 |
* @return der Name der Klasse fuer den angegebenen Ereignistyp |
|
67 |
*/ |
|
68 |
public static String getKlassenname(int typ) { |
|
69 |
if(typ <= klassen.length) { |
|
70 |
return klassen[typ-1]; |
|
71 |
} else { |
|
72 |
return null; |
|
73 |
} |
|
74 |
} |
|
75 |
} |