use of com.alexstyl.specialdates.events.namedays.NamedaysList in project Memento-Calendar by alexstyl.
the class SpecialGreekNamedaysCalculator method calculateForEasterDate.
NamedayBundle calculateForEasterDate(Date easter) {
Node node = new SoundNode();
NamedaysList namedaysList = new NamedaysList();
for (EasternNameday easternNameday : easternNamedays) {
int daysUntilEaster = easternNameday.getDateToEaster();
Date date = easter.addDay(daysUntilEaster);
for (String name : easternNameday.getNamesCelebrating()) {
node.addDate(name, date);
namedaysList.addNameday(date, name);
}
}
appendSpecialScenarios(easter, node, namedaysList);
return new NamedayBundle(node, namedaysList);
}
use of com.alexstyl.specialdates.events.namedays.NamedaysList in project Memento-Calendar by alexstyl.
the class RomanianNamedays method calculateEasterIfNecessary.
private void calculateEasterIfNecessary(int year) {
if (romanianDate == null || romanianDate.getYear() != year) {
romanianDate = calculator.calculateSpecialRomanianDayForYear(year);
NamedaysList dateToNames = new NamedaysList();
CharacterNode namesToDate = new CharacterNode();
for (String name : names) {
dateToNames.addNameday(romanianDate, name);
namesToDate.addDate(name, romanianDate);
}
namedays = new NamedayBundle(namesToDate, dateToNames);
}
}
use of com.alexstyl.specialdates.events.namedays.NamedaysList in project Memento-Calendar by alexstyl.
the class NamedayJSONParser method createBundleWith.
private static NamedayBundle createBundleWith(NamedayJSON locale, Node namesToDate) {
NamedaysList dateToNames = new NamedaysList();
JSONArray data = locale.getData();
int size = data.length();
for (int i = 0; i < size; i++) {
try {
JSONObject nameday;
nameday = (JSONObject) data.get(i);
String dateString = nameday.getString("date");
Date theDate = getNamedaysFrom(dateString);
JSONArray variations = nameday.getJSONArray("names");
int numberOfVariations = variations.length();
for (int varCount = 0; varCount < numberOfVariations; varCount++) {
String variation = variations.getString(varCount);
namesToDate.addDate(variation, theDate);
dateToNames.addNameday(theDate, variation);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return new NamedayBundle(namesToDate, dateToNames);
}
Aggregations